php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61265
Patch autoload.patch revision 2013-06-24 07:22 UTC by jwalton at m3hc dot com

Patch autoload.patch for Class/Object related Bug #61265

Patch version 2013-06-24 07:22 UTC

Return to Bug #61265 | Download this patch
Patch Revisions:

Developer: jwalton@m3hc.com

diff -ru php-5.5.0/ext/dom/document.c php-5.5.0.patch/ext/dom/document.c
--- php-5.5.0/ext/dom/document.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/dom/document.c	2013-06-24 02:19:47.801397746 -0400
@@ -2374,7 +2374,7 @@
 
 	if (baseclass_len) {
 		zend_class_entry **pce;
-		if (zend_lookup_class(baseclass, baseclass_len, &pce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(baseclass, baseclass_len, &pce TSRMLS_CC, 0) == FAILURE) {
 			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", baseclass);
 			return;
 		}
@@ -2388,7 +2388,7 @@
 
 	if (extendedclass_len) {
 		zend_class_entry **pce;
-		if (zend_lookup_class(extendedclass, extendedclass_len, &pce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(extendedclass, extendedclass_len, &pce TSRMLS_CC, 0) == FAILURE) {
 			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", extendedclass);
 		}
 		ce = *pce;
diff -ru php-5.5.0/ext/opcache/zend_accelerator_util_funcs.c php-5.5.0.patch/ext/opcache/zend_accelerator_util_funcs.c
--- php-5.5.0/ext/opcache/zend_accelerator_util_funcs.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/opcache/zend_accelerator_util_funcs.c	2013-06-24 03:02:57.353256853 -0400
@@ -910,7 +910,7 @@
 
 		CG(in_compilation) = 1;
 		while ((int)opline_num != -1) {
-			if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num - 1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num - 1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) {
+			if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num - 1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num - 1].op2.u.constant), &pce TSRMLS_CC, 0) == SUCCESS) {
 				do_bind_inherited_class(&op_array->opcodes[opline_num], EG(class_table), *pce, 1 TSRMLS_CC);
 			}
 			opline_num = op_array->opcodes[opline_num].result.u.opline_num;
diff -ru php-5.5.0/ext/pdo/pdo_dbh.c php-5.5.0.patch/ext/pdo/pdo_dbh.c
--- php-5.5.0/ext/pdo/pdo_dbh.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/pdo/pdo_dbh.c	2013-06-24 02:22:04.127390328 -0400
@@ -528,7 +528,7 @@
 	if (ZEND_NUM_ARGS() > 1 && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_STATEMENT_CLASS, (void**)&opt)) {
 		if (Z_TYPE_PP(opt) != IS_ARRAY || zend_hash_index_find(Z_ARRVAL_PP(opt), 0, (void**)&item) == FAILURE
 			|| Z_TYPE_PP(item) != IS_STRING
-			|| zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC) == FAILURE
+			|| zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC, 0) == FAILURE
 		) {
 			pdo_raise_impl_error(dbh, NULL, "HY000", 
 				"PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); "
@@ -797,7 +797,7 @@
 			if (Z_TYPE_P(value) != IS_ARRAY
 				|| zend_hash_index_find(Z_ARRVAL_P(value), 0, (void**)&item) == FAILURE
 				|| Z_TYPE_PP(item) != IS_STRING
-				|| zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC) == FAILURE
+				|| zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC, 0) == FAILURE
 			) {
 				pdo_raise_impl_error(dbh, NULL, "HY000", 
 					"PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); "
diff -ru php-5.5.0/ext/pdo/pdo_stmt.c php-5.5.0.patch/ext/pdo/pdo_stmt.c
--- php-5.5.0/ext/pdo/pdo_stmt.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/pdo/pdo_stmt.c	2013-06-24 02:22:33.818388713 -0400
@@ -951,7 +951,7 @@
 					fetch_value(stmt, &val, i++, NULL TSRMLS_CC);
 					if (Z_TYPE(val) != IS_NULL) {
 						convert_to_string(&val);
-						if (zend_lookup_class(Z_STRVAL(val), Z_STRLEN(val), &cep TSRMLS_CC) == FAILURE) {
+						if (zend_lookup_class(Z_STRVAL(val), Z_STRLEN(val), &cep TSRMLS_CC, 0) == FAILURE) {
 							stmt->fetch.cls.ce = ZEND_STANDARD_CLASS_DEF_PTR;
 						} else {
 							stmt->fetch.cls.ce = *cep;
@@ -1969,7 +1969,7 @@
 					pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "classname must be a string" TSRMLS_CC);
 				} else {
 					retval = zend_lookup_class(Z_STRVAL_PP(args[skip+1]),
-						Z_STRLEN_PP(args[skip+1]), &cep TSRMLS_CC);
+						Z_STRLEN_PP(args[skip+1]), &cep TSRMLS_CC, 0);
 
 					if (SUCCESS == retval && cep && *cep) {
 						stmt->fetch.cls.ce = *cep;
diff -ru php-5.5.0/ext/readline/readline_cli.c php-5.5.0.patch/ext/readline/readline_cli.c
--- php-5.5.0/ext/readline/readline_cli.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/readline/readline_cli.c	2013-06-24 03:00:33.249264693 -0400
@@ -527,7 +527,7 @@
 			class_name_len = class_name_end - text;
 			class_name = zend_str_tolower_dup(text, class_name_len);
 			class_name[class_name_len] = '\0'; /* not done automatically */
-			if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
+			if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC, 0)==FAILURE) {
 				efree(class_name);
 				return NULL;
 			}
diff -ru php-5.5.0/ext/reflection/php_reflection.c php-5.5.0.patch/ext/reflection/php_reflection.c
--- php-5.5.0/ext/reflection/php_reflection.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/reflection/php_reflection.c	2013-06-24 02:24:40.223381835 -0400
@@ -2196,7 +2196,7 @@
 					ce = Z_OBJCE_PP(classref);
 				} else {
 					convert_to_string_ex(classref);
-					if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC) == FAILURE) {
+					if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC, 0) == FAILURE) {
 						zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 								"Class %s does not exist", Z_STRVAL_PP(classref));
 						return;
