Problem with evalprovider
Closed this issue · 4 comments
PHP7, PhpConsole 07801c3
if I use code from examples:
$connector = PhpConsole\Helper::register();
if($connector->isActiveClient()) {
$handler = PC::getHandler();
$handler->start();
$connector->setSourcesBasePath(__DIR__);
$connector->setPassword('MyPass');
$evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
$evalProvider->disableFileAccessByOpenBaseDir();
$evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']);
$evalProvider->addSharedVarReference('post', $_POST);
$connector->startEvalRequestsListener();
}
than put:
return 2+2;
after CTRL + enter i got on console reply:
Cannot declare class PhpConsole\Storage, because the name is already in use -
if I use my older code (that worked for me before):
$connector = PhpConsole\Helper::register();
if($connector->isActiveClient()) {
$connector->setSourcesBasePath(__DIR__);
$connector->setPassword('MyPass');
$connector->getDebugDispatcher()->detectTraceAndSource = true;
$evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
$evalProvider->disableFileAccessByOpenBaseDir();
$evalProvider->addSharedVar('_DEBUG', ['post' => $_POST, 'get' => $_GET, 'session' => $_SESSION, 'server' => $_SERVER]);
$connector->startEvalRequestsListener();
$handler = PhpConsole\Handler::getInstance();
$handler->setHandleErrors(true);
$handler->setHandleExceptions(true);
$handler->start();
}
on console I got: Console was cleared
and nothing else
on other machine with PHP 5.4 and older version of PhpConsole everyting seems to be ok.
And another info, PC::debug($variable); worjs fine from *.php files
Another test:
$connector = PhpConsole\Helper::register();
if($connector->isActiveClient()) {
$connector->setSourcesBasePath(__DIR__);
$connector->setPassword('DupaWeza.8');
$connector->getDebugDispatcher()->detectTraceAndSource = true;
$evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
$evalProvider->disableFileAccessByOpenBaseDir();
$evalProvider->addSharedVar('_DEBUG', ['post' => $_POST, 'get' => $_GET, 'session' => $_SESSION, 'server' => $_SERVER]);
$handler = PhpConsole\Handler::getInstance();
$handler->setHandleErrors(true);
$handler->setHandleExceptions(true);
$handler->start();
$connector->startEvalRequestsListener();
}
return 2+2; ctrl + enter
and response:
Cannot declare class PhpConsole\Storage, because the name is already in use -phar:///somePath/lib/phpConsole.phar/Storage.php:15
Update: Problem with PHP7 occurs only from .phar that was build using examples/utils/build_phar.php
the same phar build with PHP 5.6 works fine.
PHAR builder is removed from php-console utils.