cvs: php-src /ext/spl php_spl.c
| From: | Arnaud Le Blanc | Date: | Sat, 25 Apr 2009 21:05:00 +0000 |
| Subject: | cvs: php-src /ext/spl php_spl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-57252@lists.php.net to get a copy of this message | ||
lbarnaud Sat Apr 25 21:05:00 2009 UTC
Modified files:
/php-src/ext/spl php_spl.c
Log:
MFB5.3 (Fixed bug #38325 (spl_autoload_register() gaves wrong line for
"class not found"))
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.153&r2=1.154&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.153 php-src/ext/spl/php_spl.c:1.154
--- php-src/ext/spl/php_spl.c:1.153 Mon Apr 20 14:18:46 2009
+++ php-src/ext/spl/php_spl.c Sat Apr 25 21:05:00 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.153 2009/04/20 14:18:46 colder Exp $ */
+/* $Id: php_spl.c,v 1.154 2009/04/25 21:05:00 lbarnaud Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -311,7 +311,22 @@
EG(active_op_array) = original_active_op_array;
if (!found && !SPL_G(autoload_running)) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %v could not be
loaded", class_name);
+ /* For internal errors, we generate E_ERROR, for direct calls an exception is thrown.
+ * The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function
was called indirectly by
+ * the Zend engine.
+ */
+
+ char *sclass_name;
+ int sclass_name_len;
+
+ zend_unicode_to_string(ZEND_U_CONVERTER(UG(output_encoding_conv)), &sclass_name,
&sclass_name_len,
+ class_name.u, class_name_len);
+
+ if (active_opline->opcode != ZEND_FETCH_CLASS) {
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be
loaded", sclass_name);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded",
sclass_name);
+ }
}
} /* }}} */