Bug #71624 [NEW]: `php -R` (PHP_MODE_PROCESS_STDIN) is broken
| From: | dana at dana dot is | Date: | Thu, 18 Feb 2016 12:19:32 +0000 |
| Subject: | Bug #71624 [NEW]: `php -R` (PHP_MODE_PROCESS_STDIN) is broken | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199319@lists.php.net to get a copy of this message | ||
From: dana at dana dot is
Operating system:
PHP version: 7.0.3
Package: CGI/CLI related
Bug Type: Bug
Bug description:
php -R (PHP_MODE_PROCESS_STDIN) is broken
Description:
------------
It looks like between 5.6 and 7.0 somebody broke the CLI utility's -R
option. Specifically:
* $argi is always 0
* $argn always has the last character cut off
I've confirmed it works as expected in PHP 5.6.14 on OS X, whilst it's
broken in 7.0.2 on OS X and master on Ubuntu.
I'm not very good at C, so i don't have a patch, i'm sorry.
Test script:
---------------
% php -R 'echo "${argi}\n";' <<< $'foo\nbar'
% php -R 'echo "${argn}\n";' <<< $'foo\nbar'
Expected result:
----------------
% php --version | head -1
PHP 5.6.14 (cli) (built: Oct 3 2015 14:54:13)
% php -R 'echo "${argi}\n";' <<< $'foo\nbar'
1
2
% php -R 'echo "${argn}\n";' <<< $'foo\nbar'
foo
bar
Actual result:
--------------
% php --version | head -1
PHP 7.0.2 (cli) (built: Jan 7 2016 10:40:26) ( NTS )
proserpina:php % php -R 'echo "${argi}\n";' <<< $'foo\nbar'
0
0
proserpina:php % php -R 'echo "${argn}\n";' <<< $'foo\nbar'
fo
ba
--
Edit bug report at https://bugs.php.net/bug.php?id=71624&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71624&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71624&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71624&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71624&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71624&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71624&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71624&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71624&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71624&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71624&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71624&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71624&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71624&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71624&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71624&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71624&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71624&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71624&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71624&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71624&r=mysqlcfg