Bug #78066 [NEW]: PHP eats the first byte of a program that comes from process substitution
| From: | octalbugsphp at alvarezp dot org | Date: | Sat, 25 May 2019 16:52:02 +0000 |
| Subject: | Bug #78066 [NEW]: PHP eats the first byte of a program that comes from process substitution | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220987@lists.php.net to get a copy of this message | ||
From: octalbugsphp at alvarezp dot org
Operating system: Linux
PHP version: 7.3.5
Package: *General Issues
Bug Type: Bug
Bug description:PHP eats the first byte of a program that comes from process substitution
Description:
------------
PHP eats the first byte of a program that comes from process
substitution
After discussion in ##php at Freenode this was found (see the third
line, lseek)
$ strace php -f <(echo -- '<?php print("hello\n"); ?>') 2>&1 |
grep -A 5
'openat.*/dev/fd/63'
openat(AT_FDCWD, "/dev/fd/63", O_RDONLY) = 3
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "-- <?php print(\"hello\\n\"); ?>\n", 4096) = 30
lseek(3, 0, SEEK_SET) = -1 ESPIPE (Illegal seek)
lstat("/dev/fd/63", {st_mode=S_IFLNK|0500, st_size=64, ...}) = 0
readlink("/dev/fd/63", "pipe:[6195898]", 4096) = 14
Test script:
---------------
[ 0][Sat May 25 11:05:07 -0500 -- alvarezp@alvarezp-samsung:~]
$ php -f <(echo '<?php print("hello\n"); ?>')
?php print("hello\n"); ?>
[ 0][Sat May 25 11:05:11 -0500 -- alvarezp@alvarezp-samsung:~]
$ php -f <(echo ' <?php print("hello\n"); ?>')
hello
[ 0][Sat May 25 11:05:19 -0500 -- alvarezp@alvarezp-samsung:~]
$ php -f <(echo -- '<?php print("hello\n"); ?>')
- hello
Expected result:
----------------
The script should run as expected. The first byte should prevail as part
of the script.
Actual result:
--------------
The first byte is eaten and not interpreted at all.
--
Edit bug report at https://bugs.php.net/bug.php?id=78066&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78066&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78066&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78066&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78066&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78066&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78066&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78066&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78066&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78066&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78066&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78066&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78066&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78066&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78066&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78066&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78066&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78066&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78066&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78066&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78066&r=mysqlcfg