cvs: ZendEngine2 / zend_builtin_functions.c
| From: | Marcus Boerger | Date: | Sun, 27 Feb 2005 15:03:10 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3441@lists.php.net to get a copy of this message | ||
helly Sun Feb 27 10:03:10 2005 EDT
Modified files:
/ZendEngine2 zend_builtin_functions.c
Log:
- Update method_exists to new handlers and allow first parameter as string
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.256&r2=1.257&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.256 ZendEngine2/zend_builtin_functions.c:1.257
--- ZendEngine2/zend_builtin_functions.c:1.256 Tue Feb 1 14:05:56 2005
+++ ZendEngine2/zend_builtin_functions.c Sun Feb 27 10:03:09 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.256 2005/02/01 19:05:56 stas Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.257 2005/02/27 15:03:09 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -856,22 +856,24 @@
{
zval **klass, **method_name;
char *lcname;
+ zend_class_entry * ce, **pce;
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
- if ((*klass)->type != IS_OBJECT) {
- RETURN_FALSE;
- }
-
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(**klass)) {
+ if (Z_TYPE_PP(klass) == IS_OBJECT) {
+ ce = Z_OBJCE_PP(klass);
+ } else if (Z_TYPE_PP(klass) == IS_STRING) {
+ if (zend_lookup_class(Z_STRVAL_PP(klass), Z_STRLEN_PP(klass), &pce TSRMLS_CC) == FAILURE) {
+ RETURN_FALSE;
+ }
+ } else {
RETURN_FALSE;
}
convert_to_string_ex(method_name);
- lcname = zend_str_tolower_dup((*method_name)->value.str.val, (*method_name)->value.str.len);
- if (zend_hash_exists(&Z_OBJCE_PP(klass)->function_table, lcname,
(*method_name)->value.str.len+1)) {
+ lcname = zend_str_tolower_dup(Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name));
+ if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method_name)+1)) {
efree(lcname);
RETURN_TRUE;
} else {