|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, 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.
--- /dev/null
+--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)
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) {
}
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);
}
-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;
/* 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;
}
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);
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:
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;
}
}