com php-langspec: Fix constant uses in basic.phpt: tests/functions/basics.phpt

[email protected] (Nikita Popov) Mon, 08 Apr 2019 06:59:24 +0000
Newsgroups php.standards.cvs
Message-ID <[email protected]>
Commit:    dc2e8d9593bd6b5826d10afcfbb86140733d4b13=0AAuthor:    Nikita Pop=
ov <[email protected]>         Mon, 8 Apr 2019 08:59:24 +0200=0AParents:=
   fe55bee01293a925120cfe330b62a94fc5140e35=0ABranches:  master=0A=0ALink: =
      http://git.php.net/?p=3Dphp-langspec.git;a=3Dcommitdiff;h=3Ddc2e8d959=
3bd6b5826d10afcfbb86140733d4b13=0A=0ALog:=0AFix constant uses in basic.phpt=
=0A=0AThese are no longer legal in PHP 8. This is supposed to be testing=0A=
dynamic function calls, for which we should be using the string and=0Anot r=
ely on the bareword fallback.=0A=0AChanged paths:=0A  M  tests/functions/ba=
sics.phpt=0A=0A=0ADiff:=0Adiff --git a/tests/functions/basics.phpt b/tests/=
functions/basics.phpt=0Aindex f8e1bec..2a3bc2c 100644=0A--- a/tests/functio=
ns/basics.phpt=0A+++ b/tests/functions/basics.phpt=0A@@ -30,11 +30,9 @@ fun=
ction f1()=0A }=0A =0A var_dump(f1());=09// call f1, default return value i=
s NULL=0A-f1;=09=09=09=09// valid, but vacuous, as it has no side effect an=
d its value is not used=0A-var_dump(f1);=09// string with value "f1"=0A-$f =
=3D f1;=09=09// assign this string to a variable=0A+$f =3D "f1";=09=09// as=
sign the name of the function to a variable=0A $f();=09=09=09// call f1 ind=
irectly via $f=0A-//"f1"();=09=09=09// call f1 via the string "f1" -- Can't=
 be a string literal!!!=0A+"f1"();=09=09=09// call f1 via the string "f1"=
=0A =0A // f1() =3D 123;=09// a function return is not an lvalue=0A =0A@@ -=
74,20 +72,14 @@ f2(10, 20, 30);=09// pass 3 (> 2)=0A =0A function square($v=
) { return $v * $v; }=0A echo "5 squared =3D ".square(5)."\n";=0A-var_dump(=
$funct =3D square);=0A+$funct =3D "square";=0A var_dump($funct(-2.3));=0A =
=0A echo strlen("abcedfg")."\n";=0A --EXPECTF--=0A f1: # arguments passed i=
s 0=0A NULL=0A-=0A-Warning: Use of undefined constant f1 - assumed 'f1' (th=
is will throw an Error in a future version of PHP) in %s/functions/basics.p=
hp on line 30=0A-=0A-Warning: Use of undefined constant f1 - assumed 'f1' (=
this will throw an Error in a future version of PHP) in %s/functions/basics=
.php on line 31=0A-string(2) "f1"=0A-=0A-Warning: Use of undefined constant=
 f1 - assumed 'f1' (this will throw an Error in a future version of PHP) in=
 %s/functions/basics.php on line 32=0A+f1: # arguments passed is 0=0A f1: #=
 arguments passed is 0=0A f1: # arguments passed is 0=0A f1: # arguments pa=
ssed is 1=0A@@ -106,8 +98,5 @@ Too few arguments to function f2(), 1 passed=
 in %s on line %d and exactly 2 expe=0A f2: $p1 =3D 10, $p2 =3D 20=0A f2: $=
p1 =3D 10, $p2 =3D 20=0A 5 squared =3D 25=0A-=0A-Warning: Use of undefined =
constant square - assumed 'square' (this will throw an Error in a future ve=
rsion of PHP) in %s/functions/basics.php on line 74=0A-string(6) "square"=
=0A float(5.29)=0A 7=0A