]> granicus.if.org Git - php/commitdiff
- Readd support for ynamic access of static members (Etienne)
authorJohannes Schlüter <johannes@php.net>
Thu, 27 Sep 2007 00:32:40 +0000 (00:32 +0000)
committerJohannes Schlüter <johannes@php.net>
Thu, 27 Sep 2007 00:32:40 +0000 (00:32 +0000)
NEWS
Zend/zend_language_parser.y
tests/lang/041.phpt [new file with mode: 0644]
tests/lang/042.phpt [new file with mode: 0644]
tests/lang/043.phpt [new file with mode: 0644]
tests/lang/044.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 98e62de309ce46181894cb2fa5daf993f9fac2f1..1329b1360f389ccc99d59a74dfcb076faea3238c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,77 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-?? ??? 20??, PHP 5.2.5
-- Upgraded PCRE to version 7.3 (Nuno)
-- Added optional parameter $provide_object to debug_backtrace(). (Sebastian)
-- Added alpha support for imagefilter() IMG_FILTER_COLORIZE. (Pierre)
-
-- Improved speed of array_intersect_key(), array_intersect_assoc(),
-  array_uintersect_assoc(), array_diff_key(), array_diff_assoc() and
-  array_udiff_assoc(). (Dmitry)
-
-- Fixed regression in glob() when enforcing safe_mode/open_basedir checks on
-  paths containing '*'. (Ilia)
-- Fixed "mail.force_extra_parameters" php.ini directive not to be modifiable
-  in .htaccess due to the security implications - reported by SecurityReason.
-  (Stas)
-- Fixed PDO crash when driver returns empty LOB stream. (Stas)
-- Fixed dl() to only accept filenames - reported by Laurent Gaffie. (Stas)
-- Fixed dl() to limit argument size to MAXPATHLEN (CVE-2007-4887).
-  (Christian Hoffmann)
-- Fixed iconv_*() functions to limit argument sizes as workaround to libc 
-  bug (CVE-2007-4783, CVE-2007-4840). (Christian Hoffmann, Stas)
-- Fixed missing brackets leading to build warning and error in the log.
-  Win32 code). (Andrey)
-- Fixed leaks with multiple connects on one mysqli object. (Andrey)
-- Fixed endianness detection on MacOS when building universal binary. 
-  (Uwe Schindler, Christian Speich, Tony)
-- Fixed possible triggering of buffer overflows inside glibc
-  implementations of the fnmatch(), setlocale() and glob() functions. 
-  Reported by Laurent gaffie. (Ilia)
-- Fixed imagerectangle regression with 1x1 rectangle (libgd #106). (Pierre)
-
-- Fixed bug #42767 (highlight_string() truncates trailing comment). (Ilia)
-- Fixed bug #42739 (mkdir() doesn't like a trailing slash when safe_mode is 
-  enabled). (Ilia)
-- Fixed bug #42699 (PHP_SELF duplicates path). (Dmitry)
-- Fixed bug #42643 (CLI segfaults if using ATTR_PERSISTENT). (Ilia)
-- Fixed bug #42629 (Dynamically loaded PHP extensions need symbols exported
-  on MacOSX). (jdolecek at NetBSD dot org)
-- Fixed bug #42627 (bz2 extension fails to build with -fno-common).
-  (dolecek at netbsd dot org)
-- Fixed Bug #42596 (session.save_path MODE option does not work). (Ilia)
-- Fixed bug #42590 (Make the engine recognize \v and \f escape sequences). 
-  (Ilia)
-- Fixed bug #42587 (behavior change regarding symlinked .php files). (Dmitry)
-- Fixed bug #42579 (apache_reset_timeout() does not exist). (Jani)
-- Fixed bug #42549 (ext/mysql failed to compile with libmysql 3.23). (Scott)
-- Fixed bug #42523 (PHP_SELF duplicates path). (Dmitry)
-- Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 on
-  64-bit PHP). (Derick)
-- Fixed bug #42506 (php_pgsql_convert() timezone parse bug) (nonunnet at
-  gmail dot com, Ilia)
-- Fixed bug #42462 (Segmentation when trying to set an attribute in a 
-  DOMElement). (Rob)
-- Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline
-  options). (Dmitry)
-- Fixed bug #42452 (PDO classes do not expose Reflection API information).
-  (Hannes)
-- Fixed bug #42468 (Write lock on file_get_contents fails when using a 
-  compression stream). (Ilia)
-- Fixed bug #42488 (SoapServer reports an encoding error and the error itself
-  breaks). (Dmitry)
-- Fixed bug #42378 (mysqli_stmt_bind_result memory exhaustion). (Andrey)
-- Fixed bug #42359 (xsd:list type not parsed). (Dmitry)
-- Fixed bug #42326 (SoapServer crash). (Dmitry)
-- Fixed bug #42214 (SoapServer sends clients internal PHP errors). (Dmitry)
-- Fixed bug #42189 (xmlrpc_set_type() crashes php on invalid datetime
-  values). (Ilia)
-- Fixed bug #42139 (XMLReader option constants are broken using XML()). (Rob)
-- Fixed bug #42086 (SoapServer return Procedure '' not present for WSIBasic
-  compliant wsdl). (Dmitry)
-- Fixed bug #41561 (Values set with php_admin_* in httpd.conf can be overwritten
-  with ini_set()). (Stas, Jani)
-- Fixed bug #39651 (proc_open() append mode doesn't work on windows). (Nuno)
+?? ??? 20??, PHP 5.3.0
+- Added support for dynamic access of static members using $foo::myFunc().
+  (Etienne Kneuss)
 
 30 Aug 2007, PHP 5.2.4
 - Removed --enable-versioning configure option. (Jani)
index 017c96dc4e6b5789d9edbb8a53ffd5fcba75eea3..244daae9e5f9b866279d82d38e5168c04d21a4e1 100644 (file)
@@ -630,6 +630,12 @@ function_call:
        |       fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
                        function_call_parameter_list
                        ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+       |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+                       function_call_parameter_list
+                       ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+       |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+                       function_call_parameter_list
+                       ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
        |       variable_without_objects  '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
                        function_call_parameter_list ')'
                        { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
@@ -781,8 +787,13 @@ variable_without_objects:
 
 static_member:
                fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
+       |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
+
 ;
 
+variable_class_name:
+               reference_variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
+;
 
 base_variable_with_function_calls:
                base_variable           { $$ = $1; }
@@ -907,6 +918,7 @@ isset_variables:
 
 class_constant:
                fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); }
+       |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); }
 ;
 
 %%
diff --git a/tests/lang/041.phpt b/tests/lang/041.phpt
new file mode 100644 (file)
index 0000000..6972412
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Dynamic access of static members
+--FILE--
+<?php
+class A {
+    public    static $b = 'foo';
+}
+
+$classname       =  'A';
+$wrongClassname  =  'B';
+
+echo $classname::$b."\n";
+echo $wrongClassname::$b."\n";
+
+?>
+===DONE===
+--EXPECTF--
+foo
+
+Fatal error: Class 'B' not found in %s041.php on line %d
diff --git a/tests/lang/042.phpt b/tests/lang/042.phpt
new file mode 100644 (file)
index 0000000..217aab8
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Dynamic access of constants
+--FILE--
+<?php
+class A {
+    const B = 'foo';
+}
+
+$classname       =  'A';
+$wrongClassname  =  'B';
+
+echo $classname::B."\n";
+echo $wrongClassname::B."\n";
+?>
+===DONE===
+--EXPECTF--
+foo
+
+Fatal error: Class 'B' not found in %s042.php on line %d
diff --git a/tests/lang/043.phpt b/tests/lang/043.phpt
new file mode 100644 (file)
index 0000000..7ca2d74
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Dynamic call for static methods
+--FILE--
+<?php
+class A {
+    static function foo() { return 'foo'; }
+}
+
+$classname       =  'A';
+$wrongClassname  =  'B';
+
+echo $classname::foo()."\n";
+echo $wrongClassname::foo()."\n";
+?>
+===DONE===
+--EXPECTF--
+foo
+
+Fatal error: Class 'B' not found in %s043.php on line %d
diff --git a/tests/lang/044.phpt b/tests/lang/044.phpt
new file mode 100644 (file)
index 0000000..a0de889
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Dynamic call for static methods dynamically named
+--FILE--
+<?php
+class A {
+    static function foo() { return 'foo'; }
+}
+$classname        =  'A';
+$wrongClassname   =  'B';
+
+$methodname       =  'foo';
+
+echo $classname::$methodname()."\n";
+
+echo $wrongClassname::$methodname()."\n";
+?>
+===DONE===
+--EXPECTF--
+foo
+
+Fatal error: Class 'B' not found in %s044.php on line %d