Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a bug with assignment introduced in 4afa0af.

Refactoring the `eval()` statements to a separate function won't work as assignment in phpsh relies on `eval()` scoping variables inside `___Phpsh___::interactive_loop()`.
  • Loading branch information...
commit de65124869f9c845e8c51a8d7efff6078d85fcbf 1 parent 4afa0af
@whatthejeff whatthejeff authored
Showing with 19 additions and 20 deletions.
  1. +19 −20 src/phpsh.php
View
39 src/phpsh.php
@@ -493,24 +493,6 @@ function undefined_function_check($buffer) {
}
/**
- * eval with exception handling
- */
- function eval_and_handle($buffer) {
- try {
- $evalue = eval($buffer);
- } catch (Exception $e) {
- // unfortunately, almost all exceptions that aren't explicitly
- // thrown by users are uncatchable :(
- fwrite(STDERR,
- 'Uncaught exception: '.get_class($e).': '.
- $e->getMessage()."\n".
- $e->getTraceAsString()."\n");
- $evalue = null;
- }
- return $evalue;
- }
-
- /**
* The main interactive loop
*
* @author ccheever
@@ -565,13 +547,30 @@ function interactive_loop() {
if ($pid) {
pcntl_wait($status);
} else {
- $evalue = $this->eval_and_handle($buffer);
+ try {
+ $evalue = eval($buffer);
+ } catch (Exception $e) {
+ // unfortunately, almost all exceptions that aren't explicitly
+ // thrown by users are uncatchable :(
+ fwrite(STDERR, 'Uncaught exception: '.get_class($e).': '.
+ $e->getMessage()."\n".$e->getTraceAsString()."\n");
+ $evalue = null;
+ }
+
// if we are still alive..
$childpid = posix_getpid();
fwrite($this->_comm_handle, "child $childpid\n");
}
} else {
- $evalue = $this->eval_and_handle($buffer);
+ try {
+ $evalue = eval($buffer);
+ } catch (Exception $e) {
+ // unfortunately, almost all exceptions that aren't explicitly thrown
+ // by users are uncatchable :(
+ fwrite(STDERR, 'Uncaught exception: '.get_class($e).': '.
+ $e->getMessage()."\n".$e->getTraceAsString()."\n");
+ $evalue = null;
+ }
}
if ($buffer != "xdebug_break();\n") {
Please sign in to comment.
Something went wrong with that request. Please try again.