cvs: ZendEngine2 / zend_builtin_functions.c /tests bug32429.phpt php-src NEWS
| From: | Dmitry Stogov | Date: | Tue, 26 Apr 2005 08:47:33 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c /tests bug32429.phpt php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3588@lists.php.net to get a copy of this message | ||
dmitry Tue Apr 26 04:47:33 2005 EDT
Added files:
/ZendEngine2/tests bug32429.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_builtin_functions.c
Log:
Fixed bug #32429 (method_exists() always return TRUE if __call method exists)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1881&r2=1.1882&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1881 php-src/NEWS:1.1882
--- php-src/NEWS:1.1881 Mon Apr 25 17:23:49 2005
+++ php-src/NEWS Tue Apr 26 04:47:27 2005
@@ -109,6 +109,8 @@
- Fixed ZTS destruction. (Marcus)
- Fixed bug #32491 (File upload error - unable to create a temporary file).
(Uwe Schindler)
+- Fixed bug #32429 (method_exists() always return TRUE if __call method
+ exists). (Dmitry)
- Fixed bug #32109 ($_POST is not populated in multithreaded environment).
(Moriyoshi)
- Fixed bug #31478 (segfault with empty() / isset()). (Moriyoshi)
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.267&r2=1.268&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.267 ZendEngine2/zend_builtin_functions.c:1.268
--- ZendEngine2/zend_builtin_functions.c:1.267 Mon Apr 18 03:25:20 2005
+++ ZendEngine2/zend_builtin_functions.c Tue Apr 26 04:47:31 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.267 2005/04/18 07:25:20 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.268 2005/04/26 08:47:31 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -880,11 +880,20 @@
efree(lcname);
RETURN_TRUE;
} else {
+ union _zend_function *func = NULL;
efree(lcname);
+
if (Z_TYPE_PP(klass) == IS_OBJECT
&& Z_OBJ_HT_PP(klass)->get_method != NULL
- && Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name),
Z_STRLEN_PP(method_name) TSRMLS_CC) != NULL
+ && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name),
Z_STRLEN_PP(method_name) TSRMLS_CC)) != NULL
) {
+ if (func->type == ZEND_INTERNAL_FUNCTION
+ && ((zend_internal_function*)func)->handler == zend_std_call_user_call
+ ) {
+ efree(((zend_internal_function*)func)->function_name);
+ efree(func);
+ RETURN_FALSE;
+ }
RETURN_TRUE;
}
}
http://cvs.php.net/co.php/ZendEngine2/tests/bug32429.phpt?r=1.1&p=1
Index: ZendEngine2/tests/bug32429.phpt
+++ ZendEngine2/tests/bug32429.phpt
--TEST--
Bug #32429 (method_exists() always return TRUE if __call method exists)
--FILE--
<?php
class TestClass {
public function __construct() {
var_dump(method_exists($this, 'test'));
if (method_exists($this, 'test')) {
$this->test();
}
}
public function __call($name, $args) {
throw new Exception('Call to undefined
method'.get_class($this).'::'.$name.'()');
}
}
try {
$test = new TestClass;
} catch (Exception $e) {
exit($e->getMessage());
}
?>
--EXPEXT--
bool(false)