Edit report at https://bugs.php.net/bug.php?id=60848&edit=1

 ID:                 60848
 Updated by:         larue...@php.net
 Reported by:        public at grik dot net
 Summary:            php -r works differently
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   linux
 PHP Version:        5.4.0RC6
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

use single quotes, or there will be variable substitution of shell.


Previous Comments:
------------------------------------------------------------------------
[2012-01-23 11:55:26] public at grik dot net

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 this bug report at https://bugs.php.net/bug.php?id=60848&edit=1

Reply via email to