cvs: ZendEngine2(PHP_5_3) / zend_API.c php-src NEWS php-src/ext/standard type.c php-src/ext/standard/tests/general_functions bug47857.phpt is_callable_basic2.phpt

[email protected] ("Dmitry Stogov") Thu, 02 Apr 2009 09:56:33 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1238666193@cvsserver>
dmitry		Thu Apr  2 09:56:33 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/standard/tests/general_functions	bug47857.phpt 

  Modified files:              
    /php-src	NEWS 
    /php-src/ext/standard	type.c 
    /php-src/ext/standard/tests/general_functions	
                                                 	is_callable_basic2.phpt 
    /ZendEngine2	zend_API.c 
  Log:
  Fixed bug #47851 (is_callable throws fatal error)
dmitry-20090402095633.txt (text/plain, 9.3 KB)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.549&r2=1.2027.2.547.2.965.2.550&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.549 php-src/NEWS:1.2027.2.547.2.965.2.550
--- php-src/NEWS:1.2027.2.547.2.965.2.549	Wed Apr  1 17:05:34 2009
+++ php-src/NEWS	Thu Apr  2 09:56:33 2009
@@ -5,6 +5,7 @@
 - Upgraded bundled sqlite to version 3.6.12. (Scott)
 
 - Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia)
+- Fixed bug #47851 (is_callable throws fatal error). (Dmitry)
 - Fixed bug #47819 (Getting pdo_mysql.so: undefined symbol: mysqlnd_debug_init
   at startup). (Johannes)
 - Fixed bug #47816 (pcntl tests failing on NetBSD). (Matteo)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.30.2.2.2.3.2.10&r2=1.30.2.2.2.3.2.11&diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.30.2.2.2.3.2.10 php-src/ext/standard/type.c:1.30.2.2.2.3.2.11
--- php-src/ext/standard/type.c:1.30.2.2.2.3.2.10	Wed Dec 31 11:15:46 2008
+++ php-src/ext/standard/type.c	Thu Apr  2 09:56:33 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: type.c,v 1.30.2.2.2.3.2.10 2008/12/31 11:15:46 sebastian Exp $ */
+/* $Id: type.c,v 1.30.2.2.2.3.2.11 2009/04/02 09:56:33 dmitry Exp $ */
 
 #include "php.h"
 #include "php_incomplete_class.h"
@@ -358,21 +358,29 @@
 {
 	zval *var, **callable_name = NULL;
 	char *name;
+	char *error;
 	zend_bool retval;
 	zend_bool syntax_only = 0;
+	int check_flags = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|bZ", &var,
 							  &syntax_only, &callable_name) == FAILURE) {
 		return;
 	}
-
-	syntax_only = syntax_only ? IS_CALLABLE_CHECK_SYNTAX_ONLY : 0;
+	
+	if (syntax_only) {
+		check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY;
+	}
 	if (ZEND_NUM_ARGS() > 2) {
-		retval = zend_is_callable(var, syntax_only, &name TSRMLS_CC);
+		retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, NULL, &error TSRMLS_CC);
 		zval_dtor(*callable_name);
 		ZVAL_STRING(*callable_name, name, 0);
 	} else {
-		retval = zend_is_callable(var, syntax_only, NULL TSRMLS_CC);
+		retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, NULL, &error TSRMLS_CC);
+	}
+	if (error) {
+		/* ignore errors */
+		efree(error);
 	}
 
 	RETURN_BOOL(retval);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt
diff -u php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt:1.1.4.2 php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt:1.1.4.3
--- php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt:1.1.4.2	Sun Jan 25 22:16:33 2009
+++ php-src/ext/standard/tests/general_functions/is_callable_basic2.phpt	Thu Apr  2 09:56:33 2009
@@ -210,17 +210,11 @@
 bool(false)
 object_class::func
 -- Innerloop iteration 10 of Outerloop iteration 1 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 2 ---
@@ -297,17 +291,11 @@
 bool(false)
 no_member_class::func
 -- Innerloop iteration 10 of Outerloop iteration 2 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 3 ---
@@ -384,17 +372,11 @@
 bool(true)
 contains_object_class::func
 -- Innerloop iteration 10 of Outerloop iteration 3 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 4 ---
@@ -471,17 +453,11 @@
 bool(true)
 contains_object_class::func
 -- Innerloop iteration 10 of Outerloop iteration 4 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 5 ---
@@ -558,17 +534,11 @@
 bool(false)
 object_class::func
 -- Innerloop iteration 10 of Outerloop iteration 5 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 6 ---
@@ -645,17 +615,11 @@
 bool(false)
 no_member_class::func
 -- Innerloop iteration 10 of Outerloop iteration 6 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 7 ---
@@ -732,17 +696,11 @@
 bool(false)
 object_class::func
 -- Innerloop iteration 10 of Outerloop iteration 7 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 --- Outerloop iteration 8 ---
@@ -819,17 +777,11 @@
 bool(false)
 Array
 -- Innerloop iteration 10 of Outerloop iteration 8 --
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 bool(true)
 object_class::foo1
-
-Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d
 bool(true)
 object_class::foo1
 ===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.61&r2=1.296.2.27.2.34.2.62&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.61 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.62
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.61	Tue Mar 24 16:35:53 2009
+++ ZendEngine2/zend_API.c	Thu Apr  2 09:56:33 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.61 2009/03/24 16:35:53 dmitry Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.62 2009/04/02 09:56:33 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_execute.h"
@@ -2540,12 +2540,18 @@
 					fcc->object_ptr = EG(This);
 					if (error) {
 						zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
+						if (severity == E_ERROR) {
+							retval = 0;
+						}
 					} else if (retval) {
 						zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
 					}
 				} else {
 					if (error) {
 						zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb);
+						if (severity == E_ERROR) {
+							retval = 0;
+						}
 					} else if (retval) {
 						zend_error(severity, "Non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb);
 					}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug47857.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/bug47857.phpt
+++ php-src/ext/standard/tests/general_functions/bug47857.phpt