felipe Tue, 02 Mar 2010 00:16:40 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295706
Log:
- Fixed bug #51176 (Static calling in non-static method behaves like $this->)
Bug: http://bugs.php.net/51176 (error getting bug information)
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/Zend/tests/bug45180.phpt
U php/php-src/branches/PHP_5_3/Zend/tests/bug45186.phpt
A php/php-src/branches/PHP_5_3/Zend/tests/bug51176.phpt
U php/php-src/branches/PHP_5_3/Zend/tests/call_static_003.phpt
U php/php-src/branches/PHP_5_3/Zend/tests/call_static_007.phpt
U php/php-src/branches/PHP_5_3/Zend/zend_object_handlers.c
U php/php-src/trunk/Zend/tests/bug45180.phpt
U php/php-src/trunk/Zend/tests/bug45186.phpt
A php/php-src/trunk/Zend/tests/bug51176.phpt
U php/php-src/trunk/Zend/tests/call_static_003.phpt
U php/php-src/trunk/Zend/tests/call_static_007.phpt
U php/php-src/trunk/Zend/zend_object_handlers.c
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-03-02 00:16:40 UTC (rev 295706)
@@ -69,7 +69,9 @@
- Fixed memory leak in the realpath cache on Windows. (Pierre)
- Fixed memory leak in zip_close. (Pierre)
-- Fixed #51059 (crypt crashes when invalid salt are given). (Pierre)
+- Fixed bug #51176 (Static calling in non-static method behaves like $this->).
+ (Felipe)
+- Fixed bug #51059 (crypt crashes when invalid salt are given). (Pierre)
- Fixed bug #50952 (allow underscore _ in constants parsed in php.ini files).
(Jani)
- Fixed bug #50940 (Custom content-length set incorrectly in Apache SAPIs).
Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug45180.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug45180.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug45180.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -43,11 +43,11 @@
string(3) "ABC"
__call:
string(3) "ABC"
-__call:
+__callstatic:
string(3) "XYZ"
-__call:
+__callstatic:
string(3) "WWW"
-__call:
+__callstatic:
string(3) "ABC"
__callstatic:
string(1) "A"
Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug45186.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug45186.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug45186.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -35,17 +35,17 @@
?>
--EXPECTF--
-__call:
+__callstatic:
string(3) "ABC"
-__call:
+__callstatic:
string(3) "ABC"
__call:
string(3) "xyz"
-__call:
+__callstatic:
string(3) "www"
__call:
string(1) "y"
-__call:
+__callstatic:
string(1) "y"
ok
__callstatic:
Added: php/php-src/branches/PHP_5_3/Zend/tests/bug51176.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug51176.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug51176.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -0,0 +1,32 @@
+--TEST--
+Bug #51176 (Static calling in non-static method behaves like $this->)
+--FILE--
+<?php
+class Foo
+{
+ public function start()
+ {
+ self::bar();
+ static::bar();
+ Foo::bar();
+ }
+
+ public function __call($n, $a)
+ {
+ echo "instance\n";
+ }
+
+ public static function __callStatic($n, $a)
+ {
+ echo "static\n";
+ }
+}
+
+$foo = new Foo();
+$foo->start();
+
+?>
+--EXPECT--
+static
+static
+static
Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug51176.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_3/Zend/tests/call_static_003.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/call_static_003.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/Zend/tests/call_static_003.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -28,9 +28,9 @@
--EXPECT--
nonstatic
string(6) "fOoBaR"
-nonstatic
+static
string(6) "foOBAr"
-nonstatic
+static
string(6) "fOOBAr"
static
string(3) "bAr"
Modified: php/php-src/branches/PHP_5_3/Zend/tests/call_static_007.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/call_static_007.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/Zend/tests/call_static_007.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -30,5 +30,5 @@
--EXPECT--
__callstatic: Test
__call: Test
-__call: Bar
+__callstatic: Bar
__callstatic: Foo
Modified: php/php-src/branches/PHP_5_3/Zend/zend_object_handlers.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_object_handlers.c 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/branches/PHP_5_3/Zend/zend_object_handlers.c 2010-03-02 00:16:40 UTC (rev 295706)
@@ -953,13 +953,13 @@
if (!fbc && zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) {
efree(lc_function_name);
- if (ce->__call &&
+ if (ce->__callstatic) {
+ return zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
+ } else if (ce->__call &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
return zend_get_user_call_function(ce, function_name_strval, function_name_strlen);
- } else if (ce->__callstatic) {
- return zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
} else {
return NULL;
}
Modified: php/php-src/trunk/Zend/tests/bug45180.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug45180.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/trunk/Zend/tests/bug45180.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -43,11 +43,11 @@
unicode(3) "ABC"
__call:
unicode(3) "ABC"
-__call:
+__callstatic:
unicode(3) "XYZ"
-__call:
+__callstatic:
unicode(3) "WWW"
-__call:
+__callstatic:
unicode(3) "ABC"
__callstatic:
unicode(1) "A"
Modified: php/php-src/trunk/Zend/tests/bug45186.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug45186.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/trunk/Zend/tests/bug45186.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -35,17 +35,17 @@
?>
--EXPECTF--
-__call:
+__callstatic:
unicode(3) "ABC"
-__call:
+__callstatic:
unicode(3) "ABC"
__call:
unicode(3) "xyz"
-__call:
+__callstatic:
unicode(3) "www"
__call:
unicode(1) "y"
-__call:
+__callstatic:
unicode(1) "y"
ok
__callstatic:
Added: php/php-src/trunk/Zend/tests/bug51176.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug51176.phpt (rev 0)
+++ php/php-src/trunk/Zend/tests/bug51176.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -0,0 +1,32 @@
+--TEST--
+Bug #51176 (Static calling in non-static method behaves like $this->)
+--FILE--
+<?php
+class Foo
+{
+ public function start()
+ {
+ self::bar();
+ static::bar();
+ Foo::bar();
+ }
+
+ public function __call($n, $a)
+ {
+ echo "instance\n";
+ }
+
+ public static function __callStatic($n, $a)
+ {
+ echo "static\n";
+ }
+}
+
+$foo = new Foo();
+$foo->start();
+
+?>
+--EXPECT--
+static
+static
+static
Property changes on: php/php-src/trunk/Zend/tests/bug51176.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/trunk/Zend/tests/call_static_003.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/call_static_003.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/trunk/Zend/tests/call_static_003.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -28,9 +28,9 @@
--EXPECT--
nonstatic
unicode(6) "fOoBaR"
-nonstatic
+static
unicode(6) "foOBAr"
-nonstatic
+static
unicode(6) "fOOBAr"
static
unicode(3) "bAr"
Modified: php/php-src/trunk/Zend/tests/call_static_007.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/call_static_007.phpt 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/trunk/Zend/tests/call_static_007.phpt 2010-03-02 00:16:40 UTC (rev 295706)
@@ -30,5 +30,5 @@
--EXPECT--
__callstatic: Test
__call: Test
-__call: Bar
+__callstatic: Bar
__callstatic: Foo
Modified: php/php-src/trunk/Zend/zend_object_handlers.c
===================================================================
--- php/php-src/trunk/Zend/zend_object_handlers.c 2010-03-01 23:49:01 UTC (rev 295705)
+++ php/php-src/trunk/Zend/zend_object_handlers.c 2010-03-02 00:16:40 UTC (rev 295706)
@@ -962,13 +962,13 @@
if (!fbc && zend_u_hash_find(&ce->function_table, type, lc_function_name, function_name_strlen + 1, (void **) &fbc)==FAILURE) {
efree(lc_function_name.v);
- if (ce->__call &&
+ if (ce->__callstatic) {
+ return zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
+ } else if (ce->__call &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
return zend_get_user_call_function(ce, function_name_strval, function_name_strlen);
- } else if (ce->__callstatic) {
- return zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
} else {
return NULL;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php