@@ -2424,7 +2424,7 @@
 				return;
 			}
 			pce= &ce->parent;
-		} else if (zend_lookup_class(param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) {
+		} else if (zend_lookup_class(param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC, 0) == FAILURE) {
 			zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 				"Class %s does not exist", param->arg_info->class_name);
 			return;
@@ -2704,7 +2704,7 @@
 	/* Find the class entry */
 	switch (Z_TYPE_P(classname)) {
 		case IS_STRING:
-			if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
+			if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC, 0) == FAILURE) {
 				zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 						"Class %s does not exist", Z_STRVAL_P(classname));
 				if (classname == &ztmp) {
@@ -3320,7 +3320,7 @@
 		}
 	} else {
 		convert_to_string_ex(&argument);
-		if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC, 0) == FAILURE) {
 			if (!EG(exception)) {
 				zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument));
 			}
@@ -3879,7 +3879,7 @@
 		name_len = name_len - (classname_len + 2);
 		name = tmp + 2;
 
-		if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC, 0) == FAILURE) {
 			if (!EG(exception)) {
 				zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname);
 			}
@@ -4534,7 +4534,7 @@
 
 	switch(class_name->type) {
 		case IS_STRING:
-			if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
+			if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC, 0) == FAILURE) {
 				zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 						"Class %s does not exist", Z_STRVAL_P(class_name));
 				return;
@@ -4579,7 +4579,7 @@
 
 	switch(interface->type) {
 		case IS_STRING:
-			if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
+			if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC, 1) == FAILURE) {
 				zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 						"Interface %s does not exist", Z_STRVAL_P(interface));
 				return;
@@ -4793,7 +4793,7 @@
 	/* Find the class entry */
 	switch (Z_TYPE_P(classname)) {
 		case IS_STRING:
-			if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
+			if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC, 0) == FAILURE) {
 				zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
 						"Class %s does not exist", Z_STRVAL_P(classname));
 				return;
