From: Felipe Pena Date: Thu, 8 May 2008 16:58:43 +0000 (+0000) Subject: - Fixed detection of invalid class name X-Git-Tag: RELEASE_2_0_0b1~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=496099274b26ff9dff1867cd64949063c18bff18;p=php - Fixed detection of invalid class name --- diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt index 5b2644b58e..c4680a4789 100644 --- a/Zend/tests/bug31720.phpt +++ b/Zend/tests/bug31720.phpt @@ -10,5 +10,5 @@ array_walk($array, array($nonesuchvar,'show')); --EXPECTF-- Notice: Undefined variable: nonesuchvar in %s on line %d -Warning: array_walk() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d ===DONE=== diff --git a/Zend/zend_API.c b/Zend/zend_API.c index efedc85f5d..8b6e961d13 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3035,7 +3035,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *c } } else { if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) { - if (!obj) { + if (!obj || (Z_TYPE_PP(obj) != IS_OBJECT && Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_UNICODE)) { if (error) zend_spprintf(error, 0, "first array member is not a valid class name or object"); } else { if (error) zend_spprintf(error, 0, "second array member is not a valid method"); diff --git a/ext/standard/tests/array/array_filter_variation2.phpt b/ext/standard/tests/array/array_filter_variation2.phpt index 50041ed584..bf92132dd4 100644 --- a/ext/standard/tests/array/array_filter_variation2.phpt +++ b/ext/standard/tests/array/array_filter_variation2.phpt @@ -134,7 +134,7 @@ NULL Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d NULL -- Iteration 13 -- -Warning: array_filter() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d @@ -221,7 +221,7 @@ NULL Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d NULL -- Iteration 13 -- -Warning: array_filter() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt index 305c1e9563..526f8b915e 100644 --- a/ext/standard/tests/array/array_map_variation17.phpt +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -141,11 +141,11 @@ Warning: array_map() expects parameter 1 to be a valid callback, array must have NULL -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 19 -- @@ -224,11 +224,11 @@ Warning: array_map() expects parameter 1 to be a valid callback, array must have NULL -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 19 -- diff --git a/ext/standard/tests/array/array_walk_recursive_variation2.phpt b/ext/standard/tests/array/array_walk_recursive_variation2.phpt index f82e7a687b..6981365d26 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation2.phpt @@ -179,10 +179,10 @@ Warning: array_walk_recursive() expects parameter 2 to be a valid callback, arra NULL -- Iteration 13 -- -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- @@ -357,10 +357,10 @@ Warning: array_walk_recursive() expects parameter 2 to be a valid callback, arra NULL -- Iteration 13 -- -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- diff --git a/ext/standard/tests/array/array_walk_variation2.phpt b/ext/standard/tests/array/array_walk_variation2.phpt index 633aa768f0..a3c70653f6 100644 --- a/ext/standard/tests/array/array_walk_variation2.phpt +++ b/ext/standard/tests/array/array_walk_variation2.phpt @@ -179,10 +179,10 @@ Warning: array_walk() expects parameter 2 to be a valid callback, array must hav NULL -- Iteration 13 -- -Warning: array_walk() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -Warning: array_walk() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- @@ -357,10 +357,10 @@ Warning: array_walk() expects parameter 2 to be a valid callback, array must hav NULL -- Iteration 13 -- -Warning: array_walk() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -Warning: array_walk() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- diff --git a/ext/standard/tests/array/uasort_variation2.phpt b/ext/standard/tests/array/uasort_variation2.phpt index 79f9d9fd87..97cf8144d8 100644 --- a/ext/standard/tests/array/uasort_variation2.phpt +++ b/ext/standard/tests/array/uasort_variation2.phpt @@ -148,11 +148,11 @@ Warning: uasort() expects parameter 2 to be a valid callback, array must have ex NULL -- Iteration 13 -- -Warning: uasort() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- -Warning: uasort() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 15 -- @@ -263,11 +263,11 @@ Warning: uasort() expects parameter 2 to be a valid callback, array must have ex NULL -- Iteration 13 -- -Warning: uasort() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 14 -- -Warning: uasort() expects parameter 2 to be a valid callback, second array member is not a valid method in %s on line %d +Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d NULL -- Iteration 15 --