ID:               30541
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at dush dot student dot utwente dot nl
-Status:           Open
+Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: linux 2.6
 PHP Version:      5.0.2
 New Comment:

Can't find any errors here:
<?
eval('echo $blah;');
var_dump($php_errormsg);
echo $bla;
var_dump($php_errormsg);
?>
outputs:
---
Notice: Undefined variable: blah in /www/index.php(3) : eval()'d code
on line 1
string(24) "Undefined variable: blah" 
Notice: Undefined variable: bla in /www/index.php on line 7
string(23) "Undefined variable: bla"
---
Check your code.


Previous Comments:
------------------------------------------------------------------------

[2004-10-23 16:49:20] php at dush dot student dot utwente dot nl

Description:
------------
in debug mode, my script stores every error that occured in the script.
when an error occurs in eval(), the error is stored correctly in
$php_errormsg. however when the error occured in a function called by
eval() the error isn't stored anymore.

Reproduce code:
---------------
register_tick_function("store_errors", true);
function &store_errors($do_tick = true) {
        GLOBAL $php_errormsg;
        static $errors = array();
        if ($do_tick) {
                if (isset($php_errormsg) && $php_errormsg != "") {
                        if ($trace = debug_backtrace()) {
                                $func = $trace[1]['function'];
                                if (isset($trace[1]['class']))
                                        $func = 
$trace[1]['class'].$trace[1]['type'].$func;
                        }else {
                                $func = 'unknown';
                        }
                        $errors[] = array(
                                0 => $php_errormsg,
                                1 => $func
                        );
                        $php_errormsg = "";
                }
        }else {
                return $errors;
        }
}
/* stupid test function */
        function blah() { echo $blah2; echo "error is set here:
$php_errormsg<br>"; }
        eval ('echo $blah1; blah();');
        $ar = store_errors(false);
        while(list($key,$val) = each($ar)) {
                echo "{$key} => {$val[0]} in {$val[1]}<br>\n";
        }

Expected result:
----------------
Notice: Undefined variable: blah1 in
/home/dush/public_html/core/loader.inc.php(28) : eval()'d code on line
1

Notice: Undefined variable: blah2 in
/home/dush/public_html/core/loader.inc.php on line 27
error is set here: Undefined variable: blah2
0 => Undefined variable: blah1 in unknown
1 => Undefined variable: blah2 in blah

Actual result:
--------------
Notice: Undefined variable: blah1 in
/home/dush/public_html/core/loader.inc.php(28) : eval()'d code on line
1

Notice: Undefined variable: blah2 in
/home/dush/public_html/core/loader.inc.php on line 27
error is set here: Undefined variable: blah2
0 => Undefined variable: blah1 in unknown


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30541&edit=1

Reply via email to