# Wrong code generate with -e mode

- Thread: https://externals.io/message/476
- Original archive: https://news-web.php.net/php.internals/476
- Started by Derick Rethans on 2003-03-29T20:38:30+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #476 — Derick Rethans — 2003-03-29T20:38:30+00:00

URL: https://externals.io/message/476#476

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/

---

## #477 — Andrei Zmievski — 2003-03-29T20:46:27+00:00

URL: https://externals.io/message/476#477 · In reply to: #476

> 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

---

## #478 — Derick Rethans — 2003-03-29T20:48:56+00:00

URL: https://externals.io/message/476#478 · In reply to: #477

> 
> > […]
> 
> 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/
