From:
Operating system: linux
PHP version: 5.4.0RC6
Package: CGI/CLI related
Bug Type: Bug
Bug description:php -r works differently
Description:
------------
PHP behaves differently with the code given in a file and in a parameter
provided
with -r
php -r ignores variables, partially recognizes scalar type hinting.
Test script:
---------------
[root@devel data]# php -r "echo 1;"
1[root@devel data]# php -r "$x=3;"
Parse error: syntax error, unexpected '=' in Command line code on line 1
# php -r "var_dump($x);"
Warning: Wrong parameter count for var_dump() in Command line code on line
1
# php -r "function foo(int $a){}"
Parse error: syntax error, unexpected '(int )' (int) (T_INT_CAST),
expecting '(' in Command line code on line 1
Expected result:
----------------
1
Actual result:
--------------
Parse errors
--
Edit bug report at https://bugs.php.net/bug.php?id=60848&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60848&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60848&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60848&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60848&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60848&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60848&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60848&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60848&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60848&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60848&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60848&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60848&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60848&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60848&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60848&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60848&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60848&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60848&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60848&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60848&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60848&r=mysqlcfg