Wrong code generate with -e mode

php.internals

Derick Rethans

23 years ago
Hello, I encountered a weird bug that I cant quite figure out. It has to do with the extended-info mode (-m) of PHP. problem: the opcodes generated in extended-info mode are incorrect testscript: <?php class dbhelper { function quote($s) { return addslashes ($s); } } echo dbhelper::quote("tests"); ?> php configure: ./configure --disable-all output with 'php testscript.php': tests output with 'php -e testscript.php': <br /> <b>Fatal error</b>: Undefined class constant 'quote' in <b>/dat/dev/php/tests/testscript.php</b> on line <b>8</b><br /> /dat/dev/php/tests/testscript.php(8) : Fatal error - Undefined class constant 'quote' generated opcodes with 'php': line # op fetch ext operands ------------------------------------------------------------------------------- 2 0 ZEND_DECLARE_CLASS null, '%00dbhelper%2Fdat%2Fdev%2Fphp%2Fxdebug%2Ftests%2Ftest9.php2', 'dbhelper' 6 1 ZEND_VERIFY_ABSTRACT_CLASS null, 8 2 ZEND_FETCH_CLASS null, , 'dbhelper' 3 ZEND_INIT_STATIC_METHOD_CALL ~72, null, 'quote' 4 SEND_VAL 'tests' 5 DO_FCALL_BY_NAME 1 $108, , -1 6 ECHO $108 10 7 RETURN 1 generated opcodes with 'php -e': line # op fetch ext operands ------------------------------------------------------------------------------- 2 0 EXT_STMT 1 ZEND_DECLARE_CLASS null, '%00dbhelper%2Fdat%2Fdev%2Fphp%2Fxdebug%2Ftests%2Ftest9.php2', 'dbhelper' 6 2 ZEND_VERIFY_ABSTRACT_CLASS null, 8 3 EXT_STMT 4 ZEND_FETCH_CLASS null, , 'dbhelper' 5 FETCH_CONSTANT ~72, null 6 ZEND_INIT_STATIC_METHOD_CALL 7 SEND_VAL 'tests' 8 DO_FCALL_BY_NAME 1 $108, , -1 9 EXT_FCALL_END 10 ECHO $108 10 11 EXT_STMT 12 RETURN 1 As you can see there is no EXT_FCALL_BEGIN, and there is a FETCH_CONSTANT added (which causes the error message). I've no clue why, Andrei can not reproduce it, Timm can. regards, Derick
-- ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions http://www.jdimedia.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------

Andrei Zmievski

23 years ago
On Sat, 29 Mar 2003, Derick Rethans wrote:
> Hello, > > > I encountered a weird bug that I cant quite figure out. It has to do > with the extended-info mode (-m) of PHP.
You mean (-e). -Andrei http://www.gravitonic.com/ "When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute, and it's longer than any hour. That's relativity." -- Einstein, on relativity

Derick Rethans

23 years ago
On Sat, 29 Mar 2003, Andrei Zmievski wrote:
> On Sat, 29 Mar 2003, Derick Rethans wrote: > > > > I encountered a weird bug that I cant quite figure out. It has to do > > with the extended-info mode (-m) of PHP. > > You mean (-e).
oops, sorry, -e is what I mean. Derick
-- "my other box is your windows PC" ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------