zend-parser.y problems
| From: | john at webmeta dot com | Date: | Sat, 09 Sep 2000 03:08:46 +0000 |
| Subject: | zend-parser.y problems | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-32748@lists.php.net to get a copy of this message | ||
Hey folks-
Basically, the following code will cause an error:
#!./php -q
<?
define("SOME_CONSTANT", "./");
#The following causes a "expecting `T_CONSTANT_ENCAPSED_STRING'" error:
require_once(SOME_CONSTANT."somefile");
#These will not cause that error:
include_once(SOME_CONSTANT."somefile");
require(SOME_CONSTANT."somefile");
require_once(SOME_CONSTANT."somefile");
?>
So after searching through the Zend code a bit, specifically zend-parser.y:716,
I found this inconsistency:
1.82 (andi 02-Jul-00): | T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE,
&$$, &$2 CLS_CC); }
1.67 (andi 10-Mar-00): | T_INCLUDE_ONCE expr {
do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 CLS_CC); }
1.10 (zeev 22-Apr-99): | T_EVAL '(' expr ')' {
do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); }
1.85 (zeev 09-Aug-00): | T_REQUIRE expr { do_include_or_eval(ZEND_REQUIRE,
&$$, &$2 CLS_CC); }
1.85 (zeev 09-Aug-00): | T_REQUIRE_ONCE use_filename {
do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 CLS_CC); }
By changing line 720 from this:
| T_REQUIRE_ONCE use_filename { do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 CLS_CC); }
to this:
| T_REQUIRE_ONCE expr { do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 CLS_CC); }
the problem (as it exists in my scope) is fixed.
Zeev, Andi, can either of you shed some light on this code? I don't know the
Zend internals well enough to understand the intended functionality of
use_filename vs expr.
Thanks
John