php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63070
Patch bug63070.patch revision 2012-09-13 08:28 UTC by laruence@php.net
revision 2012-09-13 08:28 UTC by laruence@php.net
revision 2012-09-12 06:48 UTC by laruence@php.net
revision 2012-09-12 06:29 UTC by laruence@php.net

Patch bug63070.patch for APC Bug #63070

Patch version 2012-09-12 06:48 UTC

Return to Bug #63070 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: laruence@php.net

Index: apc_zend.c
===================================================================
--- apc_zend.c	(revision 327144)
+++ apc_zend.c	(working copy)
@@ -121,10 +121,8 @@
     APC_ZEND_OPLINE
     zval *freeop1 = NULL;
     zval *inc_filename = NULL, tmp_inc_filename;
-    char realpath[MAXPATHLEN] = {0};
     php_stream_wrapper *wrapper;
     char *path_for_open;
-    char *full_path = NULL;
     int ret = 0;
     apc_opflags_t* flags = NULL;
 
@@ -153,7 +151,7 @@
 
     wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(inc_filename), &path_for_open, 0 TSRMLS_CC);
 
-    if (wrapper != &php_plain_files_wrapper || !(IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open)) || (full_path = expand_filepath(path_for_open, realpath TSRMLS_CC)))) {
+    if (wrapper != &php_plain_files_wrapper || !IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open))) {
         /* Fallback to original handler */
         if (inc_filename == &tmp_inc_filename) {
             zval_dtor(&tmp_inc_filename);
@@ -161,9 +159,6 @@
         return apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
     }
 
-    if (!full_path) {
-    	full_path = path_for_open;
-    }
     if (zend_hash_exists(&EG(included_files), realpath, strlen(realpath) + 1)) {
 #ifdef ZEND_ENGINE_2_4
         if (!(opline->result_type & EXT_TYPE_UNUSED)) {
@@ -186,31 +181,15 @@
         return 0;
     }
 
-    if (inc_filename == &tmp_inc_filename) {
-        zval_dtor(&tmp_inc_filename);
-    }
-
-    if(apc_reserved_offset != -1) {
-        /* Insanity alert: look into apc_compile.c for why a void** is cast to a apc_opflags_t* */
-        flags = (apc_opflags_t*) & (execute_data->op_array->reserved[apc_reserved_offset]);
-    }
-
-    if(flags && flags->deep_copy == 1) {
-        /* Since the op array is a local copy, we can cheat our way through the file inclusion by temporarily 
-         * changing the op to a plain require/include, calling its handler and finally restoring the opcode.
-         */
 #ifdef ZEND_ENGINE_2_4
-        opline->extended_value = (opline->extended_value == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
-        ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-        opline->extended_value = (opline->extended_value == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
+    opline->extended_value = (opline->extended_value == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
+    ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+    opline->extended_value = (opline->extended_value == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
 #else
-        Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
-        ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-        Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
+    Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
+    ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+    Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
 #endif
-    } else {
-        ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-    }
 
     return ret;
 }
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC