]> granicus.if.org Git - php/commitdiff
require() improvement as per Andi's suggestion
authorZeev Suraski <zeev@php.net>
Sat, 12 Jun 1999 06:59:54 +0000 (06:59 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 12 Jun 1999 06:59:54 +0000 (06:59 +0000)
Zend/zend-parser.y

index 3e3bf43ba7a2938d575c5d460c7749d1e40440a4..b7ffddca4764b1f9c5edfd00b37623fc5d56ea66 100644 (file)
@@ -176,8 +176,8 @@ statement:
        |       T_ECHO echo_expr_list ';'
        |       T_INLINE_HTML                   { do_echo(&$1 CLS_CC); }
        |       expr ';'                        { do_free(&$1 CLS_CC); }
-       |       T_REQUIRE T_CONSTANT_ENCAPSED_STRING ';'                        { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); }
-       |       T_REQUIRE '(' T_CONSTANT_ENCAPSED_STRING ')' ';'        { require_filename($3.u.constant.value.str.val CLS_CC); zval_dtor(&$3.u.constant); }
+       |       T_REQUIRE expr ';'                      { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } }
+       |       T_REQUIRE '(' expr ')' ';'      { if ($3.op_type==IS_CONST && $3.u.constant.type==IS_STRING) { require_filename($3.u.constant.value.str.val CLS_CC); zval_dtor(&$3.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$3 CLS_CC); } }
        |       T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); }
        |       T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); }
        |       ';'             /* empty statement */