Bug #76510 [Com]: file_exists() stopped working for phar:// in PHP 7.3

From: Date: Fri, 03 Aug 2018 22:43:33 +0000
Subject: Bug #76510 [Com]: file_exists() stopped working for phar:// in PHP 7.3
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216570@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76510&edit=1

 ID:                 76510
 Comment by:         bugs dot php dot net at majkl578 dot cz
 Reported by:        sebastian@php.net
 Summary:            file_exists() stopped working for phar:// in PHP 7.3
 Status:             Open
 Type:               Bug
 Package:            PHAR related
 Operating System:   Linux
 PHP Version:        7.3Git-2018-06-21 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Bisected to commit 513b0093c2b480bb752fb354012f42c446769486: Refactor php_url struct to save memory
dup in common cases [laurence]
https://github.com/php/php-src/commit/513b0093c2b480bb752fb354012f42c446769486


Previous Comments:
------------------------------------------------------------------------
[2018-08-03 21:37:22] bugs dot php dot net at majkl578 dot cz

Traced down to optimize-strlen GCC optimization (part of -O2).

does not work: -O2
works: -O2 -fno-optimize-strlen

------------------------------------------------------------------------
[2018-08-03 21:19:06] bugs dot php dot net at majkl578 dot cz

Did some digging using php-7.3.0beta1 tag and provided PHPUnit repro script in OP.

Compiling PHP with gcc-8 as such:
git clean -xdf && ./buildconf --force && ./configure CC=gcc-8 CFLAGS=XXX &&
make -j 12

With various GCC optimization levels, the results are:
gcc-8 with -O0 works
gcc-8 with -O1 works
gcc-8 with -O2 does not work
gcc-8 with -O3 does not work
gcc-8 with -Og works
gcc-8 with -Os works
gcc-8 with -Ofast does not compile

------------------------------------------------------------------------
[2018-06-29 12:01:30] sebastian@php.net

Interesting. Any idea what might be different on my system that would cause this? What I find weird
is that you were able to reproduce the issue initially but now you no longer can while I am still
seeing it.

------------------------------------------------------------------------
[2018-06-29 08:52:29] dc dot link at yahoo dot fr

Before that I update the phpunit repository did composer update.

------------------------------------------------------------------------
[2018-06-29 08:51:18] dc dot link at yahoo dot fr

Did this

git fetch --prune
git reset --hard
git clean -xdf
git checkout master
git rebase origin/master

./buildconf --force
./configure --prefix=/tmp/PHP --disable-cgi --enable-opcache --enable-opcache-file --with-zlib
--with-xsl=/usr --enable-mbstring --enable-bcmath --with-gmp --with-openssl --with-bz2 --enable-soap
--enable-intl --enable-pcntl --with-tidy --with-curl --enable-zip --with-readline --without-pear
--enable-phpdbg

/tmp/PHP/bin/php ../../../phpunit
PHPUnit 7.3-g11d92ae06 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.0-dev
Configuration:
/home/test/Contribs/php-src/phpunit/tests/_files/phpunit-example-extension/phpunit.xml
Extension:     phpunit/phpunit-example-extension 3.0.3

.                                                                   1 / 1 (100%)

Time: 386 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=76510


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


Thread (23 messages)

« previous php.bugs (#216570) next »