diff -ru php-5.5.0/ext/soap/soap.c php-5.5.0.patch/ext/soap/soap.c
--- php-5.5.0/ext/soap/soap.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/soap/soap.c	2013-06-24 03:01:09.204262737 -0400
@@ -1273,7 +1273,7 @@
 		return;
 	}
 
-	found = zend_lookup_class(classname, classname_len, &ce TSRMLS_CC);
+	found = zend_lookup_class(classname, classname_len, &ce TSRMLS_CC, 0);
 
 	if (found != FAILURE) {
 		service->type = SOAP_CLASS;
diff -ru php-5.5.0/ext/spl/php_spl.c php-5.5.0.patch/ext/spl/php_spl.c
--- php-5.5.0/ext/spl/php_spl.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/spl/php_spl.c	2013-06-24 02:25:25.501379372 -0400
@@ -77,7 +77,7 @@
 		found = zend_hash_find(EG(class_table), lc_name, len +1, (void **) &ce);
 		free_alloca(lc_name, use_heap);
 	} else {
- 		found = zend_lookup_class(name, len, &ce TSRMLS_CC);
+ 		found = zend_lookup_class(name, len, &ce TSRMLS_CC, 0);
  	}
  	if (found != SUCCESS) {
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Class %s does not exist%s", name, autoload ? " and could not be loaded" : "");
@@ -939,6 +939,9 @@
 	PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(spl_fixedarray)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
+	REGISTER_LONG_CONSTANT("AUTOLOAD_CLASS", PHP_AUTOLOAD_CLASS, CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("AUTOLOAD_INTERFACE", PHP_AUTOLOAD_INTERFACE, CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("AUTOLOAD_TRAIT", PHP_AUTOLOAD_TRAIT, CONST_CS | CONST_PERSISTENT);
 
 	return SUCCESS;
 }
diff -ru php-5.5.0/ext/spl/php_spl.h php-5.5.0.patch/ext/spl/php_spl.h
--- php-5.5.0/ext/spl/php_spl.h	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/spl/php_spl.h	2013-06-24 00:37:32.383731562 -0400
@@ -72,6 +72,10 @@
 	int          hash_mask_init;
 ZEND_END_MODULE_GLOBALS(spl)
 
+#define PHP_AUTOLOAD_CLASS 0
+#define PHP_AUTOLOAD_INTERFACE 1
+#define PHP_AUTOLOAD_TRAIT 2
+
 #ifdef ZTS
 # define SPL_G(v) TSRMG(spl_globals_id, zend_spl_globals *, v)
 extern int spl_globals_id;
diff -ru php-5.5.0/ext/spl/spl_iterators.c php-5.5.0.patch/ext/spl/spl_iterators.c
--- php-5.5.0/ext/spl/spl_iterators.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/spl/spl_iterators.c	2013-06-24 02:25:48.933378097 -0400
@@ -1411,7 +1411,7 @@
 			ce = Z_OBJCE_P(zobject);
 			if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) {
 				if (ZEND_NUM_ARGS() > 1) {
-					if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE 
+					if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC, 0) == FAILURE 
 					|| !instanceof_function(ce, *pce_cast TSRMLS_CC)
 					|| !(*pce_cast)->get_iterator
 					) {
diff -ru php-5.5.0/ext/standard/user_filters.c php-5.5.0.patch/ext/standard/user_filters.c
--- php-5.5.0/ext/standard/user_filters.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/standard/user_filters.c	2013-06-24 02:29:26.919366237 -0400
@@ -331,7 +331,7 @@
 	/* bind the classname to the actual class */
 	if (fdat->ce == NULL) {
 		if (FAILURE == zend_lookup_class(fdat->classname, strlen(fdat->classname),
-					(zend_class_entry ***)&fdat->ce TSRMLS_CC)) {
+					(zend_class_entry ***)&fdat->ce TSRMLS_CC, 0)) {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING,
 					"user-filter \"%s\" requires class \"%s\", but that class is not defined",
 					filtername, fdat->classname);
diff -ru php-5.5.0/ext/standard/var_unserializer.c php-5.5.0.patch/ext/standard/var_unserializer.c
--- php-5.5.0/ext/standard/var_unserializer.c	2013-06-19 16:14:53.000000000 -0400
+++ php-5.5.0.patch/ext/standard/var_unserializer.c	2013-06-24 02:28:56.663367883 -0400
@@ -618,7 +618,7 @@
 	do {
 		/* Try to find class directly */
 		BG(serialize_lock) = 1;
-		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC, 0) == SUCCESS) {
 			BG(serialize_lock) = 0;
 			if (EG(exception)) {
 				efree(class_name);
@@ -675,7 +675,7 @@
 		}
 		
 		/* The callback function may have defined the class */
-		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC, 0) == SUCCESS) {
 			ce = *pce;
 		} else {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val);
diff -ru php-5.5.0/ext/standard/var_unserializer.re php-5.5.0.patch/ext/standard/var_unserializer.re
--- php-5.5.0/ext/standard/var_unserializer.re	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/standard/var_unserializer.re	2013-06-24 03:02:12.160259312 -0400
@@ -684,7 +684,7 @@
 	do {
 		/* Try to find class directly */
 		BG(serialize_lock) = 1;
-		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC, 0) == SUCCESS) {
 			BG(serialize_lock) = 0;
 			if (EG(exception)) {
 				efree(class_name);
@@ -741,7 +741,7 @@
 		}
 		
 		/* The callback function may have defined the class */
-		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC, 0) == SUCCESS) {
 			ce = *pce;
 		} else {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val);
diff -ru php-5.5.0/ext/sybase_ct/php_sybase_ct.c php-5.5.0.patch/ext/sybase_ct/php_sybase_ct.c
--- php-5.5.0/ext/sybase_ct/php_sybase_ct.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/sybase_ct/php_sybase_ct.c	2013-06-24 03:03:39.543254558 -0400
@@ -1867,7 +1867,7 @@
 				zend_class_entry **pce = NULL;
 				convert_to_string(object);
 
-				if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
+				if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC, 0) == FAILURE) {
 					php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase:  Class %s has not been declared", Z_STRVAL_P(object));
 					/* Use default (ZEND_STANDARD_CLASS_DEF_PTR) */
 				} else {
diff -ru php-5.5.0/ext/xsl/xsltprocessor.c php-5.5.0.patch/ext/xsl/xsltprocessor.c
--- php-5.5.0/ext/xsl/xsltprocessor.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/ext/xsl/xsltprocessor.c	2013-06-24 03:03:56.959253610 -0400
@@ -671,7 +671,7 @@
 				curce = curce->parent;
 			}
 
