summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2007-09-27 00:32:40 +0000
committerJohannes Schlüter <johannes@php.net>2007-09-27 00:32:40 +0000
commit9483a2ff2384b5a2fbec4eb5aa08db59dfcd5cbe (patch)
tree0074c0a44438872a64b6177e00e684fd792243f0
parent0e5d551a56dffa29ebfa241c8e144064f8922714 (diff)
downloadphp-git-9483a2ff2384b5a2fbec4eb5aa08db59dfcd5cbe.tar.gz
- Readd support for ynamic access of static members (Etienne)
-rw-r--r--NEWS75
-rw-r--r--Zend/zend_language_parser.y12
-rw-r--r--tests/lang/041.phpt20
-rw-r--r--tests/lang/042.phpt19
-rw-r--r--tests/lang/043.phpt19
-rw-r--r--tests/lang/044.phpt21
6 files changed, 94 insertions, 72 deletions
diff --git a/NEWS b/NEWS
index 98e62de309..1329b1360f 100644
--- 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)
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 017c96dc4e..244daae9e5 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -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
index 0000000000..6972412d5b
--- /dev/null
+++ b/tests/lang/041.phpt
@@ -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
index 0000000000..217aab83e3
--- /dev/null
+++ b/tests/lang/042.phpt
@@ -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
index 0000000000..7ca2d74b69
--- /dev/null
+++ b/tests/lang/043.phpt
@@ -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
index 0000000000..a0de889a7a
--- /dev/null
+++ b/tests/lang/044.phpt
@@ -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