RE: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /tests/lang 041.phpt 042.phpt 043.phpt 044.phpt ZendEngine2 zend_language_parser.y
| From: | Dmitry Stogov | Date: | Mon, 06 Aug 2007 17:21:56 +0000 |
| Subject: | RE: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /tests/lang 041.phpt 042.phpt 043.phpt 044.phpt ZendEngine2 zend_language_parser.y | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-45743@lists.php.net to get a copy of this message | ||
Hi,
I think this feature shouldn't go into 5.2, especially after 5.2.4RC1
release.
May be into 5.3
Thanks. Dmitry.
> -----Original Message-----
> From: Johannes Schlьter [mailto:johannes@php.net]
> Sent: Friday, August 03, 2007 1:55 AM
> To: php-cvs@lists.php.net
> Subject: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /tests/lang
> 041.phpt 042.phpt 043.phpt 044.phpt ZendEngine2
> zend_language_parser.y
>
>
> johannes Thu Aug 2 21:55:23 2007 UTC
>
> Added files: (Branch: PHP_5_2)
> /php-src/tests/lang 041.phpt 042.phpt 043.phpt 044.phpt
>
> Modified files:
> /php-src NEWS
> /ZendEngine2 zend_language_parser.y
> Log:
> - Add possibility to call static class members using
> variables (Etienne Kneuss)
>
> http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.8
> 73&r2=1.2027.2.547.2.874&diff_format=u
> Index: php-src/NEWS
> diff -u php-src/NEWS:1.2027.2.547.2.873
> php-src/NEWS:1.2027.2.547.2.874
> --- php-src/NEWS:1.2027.2.547.2.873 Thu Aug 2 20:30:31 2007
> +++ php-src/NEWS Thu Aug 2 21:55:23 2007
> @@ -37,6 +37,8 @@
> - Added PCRE_VERSION constant. (Tony)
> - Added ReflectionExtension::info() function to print the
> phpinfo() block for
> an extension. (Johannes)
> +- Added possibility to call static class members using variables.
> +(Etienne
> + Kneuss)
>
> - Implemented FR #41884
> (ReflectionClass::getDefaultProperties() does not handle
> static attributes). (Tony)
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_parser
> .y?r1=1.160.2.4.2.6&r2=1.160.2.4.2.7&diff_format=u
> Index: ZendEngine2/zend_language_parser.y
> diff -u ZendEngine2/zend_language_parser.y:1.160.2.4.2.6
> ZendEngine2/zend_language_parser.y:1.160.2.4.2.7
> --- ZendEngine2/zend_language_parser.y:1.160.2.4.2.6 Fri May
> 18 18:36:04 2007
> +++ ZendEngine2/zend_language_parser.y Thu Aug 2 21:55:23 2007
> @@ -18,7 +18,7 @@
>
> +-------------------------------------------------------------
> ---------+
> */
>
> -/* $Id: zend_language_parser.y,v 1.160.2.4.2.6 2007/05/18
> 18:36:04 stas Exp $ */
> +/* $Id: zend_language_parser.y,v 1.160.2.4.2.7 2007/08/02 21:55:23
> +johannes Exp $ */
>
> /*
> * LALR shift/reduce conflicts and how they are resolved:
> @@ -630,6 +630,12 @@
> | 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 @@
>
> 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 @@
>
> 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); }
> ;
>
> %%
>
> http://cvs.php.net/viewvc.cgi/php-src/tests/lang/041.phpt?view
> =markup&rev=1.1
> Index: php-src/tests/lang/041.phpt
> +++ php-src/tests/lang/041.phpt
> --TEST--
> Dynamic access of static members
> --FILE--
> <?php
> class A {
> public static $b = 'foo';
> }
>
> $classname = 'A';
> $binaryClassname = b'A';
> $wrongClassname = 'B';
>
> echo $classname::$b."\n";
> echo $binaryClassname::$b."\n";
> echo $wrongClassname::$b."\n";
>
> ?>
> ===DONE===
> --EXPECTF--
> foo
> foo
>
> Fatal error: Class 'B' not found in %s041.php on line %d
>
> http://cvs.php.net/viewvc.cgi/php-src/tests/lang/042.phpt?view
> =markup&rev=1.1
> Index: php-src/tests/lang/042.phpt
> +++ php-src/tests/lang/042.phpt
> --TEST--
> Dynamic access of constants
> --FILE--
> <?php
> class A {
> const B = 'foo';
> }
>
> $classname = 'A';
> $binaryClassname = b'A';
> $wrongClassname = 'B';
>
> echo $classname::B."\n";
> echo $binaryClassname::B."\n";
> echo $wrongClassname::B."\n";
> ?>
> ===DONE===
> --EXPECTF--
> foo
> foo
>
> Fatal error: Class 'B' not found in %s042.php on line %d
>
> http://cvs.php.net/viewvc.cgi/php-src/tests/lang/043.phpt?view
> =markup&rev=1.1
> Index: php-src/tests/lang/043.phpt
> +++ php-src/tests/lang/043.phpt
> --TEST--
> Dynamic call for static methods
> --FILE--
> <?php
> class A {
> static function foo() { return 'foo'; }
> }
>
> $classname = 'A';
> $binaryClassname = b'A';
> $wrongClassname = 'B';
>
> echo $classname::foo()."\n";
> echo $binaryClassname::foo()."\n";
> echo $wrongClassname::foo()."\n";
> ?>
> ===DONE===
> --EXPECTF--
> foo
> foo
>
> Fatal error: Class 'B' not found in %s043.php on line %d
>
> http://cvs.php.net/viewvc.cgi/php-src/tests/lang/044.phpt?view
=markup&rev=1.1
Index: php-src/tests/lang/044.phpt
+++ php-src/tests/lang/044.phpt
--TEST--
Dynamic call for static methods dynamically named
--FILE--
<?php
class A {
static function foo() { return 'foo'; }
}
$classname = 'A';
$binaryClassname = b'A';
$wrongClassname = 'B';
$methodname = 'foo';
$binaryMethodname = b'foo';
echo $classname::$methodname()."\n";
echo $classname::$binaryMethodname()."\n";
echo $binaryClassname::$methodname()."\n";
echo $binaryClassname::$binaryMethodname()."\n";
echo $wrongClassname::$binaryMethodname()."\n";
?>
===DONE===
--EXPECTF--
foo
foo
foo
foo
Fatal error: Class 'B' not found in %s044.php on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php