php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76510 file_exists() stopped working for phar:// in PHP 7.3
Submitted: 2018-06-21 11:52 UTC Modified: 2018-09-11 11:31 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: sebastian@php.net Assigned: cmb (profile)
Status: Closed Package: PHAR related
PHP Version: 7.3Git-2018-06-21 (Git) OS: Linux
Private report: No CVE-ID: None
 [2018-06-21 11:52 UTC] sebastian@php.net
Description:
------------
https://github.com/sebastianbergmann/phpunit/blob/master/src/TextUI/Command.php#L1179 stopped working in master / PHP 7.3.

The file_exists() call always returns FALSE even if the queried file exists.

Here is how to reproduce the issue:

$ git clone https://github.com/sebastianbergmann/phpunit.git
$ cd phpunit
$ composer update
$ cd tests/_files/phpunit-example-extension

$ php-72 ../../../phpunit
PHPUnit 7.3-gee3ee1aee by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.7-dev
Configuration: /usr/local/src/phpunit/tests/_files/phpunit-example-extension/phpunit.xml
Extension:     phpunit/phpunit-example-extension 3.0.3

.                                                                   1 / 1 (100%)

Time: 39 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

$ php-73 ../../../phpunit
Fatal error: Trait 'PHPUnit\ExampleExtension\TestCaseTrait' not found in /usr/local/src/phpunit/tests/_files/phpunit-example-extension/tests/OneTest.php on line 15

In my environment, php-72 and php-73 are aliases:

$ php-72 --version
PHP 7.2.7-dev (cli) (built: Jun 12 2018 08:02:44) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

$ php-73 --version
PHP 7.3.0-dev (cli) (built: Jun 21 2018 14:23:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-21 15:31 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-06-21 15:31 UTC] cmb@php.net
I can confirm the regression.
 [2018-06-25 10:38 UTC] dc dot link at yahoo dot fr
I stumbled upon this ticket and tried to reproduce myself with php master :

~/Contribs/php-src/sapi/cli/php ../../../phpunit
PHPUnit 7.3-g2e9ab306f 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: 512 ms, Memory: 4.00MB

OK (1 test, 1 assertion)
 [2018-06-28 12:30 UTC] cmb@php.net
-Status: Verified +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-06-28 12:30 UTC] cmb@php.net
Indeed, it appears to work now.  Has there been an update to any
of the other requirements besides PHP?
 [2018-06-28 12:42 UTC] sebastian@php.net
Using the commands provided in the original ticket, I can still reproduce the problem with 95a71caab1dad8e0092f672723dc9020dff8263d.
 [2018-06-28 15:41 UTC] cmb@php.net
-Status: Feedback +Status: Open -Assigned To: cmb +Assigned To:
 [2018-06-28 15:41 UTC] cmb@php.net
I tried with 2ff26bdf7370fff79d743c390e23cd9f477c855d (which
shouldn't make any difference), and some different configurations,
but the reproducer always lets the test succeed, now.
 [2018-06-28 16:58 UTC] sebastian@php.net
In case it matters, here is how I build PHP 7.3:

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

./buildconf --force
./configure --prefix=/usr/local/php-7.3 --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
make -j5
make install
 [2018-06-29 08:51 UTC] 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)
 [2018-06-29 08:52 UTC] dc dot link at yahoo dot fr
Before that I update the phpunit repository did composer update.
 [2018-06-29 12:01 UTC] 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-08-03 21:19 UTC] 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-08-03 21:37 UTC] 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 22:43 UTC] bugs dot php dot net at majkl578 dot cz
Bisected to commit 513b0093c2b480bb752fb354012f42c446769486: Refactor php_url struct to save memory dup in common cases [laurence]
https://github.com/php/php-src/commit/513b0093c2b480bb752fb354012f42c446769486
 [2018-08-03 22:45 UTC] bugs dot php dot net at majkl578 dot cz
Bisect log (bad: php-7.3.0beta1, good: php-7.2.9RC1) if anyone needs to replay:

# bad: [9160e881a6af72691ad034978e5078a8042ee9b6] Update versions for PHP 7.3.0beta1
# good: [09aa799e6448ed2a12b9371f8cdf31683b0c46aa] Update versions for PHP 7.2.9RC1
git bisect start 'php-7.3.0beta1' 'php-7.2.9RC1'
# good: [095a30e11b14dde32aabc002d627301bcbe7a927] Update NEWS [ci skip]
git bisect good 095a30e11b14dde32aabc002d627301bcbe7a927
# good: [095a30e11b14dde32aabc002d627301bcbe7a927] Update NEWS [ci skip]
git bisect good 095a30e11b14dde32aabc002d627301bcbe7a927
# bad: [6e94f943c1943984b55de159404d480f82357f7c] Avoid abs() type mismatch warnings
git bisect bad 6e94f943c1943984b55de159404d480f82357f7c
# bad: [bfe19cb355a82c14e03504f4499f267a51155a85] Merge branch 'PHP-7.2'
git bisect bad bfe19cb355a82c14e03504f4499f267a51155a85
# bad: [a06ba4b9d6621bd4bb7c387cf1439c7a356c8d72] Merge branch 'PHP-7.2'
git bisect bad a06ba4b9d6621bd4bb7c387cf1439c7a356c8d72
# good: [e6bfbb6c9d7524f62366c664ceb5056be7c55195] Merge branch 'PHP-7.2'
git bisect good e6bfbb6c9d7524f62366c664ceb5056be7c55195
# bad: [28fdc1f1c35392d1bbe16d4f8c76a2d661d70b0b] Merge branch 'PHP-7.2'
git bisect bad 28fdc1f1c35392d1bbe16d4f8c76a2d661d70b0b
# bad: [17b39f1216bf213838c7975d266808d4bc7ffb4c] Merge branch 'PHP-7.2'
git bisect bad 17b39f1216bf213838c7975d266808d4bc7ffb4c
# good: [902188e5e3889886d609696a7b5ed8ac12e071e2] Merge branch 'PHP-7.2'
git bisect good 902188e5e3889886d609696a7b5ed8ac12e071e2
# good: [b1cf87a4e6ef58987107709f89470168fd928452] Merge branch 'PHP-7.2'
git bisect good b1cf87a4e6ef58987107709f89470168fd928452
# good: [e20fbd43bad65d10af1e0d648f7bfa0c40baa893] Separate mbfl filters into three categories
git bisect good e20fbd43bad65d10af1e0d648f7bfa0c40baa893
# good: [fea7957d0836d8389c4b5063138277d7a21156b3] Optimize mb_chr()
git bisect good fea7957d0836d8389c4b5063138277d7a21156b3
# bad: [513b0093c2b480bb752fb354012f42c446769486] Refactor php_url struct to save memory dup in common cases
git bisect bad 513b0093c2b480bb752fb354012f42c446769486
# good: [6546c516dd61f7f9efecbd9144c02218614d4c51] Optimized ucfirst(Avoid duping string if possible)
git bisect good 6546c516dd61f7f9efecbd9144c02218614d4c51
# first bad commit: [513b0093c2b480bb752fb354012f42c446769486] Refactor php_url struct to save memory dup in common cases
 [2018-08-04 06:37 UTC] sebastian@php.net
I can confirm that compiling PHP with -fno-optimize-strlen solves the problem for me.
 [2018-08-05 14:11 UTC] cmb@php.net
> 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.

Initially, I've built PHP “incrementally”, i.e. I started with a
minimal build, and did `config.nice … && make` to add the required
extensions.  That let the test fail.  If I build with exactly the
same configure options in one go, the test succeeds.

gcc (Debian 6.3.0-18) 6.3.0 20170516
 [2018-08-06 15:16 UTC] sebastian@php.net
As requested by Nikita on the mailinglist, here is the Valgrind logfile:

==21544== Memcheck, a memory error detector
==21544== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21544== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==21544== Command: /usr/local/php-7.3/bin/php ../../../phpunit
==21544== Parent PID: 19592
==21544== 
==21544== Conditional jump or move depends on uninitialised value(s)
==21544==    at 0x4072122: ???
==21544==    by 0x1BEB2267: ???
==21544==    by 0x1BEB2267: ???
==21544==    by 0x1BEB228C: ???
==21544==    by 0xEB577AF: ???
==21544==    by 0x1BEB2267: ???
==21544== 
==21544== Conditional jump or move depends on uninitialised value(s)
==21544==    at 0x4072122: ???
==21544==    by 0x1BEB6637: ???
==21544==    by 0x1BEB6637: ???
==21544==    by 0x1BEB665C: ???
==21544==    by 0xEB577AF: ???
==21544==    by 0x1BEB6637: ???
==21544== 
==21544== Conditional jump or move depends on uninitialised value(s)
==21544==    at 0x4072122: ???
==21544==    by 0x1BF754E7: ???
==21544==    by 0x1BF754E7: ???
==21544==    by 0x1BF754F3: ???
==21544==    by 0xEB577AF: ???
==21544==    by 0x1BF754E7: ???
==21544== 
==21544== Conditional jump or move depends on uninitialised value(s)
==21544==    at 0x4072122: ???
==21544==    by 0x1BF77167: ???
==21544==    by 0x1BF77167: ???
==21544==    by 0x1BF77173: ???
==21544==    by 0xEB577AF: ???
==21544==    by 0x1BF77167: ???
==21544== 
==21544== Invalid read of size 1
==21544==    at 0x848DF7: destroy_zend_class (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8459F3: shutdown_executor (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853677: zend_deactivate (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F761A: php_request_shutdown (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D77D5: do_cli (in /usr/local/php-7.3/bin/php)
==21544==    by 0x47AB55: main (in /usr/local/php-7.3/bin/php)
==21544==  Address 0x1ba482f4 is 4 bytes inside a block of size 56 free'd
==21544==    at 0x4C2FDAC: free (vg_replace_malloc.c:530)
==21544==    by 0x848E05: destroy_zend_class (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8459F3: shutdown_executor (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853677: zend_deactivate (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F761A: php_request_shutdown (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D77D5: do_cli (in /usr/local/php-7.3/bin/php)
==21544==    by 0x47AB55: main (in /usr/local/php-7.3/bin/php)
==21544==  Block was alloc'd at
==21544==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==21544==    by 0x82D278: __zend_malloc (in /usr/local/php-7.3/bin/php)
==21544==    by 0x822E2A: lex_scan (in /usr/local/php-7.3/bin/php)
==21544==    by 0x836668: zendlex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81C3DD: zendparse (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81E7C2: zend_compile (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81FEE1: compile_file (in /usr/local/php-7.3/bin/php)
==21544==    by 0x6E85F1: phar_compile_file (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81FF68: compile_filename (in /usr/local/php-7.3/bin/php)
==21544==    by 0x893864: zend_include_or_eval (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8C8AA9: ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CD99E: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8466F5: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x74B54D: zif_spl_autoload_call (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8465B1: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x846A57: zend_lookup_class_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x847397: zend_fetch_class_by_name (in /usr/local/php-7.3/bin/php)
==21544==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CF616: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8466F5: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x74B54D: zif_spl_autoload_call (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8465B1: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x846A57: zend_lookup_class_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x847397: zend_fetch_class_by_name (in /usr/local/php-7.3/bin/php)
==21544==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CF616: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D5F41: zend_execute (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853963: zend_execute_scripts (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F89FF: php_execute_script (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D83A5: do_cli (in /usr/local/php-7.3/bin/php)
==21544== 
==21544== Invalid read of size 4
==21544==    at 0x848DFD: destroy_zend_class (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8459F3: shutdown_executor (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853677: zend_deactivate (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F761A: php_request_shutdown (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D77D5: do_cli (in /usr/local/php-7.3/bin/php)
==21544==    by 0x47AB55: main (in /usr/local/php-7.3/bin/php)
==21544==  Address 0x1ba482f0 is 0 bytes inside a block of size 56 free'd
==21544==    at 0x4C2FDAC: free (vg_replace_malloc.c:530)
==21544==    by 0x848E05: destroy_zend_class (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8459F3: shutdown_executor (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853677: zend_deactivate (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F761A: php_request_shutdown (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D77D5: do_cli (in /usr/local/php-7.3/bin/php)
==21544==    by 0x47AB55: main (in /usr/local/php-7.3/bin/php)
==21544==  Block was alloc'd at
==21544==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==21544==    by 0x82D278: __zend_malloc (in /usr/local/php-7.3/bin/php)
==21544==    by 0x822E2A: lex_scan (in /usr/local/php-7.3/bin/php)
==21544==    by 0x836668: zendlex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81C3DD: zendparse (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81E7C2: zend_compile (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81FEE1: compile_file (in /usr/local/php-7.3/bin/php)
==21544==    by 0x6E85F1: phar_compile_file (in /usr/local/php-7.3/bin/php)
==21544==    by 0x81FF68: compile_filename (in /usr/local/php-7.3/bin/php)
==21544==    by 0x893864: zend_include_or_eval (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8C8AA9: ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CD99E: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8466F5: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x74B54D: zif_spl_autoload_call (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8465B1: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x846A57: zend_lookup_class_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x847397: zend_fetch_class_by_name (in /usr/local/php-7.3/bin/php)
==21544==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CF616: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8466F5: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x74B54D: zif_spl_autoload_call (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8465B1: zend_call_function (in /usr/local/php-7.3/bin/php)
==21544==    by 0x846A57: zend_lookup_class_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x847397: zend_fetch_class_by_name (in /usr/local/php-7.3/bin/php)
==21544==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8CF616: execute_ex (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D5F41: zend_execute (in /usr/local/php-7.3/bin/php)
==21544==    by 0x853963: zend_execute_scripts (in /usr/local/php-7.3/bin/php)
==21544==    by 0x7F89FF: php_execute_script (in /usr/local/php-7.3/bin/php)
==21544==    by 0x8D83A5: do_cli (in /usr/local/php-7.3/bin/php)
==21544== 
==21544== 
==21544== HEAP SUMMARY:
==21544==     in use at exit: 9,484 bytes in 70 blocks
==21544==   total heap usage: 57,160 allocs, 57,090 frees, 10,884,126 bytes allocated
==21544== 
==21544== LEAK SUMMARY:
==21544==    definitely lost: 2,648 bytes in 21 blocks
==21544==    indirectly lost: 5,142 bytes in 26 blocks
==21544==      possibly lost: 640 bytes in 1 blocks
==21544==    still reachable: 1,054 bytes in 22 blocks
==21544==         suppressed: 0 bytes in 0 blocks
==21544== Rerun with --leak-check=full to see details of leaked memory
==21544== 
==21544== For counts of detected and suppressed errors, rerun with: -v
==21544== Use --track-origins=yes to see where uninitialised values come from
==21544== ERROR SUMMARY: 10 errors from 6 contexts (suppressed: 0 from 0)

Not sure how useful this is, though, as I cannot compile PHP with --enable-debug as that overrides "-O2" with "-O0".
 [2018-08-06 15:59 UTC] cmb@php.net
Please run that again with `valgrind --track-origins=yes`.
 [2018-08-06 19:01 UTC] sebastian@php.net
$ USE_ZEND_ALLOC=0 valgrind --tool=memcheck --num-callers=30 --log-file=/tmp/valgrind.txt --track-origins=yes /usr/local/php-7.3/bin/php ../../../phpunit
==20559== Memcheck, a memory error detector
==20559== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==20559== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==20559== Command: /usr/local/php-7.3/bin/php ../../../phpunit
==20559== Parent PID: 19979
==20559== 
==20559== Conditional jump or move depends on uninitialised value(s)
==20559==    at 0x4072122: ???
==20559==    by 0x1BEB2687: ???
==20559==    by 0x1BEB2687: ???
==20559==    by 0x1BEB26AC: ???
==20559==    by 0xEB577AF: ???
==20559==    by 0x1BEB2687: ???
==20559==  Uninitialised value was created by a heap allocation
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x7B0AC6: zend_string_alloc (zend_string.h:133)
==20559==    by 0x7B0AC6: php_str_to_str_ex (string.c:3266)
==20559==    by 0x7B6629: php_str_replace_in_subject.isra.4 (string.c:4409)
==20559==    by 0x7B6D6E: php_str_replace_common (string.c:4478)
==20559==    by 0x8D0007: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:690)
==20559==    by 0x8D0007: execute_ex (zend_vm_execute.h:55462)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x7549D1: spl_filter_it_fetch (spl_iterators.c:1833)
==20559==    by 0x7549D1: spl_filter_it_rewind (spl_iterators.c:1852)
==20559==    by 0x7549D1: zim_spl_FilterIterator_rewind (spl_iterators.c:1872)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x755CD6: spl_dual_it_rewind (spl_iterators.c:1671)
==20559==    by 0x755CD6: spl_append_it_next_iterator (spl_iterators.c:3319)
==20559==    by 0x75606F: zim_spl_AppendIterator_append (spl_iterators.c:3376)
==20559==    by 0x8D5667: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:980)
==20559==    by 0x8D5667: execute_ex (zend_vm_execute.h:55482)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559== 
==20559== Conditional jump or move depends on uninitialised value(s)
==20559==    at 0x4072122: ???
==20559==    by 0x1BEB6A57: ???
==20559==    by 0x1BEB6A57: ???
==20559==    by 0x1BEB6A7C: ???
==20559==    by 0xEB577AF: ???
==20559==    by 0x1BEB6A57: ???
==20559==  Uninitialised value was created by a heap allocation
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x7B0AC6: zend_string_alloc (zend_string.h:133)
==20559==    by 0x7B0AC6: php_str_to_str_ex (string.c:3266)
==20559==    by 0x7B6629: php_str_replace_in_subject.isra.4 (string.c:4409)
==20559==    by 0x7B6D6E: php_str_replace_common (string.c:4478)
==20559==    by 0x8D0007: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:690)
==20559==    by 0x8D0007: execute_ex (zend_vm_execute.h:55462)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x7549D1: spl_filter_it_fetch (spl_iterators.c:1833)
==20559==    by 0x7549D1: spl_filter_it_rewind (spl_iterators.c:1852)
==20559==    by 0x7549D1: zim_spl_FilterIterator_rewind (spl_iterators.c:1872)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x755CD6: spl_dual_it_rewind (spl_iterators.c:1671)
==20559==    by 0x755CD6: spl_append_it_next_iterator (spl_iterators.c:3319)
==20559==    by 0x7560ED: zim_spl_AppendIterator_rewind (spl_iterators.c:3417)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x8902E1: zend_fe_reset_iterator (zend_execute.c:3256)
==20559==    by 0x8B4D72: ZEND_FE_RESET_R_SPEC_CV_HANDLER (zend_vm_execute.h:37768)
==20559==    by 0x8CD993: execute_ex (zend_vm_execute.h:59386)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559== 
==20559== Conditional jump or move depends on uninitialised value(s)
==20559==    at 0x4072122: ???
==20559==    by 0x1BF75907: ???
==20559==    by 0x1BF75907: ???
==20559==    by 0x1BF75913: ???
==20559==    by 0xEB577AF: ???
==20559==    by 0x1BF75907: ???
==20559==  Uninitialised value was created by a heap allocation
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x7B0AC6: zend_string_alloc (zend_string.h:133)
==20559==    by 0x7B0AC6: php_str_to_str_ex (string.c:3266)
==20559==    by 0x7B6629: php_str_replace_in_subject.isra.4 (string.c:4409)
==20559==    by 0x7B6D6E: php_str_replace_common (string.c:4478)
==20559==    by 0x8D0007: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:690)
==20559==    by 0x8D0007: execute_ex (zend_vm_execute.h:55462)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x7549D1: spl_filter_it_fetch (spl_iterators.c:1833)
==20559==    by 0x7549D1: spl_filter_it_rewind (spl_iterators.c:1852)
==20559==    by 0x7549D1: zim_spl_FilterIterator_rewind (spl_iterators.c:1872)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x755CD6: spl_dual_it_rewind (spl_iterators.c:1671)
==20559==    by 0x755CD6: spl_append_it_next_iterator (spl_iterators.c:3319)
==20559==    by 0x75606F: zim_spl_AppendIterator_append (spl_iterators.c:3376)
==20559==    by 0x8D5667: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:980)
==20559==    by 0x8D5667: execute_ex (zend_vm_execute.h:55482)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559== 
==20559== Conditional jump or move depends on uninitialised value(s)
==20559==    at 0x4072122: ???
==20559==    by 0x1BF77587: ???
==20559==    by 0x1BF77587: ???
==20559==    by 0x1BF77593: ???
==20559==    by 0xEB577AF: ???
==20559==    by 0x1BF77587: ???
==20559==  Uninitialised value was created by a heap allocation
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x7B0AC6: zend_string_alloc (zend_string.h:133)
==20559==    by 0x7B0AC6: php_str_to_str_ex (string.c:3266)
==20559==    by 0x7B6629: php_str_replace_in_subject.isra.4 (string.c:4409)
==20559==    by 0x7B6D6E: php_str_replace_common (string.c:4478)
==20559==    by 0x8D0007: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:690)
==20559==    by 0x8D0007: execute_ex (zend_vm_execute.h:55462)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x7549D1: spl_filter_it_fetch (spl_iterators.c:1833)
==20559==    by 0x7549D1: spl_filter_it_rewind (spl_iterators.c:1852)
==20559==    by 0x7549D1: zim_spl_FilterIterator_rewind (spl_iterators.c:1872)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x755CD6: spl_dual_it_rewind (spl_iterators.c:1671)
==20559==    by 0x755CD6: spl_append_it_next_iterator (spl_iterators.c:3319)
==20559==    by 0x7560ED: zim_spl_AppendIterator_rewind (spl_iterators.c:3417)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x86DCBC: zend_call_method (zend_interfaces.c:103)
==20559==    by 0x86E1AA: zend_user_it_rewind (zend_interfaces.c:224)
==20559==    by 0x8902E1: zend_fe_reset_iterator (zend_execute.c:3256)
==20559==    by 0x8B4D72: ZEND_FE_RESET_R_SPEC_CV_HANDLER (zend_vm_execute.h:37768)
==20559==    by 0x8CD993: execute_ex (zend_vm_execute.h:59386)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559== 
==20559== Invalid read of size 1
==20559==    at 0x848DF7: zend_string_release_ex (zend_string.h:284)
==20559==    by 0x848DF7: destroy_zend_class (zend_opcode.c:241)
==20559==    by 0x8459F3: shutdown_executor (zend_execute_API.c:345)
==20559==    by 0x853677: zend_deactivate (zend.c:1104)
==20559==    by 0x7F761A: php_request_shutdown (main.c:1926)
==20559==    by 0x8D77D5: do_cli (php_cli.c:1164)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559==  Address 0x1ba482f4 is 4 bytes inside a block of size 56 free'd
==20559==    at 0x4C2FDAC: free (vg_replace_malloc.c:530)
==20559==    by 0x848E05: zend_string_release_ex (zend_string.h:291)
==20559==    by 0x848E05: destroy_zend_class (zend_opcode.c:241)
==20559==    by 0x8459F3: shutdown_executor (zend_execute_API.c:345)
==20559==    by 0x853677: zend_deactivate (zend.c:1104)
==20559==    by 0x7F761A: php_request_shutdown (main.c:1926)
==20559==    by 0x8D77D5: do_cli (php_cli.c:1164)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559==  Block was alloc'd at
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x822E2A: zend_string_alloc (zend_string.h:133)
==20559==    by 0x822E2A: zend_string_init (zend_string.h:155)
==20559==    by 0x822E2A: lex_scan (zend_language_scanner.l:2109)
==20559==    by 0x836668: zendlex (zend_compile.c:1693)
==20559==    by 0x81C3DD: zendparse (zend_language_parser.c:4211)
==20559==    by 0x81E7C2: zend_compile (zend_language_scanner.l:586)
==20559==    by 0x81FEE1: compile_file (zend_language_scanner.l:636)
==20559==    by 0x6E85F1: phar_compile_file (phar.c:3335)
==20559==    by 0x81FF68: compile_filename (zend_language_scanner.l:661)
==20559==    by 0x893864: zend_include_or_eval (zend_execute.c:3182)
==20559==    by 0x8C8AA9: ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (zend_vm_execute.h:37674)
==20559==    by 0x8CD99E: execute_ex (zend_vm_execute.h:59382)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x74B54D: zif_spl_autoload_call (php_spl.c:448)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x846A57: zend_lookup_class_ex (zend_execute_API.c:926)
==20559==    by 0x847397: zend_fetch_class_by_name (zend_execute_API.c:1361)
==20559==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:5837)
==20559==    by 0x8CF616: execute_ex (zend_vm_execute.h:56000)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x74B54D: zif_spl_autoload_call (php_spl.c:448)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x846A57: zend_lookup_class_ex (zend_execute_API.c:926)
==20559==    by 0x847397: zend_fetch_class_by_name (zend_execute_API.c:1361)
==20559==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:5837)
==20559==    by 0x8CF616: execute_ex (zend_vm_execute.h:56000)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559== 
==20559== Invalid read of size 4
==20559==    at 0x848DFD: zend_gc_delref (zend_types.h:988)
==20559==    by 0x848DFD: zend_string_release_ex (zend_string.h:285)
==20559==    by 0x848DFD: destroy_zend_class (zend_opcode.c:241)
==20559==    by 0x8459F3: shutdown_executor (zend_execute_API.c:345)
==20559==    by 0x853677: zend_deactivate (zend.c:1104)
==20559==    by 0x7F761A: php_request_shutdown (main.c:1926)
==20559==    by 0x8D77D5: do_cli (php_cli.c:1164)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559==  Address 0x1ba482f0 is 0 bytes inside a block of size 56 free'd
==20559==    at 0x4C2FDAC: free (vg_replace_malloc.c:530)
==20559==    by 0x848E05: zend_string_release_ex (zend_string.h:291)
==20559==    by 0x848E05: destroy_zend_class (zend_opcode.c:241)
==20559==    by 0x8459F3: shutdown_executor (zend_execute_API.c:345)
==20559==    by 0x853677: zend_deactivate (zend.c:1104)
==20559==    by 0x7F761A: php_request_shutdown (main.c:1926)
==20559==    by 0x8D77D5: do_cli (php_cli.c:1164)
==20559==    by 0x47AB55: main (php_cli.c:1390)
==20559==  Block was alloc'd at
==20559==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==20559==    by 0x82D278: __zend_malloc (zend_alloc.c:2896)
==20559==    by 0x822E2A: zend_string_alloc (zend_string.h:133)
==20559==    by 0x822E2A: zend_string_init (zend_string.h:155)
==20559==    by 0x822E2A: lex_scan (zend_language_scanner.l:2109)
==20559==    by 0x836668: zendlex (zend_compile.c:1693)
==20559==    by 0x81C3DD: zendparse (zend_language_parser.c:4211)
==20559==    by 0x81E7C2: zend_compile (zend_language_scanner.l:586)
==20559==    by 0x81FEE1: compile_file (zend_language_scanner.l:636)
==20559==    by 0x6E85F1: phar_compile_file (phar.c:3335)
==20559==    by 0x81FF68: compile_filename (zend_language_scanner.l:661)
==20559==    by 0x893864: zend_include_or_eval (zend_execute.c:3182)
==20559==    by 0x8C8AA9: ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (zend_vm_execute.h:37674)
==20559==    by 0x8CD99E: execute_ex (zend_vm_execute.h:59382)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x74B54D: zif_spl_autoload_call (php_spl.c:448)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x846A57: zend_lookup_class_ex (zend_execute_API.c:926)
==20559==    by 0x847397: zend_fetch_class_by_name (zend_execute_API.c:1361)
==20559==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:5837)
==20559==    by 0x8CF616: execute_ex (zend_vm_execute.h:56000)
==20559==    by 0x8466F5: zend_call_function (zend_execute_API.c:756)
==20559==    by 0x74B54D: zif_spl_autoload_call (php_spl.c:448)
==20559==    by 0x8465B1: zend_call_function (zend_execute_API.c:770)
==20559==    by 0x846A57: zend_lookup_class_ex (zend_execute_API.c:926)
==20559==    by 0x847397: zend_fetch_class_by_name (zend_execute_API.c:1361)
==20559==    by 0x89BA8A: ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:5837)
==20559==    by 0x8CF616: execute_ex (zend_vm_execute.h:56000)
==20559==    by 0x8D5F41: zend_execute (zend_vm_execute.h:60882)
==20559==    by 0x853963: zend_execute_scripts (zend.c:1562)
==20559==    by 0x7F89FF: php_execute_script (main.c:2630)
==20559==    by 0x8D83A5: do_cli (php_cli.c:997)
==20559== 
==20559== 
==20559== HEAP SUMMARY:
==20559==     in use at exit: 9,484 bytes in 70 blocks
==20559==   total heap usage: 57,170 allocs, 57,100 frees, 10,884,542 bytes allocated
==20559== 
==20559== LEAK SUMMARY:
==20559==    definitely lost: 2,648 bytes in 21 blocks
==20559==    indirectly lost: 5,142 bytes in 26 blocks
==20559==      possibly lost: 640 bytes in 1 blocks
==20559==    still reachable: 1,054 bytes in 22 blocks
==20559==         suppressed: 0 bytes in 0 blocks
==20559== Rerun with --leak-check=full to see details of leaked memory
==20559== 
==20559== For counts of detected and suppressed errors, rerun with: -v
==20559== ERROR SUMMARY: 10 errors from 6 contexts (suppressed: 0 from 0)
 [2018-08-07 14:38 UTC] cmb@php.net
Thanks, Sebastian!  I did run valgrind on a build (master@8c76dc3)
where the test succeeds, and get a long list of errors[1].  My
configure line:

./configure --disable-all --disable-cgi --disable-phpdbg --enable-phar --enable-json --enable-filter --with-iconv --with-openssl --enable-hash --enable-libxml --enable-dom --enable-xml --enable-xmlwriter --enable-mbstring --enable-pdo --enable-tokenizer --enable-zip --without-libzip

[1] <https://gist.github.com/cmb69/c7d78afcbc22274cf6bd1ba64100c4f2>
 [2018-08-29 18:15 UTC] bugs dot php dot net at majkl578 dot cz
Any update on this one? It also breaks Composer and other PHAR-distributed tools (i.e. PHPStan, Infection).
 [2018-09-11 10:24 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b117feeb2b545b34296f2fc492166d790610fffe
Log: Fix #76510: file_exists() stopped working for phar://
 [2018-09-11 10:24 UTC] cmb@php.net
-Status: Open +Status: Closed
 [2018-09-11 10:24 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2018-09-11 11:31 UTC] sebastian@php.net
Fix verified using PHPUnit's test suite. Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC