Re: com php-src: Add tests for constant expression arrays Adding one failing (!) test for now about circular constant references embedded in a
constant AST, must be fixed before PHP 5.6 release.: Zend/tests/constant_expressions_arrays.phpt
Zend/tests/constant_expressions_self_referencing_array.phpt

From: Date: Wed, 02 Jul 2014 15:09:06 +0000
Subject: Re: com php-src: Add tests for constant expression arrays Adding one failing (!) test for now about circular constant references embedded in a
constant AST, must be fixed before PHP 5.6 release.: Zend/tests/constant_expressions_arrays.phpt
Zend/tests/constant_expressions_self_referencing_array.phpt
References: 1 2 3  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79199@lists.php.net to get a copy of this message
On Wed, Jul 2, 2014 at 4:59 PM, Bob Weinand <bobwei9@hotmail.com> wrote: > Am 2.7.2014 um 16:55 schrieb Nikita Popov <nikita.ppv@gmail.com>: > > On Wed, Jul 2, 2014 at 12:33 PM, Bob Weinand <bwoebi@php.net> wrote: > > Commit: 09d1a8aaab15eef182dd71cf6aa506f54dc70ea7 > > Author: Bob Weinand <bobwei9@hotmail.com> Wed, 2 Jul 2014 > 12:31:50 +0200 > > Parents: 05cc46a96b44c4b0ead2909864c9b683103c5946 > > Branches: PHP-5.6 > > > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=09d1a8aaab15eef182dd71cf6aa506f54dc70ea7 > > > > Log: > > Add tests for constant expression arrays > > Adding one failing (!) test for now about circular constant references > embedded in a constant AST, must be fixed before PHP 5.6 release. > > > > Changed paths: > > A Zend/tests/constant_expressions_arrays.phpt > > A Zend/tests/constant_expressions_self_referencing_array.phpt > > > > > > Diff: > > diff --git a/Zend/tests/constant_expressions_arrays.phpt > b/Zend/tests/constant_expressions_arrays.phpt > > new file mode 100644 > > index 0000000..f1f0251 > > --- /dev/null > > +++ b/Zend/tests/constant_expressions_arrays.phpt > > @@ -0,0 +1,35 @@ > > +---TEST--- > > +Constant expressions with arrays > > +---FILE--- > > +<?php > > +const a = [1,2,[3,[4]]]; > > +const b = a[0]; > > +const c = a[2][0]; > > +const d = a[2]; > > +const e = ["string" => [1]]["string"][0]; > > + > > +var_dump(b, c, e); > > + > > +function test ($a = d[1][0]) { > > + var_dump($a); > > +} > > + > > +test(); > > + > > +class foo { > > + const bar = [1][0]; > > +} > > + > > +var_dump(foo::bar); > > + > > +var_dump(a); // Eventually allow that later with array dereferencing of > constants > > + > > +?> > > +---EXPECTF--- > > +int(1) > > +int(3) > > +int(1) > > +int(4) > > +int(1) > > + > > +Fatal error: Arrays are not allowed in constants at run-time in %s on > line %d > > diff --git a/Zend/tests/constant_expressions_self_referencing_array.phpt > b/Zend/tests/constant_expressions_self_referencing_array.phpt > > new file mode 100644 > > index 0000000..7fc477d > > --- /dev/null > > +++ b/Zend/tests/constant_expressions_self_referencing_array.phpt > > @@ -0,0 +1,13 @@ > > +---TEST--- > > +Self-referencing constant expression (part of a constant AST) > > +---FILE--- > > +<?php > > +class A { > > + const FOO = [self::BAR]; > > + const BAR = [self::FOO]; > > +} > > +var_dump(A::FOO); > > +?> > > +---EXPECTF--- > > +Fatal error: Cannot declare self-referencing constant 'self::FOO' in %s > on line %d > > + > > > > Could you please mark the failing test as XFAIL? > > > > Nikita > > I intentionally marked that as FAIL to be sure that it won't be overseen > upon PHP 5.6 release and remain unfixed. > Or why has it to be XFAIL? > > Bob the problem with that is that it will make it harder to spot when a new test failure is introduced. the current practice is to open a bugreport and add an XFAIL for to-be-fixed issues. if you want to make sure that we won't release 5.6.0 without fixing this, I can add it to the https://wiki.php.net/todo/php56 todo list. (Albeit I also keep an eye on open bugreports for 5.6.0, so probably we wouldn't miss it anyways) -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.cvs (#79199) next »