Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_API.c

[email protected] (Dmitry Stogov)
Newsgroups php.zend-engine.cvs
Message-ID <[email protected]>
Hi Marcus,

I don't understand what you were going to fix, but now you broke 
call_user_func("parent::foo") that starts emit fatal error. See 
ext/standard/tests/general_functions/bug40398.phpt.

Is it so hard for you to do "make test" before commit?

I mean you patch is wrong because it breaks "proper" code.

Your new test with call_user_func(array("A", "parent::foo")) introduces 
something new (I've never seen it before), that looks terrible. Why do 
we need support for such callbacks at all?

You also broke win32 build (this is not a real problem).

Thanks. Dmitry.

Marcus Boerger wrote:
> helly		Tue Feb  5 19:08:25 2008 UTC
> 
>   Modified files:              (Branch: PHP_5_3)
>     /ZendEngine2	zend_API.c 
>   Log:
>   - MFH Fix cross class tree reference issues with callbacks (colder,helly)
>   
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.25&r2=1.296.2.27.2.34.2.26&diff_format=u
> Index: ZendEngine2/zend_API.c
> diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.25 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.26
> --- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.25	Sat Feb  2 22:29:41 2008
> +++ ZendEngine2/zend_API.c	Tue Feb  5 19:08:24 2008
> @@ -18,7 +18,7 @@
>     +----------------------------------------------------------------------+
>  */
>  
> -/* $Id: zend_API.c,v 1.296.2.27.2.34.2.25 2008/02/02 22:29:41 tony2001 Exp $ */
> +/* $Id: zend_API.c,v 1.296.2.27.2.34.2.26 2008/02/05 19:08:24 helly Exp $ */
>  
>  #include "zend.h"
>  #include "zend_execute.h"
> @@ -2359,7 +2359,10 @@
>  
>  		/* This is a compound name.
>  		 * Try to fetch class and then find static method. */
> - 		*ce_ptr = zend_fetch_class(Z_STRVAL_P(callable), clen, ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
> +		zend_class_entry *last_scope = EG(scope);
> +		EG(scope) = ce_org;
> +		*ce_ptr = zend_fetch_class(Z_STRVAL_P(callable), clen, ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
> +		EG(scope) = last_scope;
>  		if (!*ce_ptr) {
>  			char *cname = estrndup(Z_STRVAL_P(callable), clen);
>  			if (error) zend_spprintf(error, 0, "class '%s' not found", cname);
> @@ -2375,7 +2378,7 @@
>  	} else if (ce_org) {
>  		/* Try to fetch find static method of given class. */
>  		mlen = Z_STRLEN_P(callable);
> - 		lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
> +		lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
>  		ftable = &ce_org->function_table;
>  		*ce_ptr = ce_org;
>  	} else {
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.