-			found = zend_lookup_class(ret_class, ret_class_len, &ce TSRMLS_CC);
+			found = zend_lookup_class(ret_class, ret_class_len, &ce TSRMLS_CC, 0);
 			if ((found != SUCCESS) || !instanceof_function(*ce, curce TSRMLS_CC)) {
 				xmlFreeDoc(newdocp);
 				php_error_docref(NULL TSRMLS_CC, E_WARNING, 
diff -ru php-5.5.0/main/streams/userspace.c php-5.5.0.patch/main/streams/userspace.c
--- php-5.5.0/main/streams/userspace.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/main/streams/userspace.c	2013-06-24 02:31:50.645358417 -0400
@@ -536,7 +536,7 @@
 
 	rsrc_id = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols);
 
-	if (zend_lookup_class(uwrap->classname, classname_len, (zend_class_entry***)&uwrap->ce TSRMLS_CC) == SUCCESS) {
+	if (zend_lookup_class(uwrap->classname, classname_len, (zend_class_entry***)&uwrap->ce TSRMLS_CC, 0) == SUCCESS) {
 		uwrap->ce = *(zend_class_entry**)uwrap->ce;
 		if (php_register_url_stream_wrapper_volatile(protocol, &uwrap->wrapper TSRMLS_CC) == SUCCESS) {
 			RETURN_TRUE;
diff -ru php-5.5.0/Zend/zend_API.c php-5.5.0.patch/Zend/zend_API.c
--- php-5.5.0/Zend/zend_API.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_API.c	2013-06-24 02:52:59.303289392 -0400
@@ -594,7 +594,7 @@
 					break;
 				}
 				convert_to_string_ex(arg);
-				if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
+				if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC, 0) == FAILURE) {
 					*pce = NULL;
 				} else {
 					*pce = *lookup;
@@ -2713,7 +2713,7 @@
 			*strict_class = 1;
 			ret = 1;
 		}
-	} else if (zend_lookup_class_ex(name, name_len, NULL, 1, &pce TSRMLS_CC) == SUCCESS) {
+	} else if (zend_lookup_class_ex(name, name_len, NULL, 1, &pce TSRMLS_CC, 0) == SUCCESS) {
 		zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
 
 		fcc->calling_scope = *pce;
diff -ru php-5.5.0/Zend/zend_builtin_functions.c php-5.5.0.patch/Zend/zend_builtin_functions.c
--- php-5.5.0/Zend/zend_builtin_functions.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_builtin_functions.c	2013-06-24 02:56:05.239279275 -0400
@@ -822,7 +822,7 @@
 	} else if (Z_TYPE_P(arg) == IS_STRING) {
 		zend_class_entry **pce;
 		
-		if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC, 0) == SUCCESS) {
 			ce = *pce;
 		}
 	}
@@ -858,7 +858,7 @@
 
 	if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
 		zend_class_entry **the_ce;
-		if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC, 0) == FAILURE) {
 			RETURN_FALSE;
 		}
 		instance_ce = *the_ce;
@@ -868,7 +868,7 @@
 		RETURN_FALSE;
 	}
 
-	if (zend_lookup_class_ex(class_name, class_name_len, NULL, 0, &ce TSRMLS_CC) == FAILURE) {
+	if (zend_lookup_class_ex(class_name, class_name_len, NULL, 0, &ce TSRMLS_CC, 0) == FAILURE) {
 		retval = 0;
 	} else {
 		if (only_subclass && instance_ce == *ce) {
@@ -965,7 +965,7 @@
 		return;
 	}
 
-	if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == FAILURE) {
+	if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC, 0) == FAILURE) {
 		RETURN_FALSE;
 	} else {
 		array_init(return_value);
@@ -1054,7 +1054,7 @@
 		}
 		ce = Z_OBJCE_P(klass);
 	} else if (Z_TYPE_P(klass) == IS_STRING) {
-		if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) {
+		if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC, 0) == SUCCESS) {
 			ce = *pce;
 		}
 	}
@@ -1123,7 +1123,7 @@
 	if (Z_TYPE_P(klass) == IS_OBJECT) {
 		ce = Z_OBJCE_P(klass);
 	} else if (Z_TYPE_P(klass) == IS_STRING) {
-		if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC, 0) == FAILURE) {
 			RETURN_FALSE;
 		}
 		ce = *pce;
@@ -1185,7 +1185,7 @@
 	}
 
 	if (Z_TYPE_P(object) == IS_STRING) {
-		if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
+		if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC, 0) == FAILURE) {
 			RETURN_FALSE;
 		}
 		ce = *pce;
@@ -1249,7 +1249,7 @@
 		RETURN_BOOL(found == SUCCESS && !(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
 	}
 
- 	if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
+ 	if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC, 0) == SUCCESS) {
  		RETURN_BOOL(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0);
 	} else {
 		RETURN_FALSE;
@@ -1292,7 +1292,7 @@
 		RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE);
 	}
 
- 	if (zend_lookup_class(iface_name, iface_name_len, &ce TSRMLS_CC) == SUCCESS) {
+ 	if (zend_lookup_class(iface_name, iface_name_len, &ce TSRMLS_CC, 1) == SUCCESS) {
  		RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) > 0);
 	} else {
 		RETURN_FALSE;
@@ -1335,7 +1335,7 @@
 		RETURN_BOOL(found == SUCCESS && (((*ce)->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
 	}
   
- 	if (zend_lookup_class(trait_name, trait_name_len, &ce TSRMLS_CC) == SUCCESS) {
+ 	if (zend_lookup_class(trait_name, trait_name_len, &ce TSRMLS_CC, 2) == SUCCESS) {
  		RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
 	} else {
 		RETURN_FALSE;
@@ -1406,7 +1406,7 @@
 		found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
 		free_alloca(lc_name, use_heap);
 	} else {
-		found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC);
+		found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC, 0);
 	}
 	if (found == SUCCESS) {
 		if ((*ce)->type == ZEND_USER_CLASS) { 
diff -ru php-5.5.0/Zend/zend_closures.c php-5.5.0.patch/Zend/zend_closures.c
--- php-5.5.0/Zend/zend_closures.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_closures.c	2013-06-24 02:56:36.237277589 -0400
@@ -120,7 +120,7 @@
 				(memcmp("static", class_name, sizeof("static") - 1) == 0)) {
 				ce = closure->func.common.scope;
 			}
-			else if (zend_lookup_class_ex(class_name, class_name_len, NULL, 1, &ce_p TSRMLS_CC) == FAILURE) {
+			else if (zend_lookup_class_ex(class_name, class_name_len, NULL, 1, &ce_p TSRMLS_CC, 0) == FAILURE) {
 				zend_error(E_WARNING, "Class '%s' not found", class_name);
 				zval_dtor(&tmp_zval);
 				RETURN_NULL();
diff -ru php-5.5.0/Zend/zend_compile.c php-5.5.0.patch/Zend/zend_compile.c
--- php-5.5.0/Zend/zend_compile.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_compile.c	2013-06-24 02:51:53.246292986 -0400
@@ -1819,8 +1819,8 @@
 		name_len = strlen(CG(active_op_array)->function_name);
 		zend_str_tolower_copy(lcname, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname)-1));
 		lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
-		if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) {
-			zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
+		if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && (CG(active_op_array)->num_args < 1 || CG(active_op_array)->num_args > 2 )) {
+			zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 or 2 arguments", ZEND_AUTOLOAD_FUNC_NAME);
 		}
 	}
 
@@ -3200,8 +3200,8 @@
 					zend_class_entry **fe_ce, **proto_ce;
 					int found, found2;
 
-					found = zend_lookup_class(fe_class_name, fe_class_name_len, &fe_ce TSRMLS_CC);
-					found2 = zend_lookup_class(proto_class_name, proto_class_name_len, &proto_ce TSRMLS_CC);
+					found = zend_lookup_class(fe_class_name, fe_class_name_len, &fe_ce TSRMLS_CC, 0);
+					found2 = zend_lookup_class(proto_class_name, proto_class_name_len, &proto_ce TSRMLS_CC, 0);
 
 					/* Check for class alias */
 					if (found != SUCCESS || found2 != SUCCESS ||
@@ -4643,7 +4643,7 @@
 				zend_class_entry **pce;
 
 				parent_name = &CONSTANT(fetch_class_opline->op2.constant);
-				if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) ||
+				if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC, 0) == FAILURE) ||
 				    ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) &&
 				     ((*pce)->type == ZEND_INTERNAL_CLASS))) {
 				    if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) {
@@ -4697,7 +4697,7 @@
 
 		CG(in_compilation) = 1;
 		while (opline_num != -1) {
-			if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRLEN_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) {
+			if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRLEN_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC, 0) == SUCCESS) {
 				do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), *pce, 0 TSRMLS_CC);
 			}
 			opline_num = op_array->opcodes[opline_num].result.opline_num;
diff -ru php-5.5.0/Zend/zend_execute_API.c php-5.5.0.patch/Zend/zend_execute_API.c
--- php-5.5.0/Zend/zend_execute_API.c	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_execute_API.c	2013-06-24 02:13:09.819419399 -0400
@@ -1010,11 +1010,12 @@
 }
 /* }}} */
 
-ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC,int want) /* {{{ */
 {
-	zval **args[1];
+	zval **args[2];
 	zval autoload_function;
 	zval *class_name_ptr;
+  zval *calltype;
 	zval *retval_ptr = NULL;
 	int retval, lc_length;
 	char *lc_name;
@@ -1087,12 +1088,16 @@
 
 	args[0] = &class_name_ptr;
 
+  ALLOC_ZVAL(calltype);
+  ZVAL_LONG(calltype, want);
+  args[1] = &calltype;
+
 	fcall_info.size = sizeof(fcall_info);
 	fcall_info.function_table = EG(function_table);
 	fcall_info.function_name = &autoload_function;
 	fcall_info.symbol_table = NULL;
 	fcall_info.retval_ptr_ptr = &retval_ptr;
-	fcall_info.param_count = 1;
+	fcall_info.param_count = 2;
 	fcall_info.params = args;
 	fcall_info.object_ptr = NULL;
 	fcall_info.no_separation = 1;
@@ -1109,6 +1114,7 @@
 
 	EG(autoload_func) = fcall_cache.function_handler;
 
+  zval_ptr_dtor(&calltype);
 	zval_ptr_dtor(&class_name_ptr);
 
 	zend_hash_quick_del(EG(in_autoload), lc_name, lc_length, hash);
@@ -1127,9 +1133,9 @@
 }
 /* }}} */
 
-ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC, int want) /* {{{ */
 {
-	return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC);
+	return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC, want);
 }
 /* }}} */
 
@@ -1529,6 +1535,7 @@
 	zend_class_entry **pce;
 	int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
 	int silent       = (fetch_type & ZEND_FETCH_CLASS_SILENT) != 0;
+  int wanttype = 0;
 
 	fetch_type &= ZEND_FETCH_CLASS_MASK;
 
@@ -1559,9 +1566,16 @@
 				}
 			}
 			break;
+    case ZEND_FETCH_CLASS_INTERFACE:
+      wanttype = 1;
+      break;
+    case ZEND_FETCH_CLASS_TRAIT:
+      wanttype = 2;
+      break;
 	}
 
-	if (zend_lookup_class_ex(class_name, class_name_len, NULL, use_autoload, &pce TSRMLS_CC) == FAILURE) {
+
+	if (zend_lookup_class_ex(class_name, class_name_len, NULL, use_autoload, &pce TSRMLS_CC, wanttype) == FAILURE) {
 		if (use_autoload) {
 			if (!silent && !EG(exception)) {
 				if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
@@ -1583,8 +1597,17 @@
 {
 	zend_class_entry **pce;
 	int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
+  int wanttype = 0;
+  switch( fetch_type & ZEND_FETCH_CLASS_MASK ) {
+    case ZEND_FETCH_CLASS_INTERFACE:
+      wanttype = 1;
+      break;
+    case ZEND_FETCH_CLASS_TRAIT:
+      wanttype = 2;
+      break;
+  }
 
-	if (zend_lookup_class_ex(class_name, class_name_len, key, use_autoload, &pce TSRMLS_CC) == FAILURE) {
+	if (zend_lookup_class_ex(class_name, class_name_len, key, use_autoload, &pce TSRMLS_CC, wanttype) == FAILURE) {
 		if (use_autoload) {
 			if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
 				if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
diff -ru php-5.5.0/Zend/zend_execute.h php-5.5.0.patch/Zend/zend_execute.h
--- php-5.5.0/Zend/zend_execute.h	2013-06-19 16:03:18.000000000 -0400
+++ php-5.5.0.patch/Zend/zend_execute.h	2013-06-24 02:07:21.769438336 -0400
@@ -61,8 +61,8 @@
 ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
 ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
 ZEND_API int zend_is_true(zval *op);
-ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
+ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC, int want);
+ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC, int want);
 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
 ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
 ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC