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

[email protected] ("Steph Fox")
Newsgroups php.internals,php.zend-engine.cvs
Organization Zend Technologies
Message-ID <006801c86b2a$c8665fd0$c6fc1f3e@foxbox>
Hi Marcus,

It's not a real problem to break the win32 build because it's a very simple 
fix, but it'd still be kinda nice if the PHP_5_3 checkout would just build 
without manual assistance. Snaps would work an' everything.

Please fix last_scope declaration, mini-patch attached.

- Steph

----- Original Message ----- 
From: "Dmitry Stogov" <[email protected]>
To: "Marcus Boerger" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, February 06, 2008 10:13 AM
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_API.c


> 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 {
>>
>
> -- 
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
last_scope.txt (text/plain, 778 B)
Index: Zend/zend_API.c
===================================================================
RCS file: /repository/ZendEngine2/zend_API.c,v
retrieving revision 1.296.2.27.2.34.2.28
diff -u -r1.296.2.27.2.34.2.28 zend_API.c
--- Zend/zend_API.c	7 Feb 2008 18:42:01 -0000	1.296.2.27.2.34.2.28
+++ Zend/zend_API.c	9 Feb 2008 14:34:27 -0000
@@ -2347,6 +2347,8 @@
 		colon > Z_STRVAL_P(callable) &&
 		*(colon-1) == ':'
 	) {
+		zend_class_entry *last_scope;
+
 		colon--;
 		clen = colon - Z_STRVAL_P(callable);
 		mlen = Z_STRLEN_P(callable) - clen - 2;
@@ -2359,7 +2361,7 @@
 
 		/* This is a compound name.
 		 * Try to fetch class and then find static method. */
-		zend_class_entry *last_scope = EG(scope);
+		last_scope = EG(scope);
 		if (ce_org) {
 			EG(scope) = ce_org;
 		}
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.