mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed bug #32429 (method_exists() always return TRUE if __call method exists)
This commit is contained in:
parent
6e0da82528
commit
4f15b20b92
2
NEWS
2
NEWS
@ -109,6 +109,8 @@ PHP NEWS
|
||||
- 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)
|
||||
|
28
Zend/tests/bug32429.phpt
Normal file
28
Zend/tests/bug32429.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--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)
|
@ -880,11 +880,20 @@ ZEND_FUNCTION(method_exists)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user