Here is the ZE1 revision.

Ilia

On January 30, 2004 01:21 pm, you wrote:
> On Fri, 30 Jan 2004, Ilia Alshanetsky wrote:
> > Here is the final revision of the patch for the situation, if there are
> > no last minute objections, it'll go in the CVS and we'll proceed with
> > RC2.
>
> Uh, that is a ZE2 patch.  We are talking about PHP 4.3.5 RC2 here.
>
> -Rasmus
Index: zend_execute.c
===================================================================
RCS file: /repository/Zend/Attic/zend_execute.c,v
retrieving revision 1.316.2.28
diff -u -3 -p -r1.316.2.28 zend_execute.c
--- zend_execute.c      30 Jan 2004 02:22:31 -0000      1.316.2.28
+++ zend_execute.c      30 Jan 2004 18:37:21 -0000
@@ -2152,7 +2152,24 @@ send_by_ref:
                                                case ZEND_REQUIRE:
                                                        new_op_array = 
compile_filename(EX(opline)->op2.u.constant.value.lval, inc_filename TSRMLS_CC);
                                                        if (!new_op_array) {
-                                                               zend_error(E_ERROR, 
"Parse error inside included file.");
+                                                               /* small optimization 
for require() */
+                                                               if (EX(opline)->opcode 
== ZEND_REQUIRE) {
+                                                                       goto 
fatal_error;
+                                                               } else {
+                                                                       /* This check 
is needed to ensure that included file has a parse error 
+                                                                        * and we are 
no dealing with a non-existant include, which is not considered
+                                                                        * to be a 
fatal error.
+                                                                        */
+                                                                       
zend_file_handle file_handle = {0};
+                                                                       int can_open = 
(zend_open(inc_filename->value.str.val, &file_handle) == SUCCESS && 
ZEND_IS_VALID_FILE_HANDLE(&file_handle));
+                                                                       
zend_file_handle_dtor(&file_handle);
+
+                                                                       /* file open 
succeeded but still no op-array, likely parse error */
+                                                                       if (can_open) {
+fatal_error:
+                                                                               
zend_error(E_ERROR, "Parse error inside included file.");
+                                                                       }
+                                                               }
                                                        }
                                                        break;
                                                case ZEND_EVAL: {

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to