cvs: ZendEngine2 / zend_builtin_functions.c zend_execute.h zend_execute_API.c /tests is_a.phpt php-src NEWS
| From: | Dmitry Stogov | Date: | Tue, 23 Aug 2005 07:23:30 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c zend_execute.h zend_execute_API.c /tests is_a.phpt php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4064@lists.php.net to get a copy of this message | ||
dmitry Tue Aug 23 03:23:30 2005 EDT
Added files:
/ZendEngine2/tests is_a.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_builtin_functions.c zend_execute.h
zend_execute_API.c
Log:
Changed is_a() and is_subcalls_of() functions to not call __autoload() (in the same way as
"instanceof" operator).
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2045&r2=1.2046&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2045 php-src/NEWS:1.2046
--- php-src/NEWS:1.2045 Fri Aug 19 11:18:49 2005
+++ php-src/NEWS Tue Aug 23 03:23:27 2005
@@ -2,7 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 6.0
- Unicode support. (Andrei, Dmitriy, et al)
-- Changed "instanceof" operator to not call __autoload(). (Dmitry)
+- Changed "instanceof" operator, is_a() and is_subcalls_of() functions to not
+ call __autoload(). (Dmitry)
- cURL improvements: (Ilia)
. Added curl_setopt_array() which allows setting of multiple cURL options.
. Added CURLINFO_HEADER_OUT to facilitate request retrieval.
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.288&r2=1.289&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.288 ZendEngine2/zend_builtin_functions.c:1.289
--- ZendEngine2/zend_builtin_functions.c:1.288 Tue Aug 23 02:51:11 2005
+++ ZendEngine2/zend_builtin_functions.c Tue Aug 23 03:23:29 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.288 2005/08/23 06:51:11 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.289 2005/08/23 07:23:29 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -674,7 +674,7 @@
convert_to_text_ex(class_name);
- if (zend_u_lookup_class(Z_TYPE_PP(class_name), Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name),
&ce TSRMLS_CC) == FAILURE) {
+ if (zend_u_lookup_class_ex(Z_TYPE_PP(class_name), Z_UNIVAL_PP(class_name),
Z_UNILEN_PP(class_name), 0, &ce TSRMLS_CC) == FAILURE) {
retval = 0;
} else {
if (only_subclass) {
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.h?r1=1.85&r2=1.86&ty=u
Index: ZendEngine2/zend_execute.h
diff -u ZendEngine2/zend_execute.h:1.85 ZendEngine2/zend_execute.h:1.86
--- ZendEngine2/zend_execute.h:1.85 Thu Aug 11 19:34:56 2005
+++ ZendEngine2/zend_execute.h Tue Aug 23 03:23:30 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.h,v 1.85 2005/08/11 23:34:56 andrei Exp $ */
+/* $Id: zend_execute.h,v 1.86 2005/08/23 07:23:30 dmitry Exp $ */
#ifndef ZEND_EXECUTE_H
#define ZEND_EXECUTE_H
@@ -66,6 +66,7 @@
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry
***ce TSRMLS_DC);
+ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload,
zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, 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);
ZEND_API int zend_u_eval_string(zend_uchar type, void *str, zval *retval_ptr, char *string_name
TSRMLS_DC);
http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.338&r2=1.339&ty=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.338 ZendEngine2/zend_execute_API.c:1.339
--- ZendEngine2/zend_execute_API.c:1.338 Mon Aug 22 08:22:08 2005
+++ ZendEngine2/zend_execute_API.c Tue Aug 23 03:23:30 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.338 2005/08/22 12:22:08 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.339 2005/08/23 07:23:30 dmitry Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -973,7 +973,7 @@
}
-ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry
***ce TSRMLS_DC)
+ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload,
zend_class_entry ***ce TSRMLS_DC)
{
zval **args[1];
zval autoload_function;
@@ -1001,7 +1001,7 @@
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact fuctionality of __autoload()
*/
- if (zend_is_compiling(TSRMLS_C)) {
+ if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
efree(lc_name);
return FAILURE;
}
@@ -1073,6 +1073,11 @@
return retval;
}
+ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry
***ce TSRMLS_DC)
+{
+ return zend_u_lookup_class_ex(type, name, name_length, 1, ce TSRMLS_CC);
+}
+
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
{
return zend_u_lookup_class(IS_STRING, name, name_length, ce TSRMLS_CC);
@@ -1429,7 +1434,7 @@
ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, void *class_name, uint
class_name_len, int fetch_type TSRMLS_DC)
{
zend_class_entry **pce;
- zend_bool use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
+ int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
fetch_type = fetch_type & ~ZEND_FETCH_CLASS_NO_AUTOLOAD;
check_fetch_type:
@@ -1456,26 +1461,17 @@
break;
}
- if (use_autoload) {
- if (zend_u_lookup_class(type, class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
+ if (zend_u_lookup_class_ex(type, class_name, class_name_len, use_autoload, &pce
TSRMLS_CC)==FAILURE) {
+ if (use_autoload) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_error(E_ERROR, "Interface '%R' not found", type, class_name);
} else {
zend_error(E_ERROR, "Class '%R' not found", type, class_name);
}
}
- return *pce;
+ return NULL;
} else {
- unsigned int lc_name_len;
- void *lc_name = zend_u_str_case_fold(type, class_name, class_name_len, 1, &lc_name_len);
-
- if (zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &pce) ==
SUCCESS) {
- efree(lc_name);
- return *pce;
- } else {
- efree(lc_name);
- return NULL;
- }
+ return *pce;
}
}
http://cvs.php.net/co.php/ZendEngine2/tests/is_a.phpt?r=1.1&p=1
Index: ZendEngine2/tests/is_a.phpt
+++ ZendEngine2/tests/is_a.phpt
--TEST--
is_a() and is_subclass_of() shouldn't call __autoload
--INI--
error_reporting=4095
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
class BASE {
}
interface INT {
}
class A extends BASE implements INT {
}
$a = new A;
var_dump(is_a($a, "B1"));
var_dump(is_a($a, "A"));
var_dump(is_a($a, "BASE"));
var_dump(is_a($a, "INT"));
var_dump(is_subclass_of($a, "B2"));
var_dump(is_subclass_of($a, "A"));
var_dump(is_subclass_of($a, "BASE"));
var_dump(is_subclass_of($a, "INT"));
?>
--EXPECTF--
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
bool(false)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
bool(true)
bool(false)
bool(false)
bool(true)
bool(false)