View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001454||Xdebug||Uncategorized||public||2017-07-14 22:11||2018-01-22 18:21|
|Target Version||2.6.0||Fixed in Version||2.6.0rc1|
|Summary||0001454: Seeing invalid memory read or segfaults from a __call() method when running unit test (using Phockito) in php 7.1|
A unit test (internally used with a lot of dependencies) was segfaulting when using https://github.com/ifwe/phockito/blob/6e6011301ac5f6e62a49b6c4931cc4180e12d6e5/Phockito.php#L837
The conditions for the invalid memory reads with xdebug are unknown, but it happens when a Phockito test fails and attempts to throw an exception indicating this. It likely has something to do with the fact it's happening in __call()
https://github.com/TysonAndre/xdebug_invalidread_phockito has a simplified version of that test, which consistently emits invalid memory read errors when run under valgrind.
I haven't tested php 7.1 yet. I was able to reproduce this in Centos 6.5 and Ubuntu (dockerized)
|Steps To Reproduce|
Run the below command (Must include collect_params=3. If collect_params=0 is used, there are no invalid memory reads)
USE_ZEND_ALLOC=0 valgrind php --no-php-ini zend_extension=xdebug.so xdebug.collect_params=3 invalid_read_test.php
It seems to happen when reading the contents of temporary un-named variables of the function, in order to create a stack trace. I've seen attempts to dump zvals with (type 6) strings with negative refcounts, as well as zvals with (type 8) values with invalid object handlers and class entries.
Various valgrind errors such as the below were seen.
7 ==7== Invalid read of size 8
|Tags||No tags attached.|
invalid_read_test.php (118,932 bytes)
I can reproduce this.
I just had a look at this again, and I scan still reproduce it. However, I found out that the simplified test was still 4000 lines, which I wouldn't particularly "simple". With this much data, it's really hard to figure out what causes the problem :-/
If you have some time, could you help out by simplifying this test case even more?
invalid_read_test_simplified.php (1,292 bytes)
I simplified it even more. See https://github.com/TysonAndre/xdebug_invalidread_phockito for the steps, I also uploaded the final simplified version (60 lines)
I believe I have this fixed in GIT just now. After my patch, I can't reproduce this issue any more. Thanks for the report, and short test case!
|2017-07-14 22:11||tyson||New Issue|
|2017-07-14 22:11||tyson||File Added: invalid_read_test.php|
|2017-07-15 09:58||derick||Note Added: 0004370|
|2017-07-15 09:58||derick||Assigned To||=> derick|
|2017-07-15 09:58||derick||Status||new => confirmed|
|2017-07-15 09:59||derick||Target Version||=> 2.5.6|
|2017-09-26 22:28||derick||Note Added: 0004428|
|2017-09-26 22:28||derick||Status||confirmed => feedback|
|2017-09-26 23:13||tyson||File Added: invalid_read_test_simplified.php|
|2017-09-26 23:14||tyson||Note Added: 0004429|
|2017-09-26 23:14||tyson||Status||feedback => assigned|
|2017-11-05 14:12||derick||Target Version||2.5.6 => 2.6.0dev|
|2017-12-02 18:35||derick||Target Version||2.6.0dev => 2.6.0|
|2018-01-20 09:53||derick||Note Added: 0004566|
|2018-01-20 09:53||derick||Status||assigned => closed|
|2018-01-20 09:53||derick||Resolution||open => fixed|
|2018-01-20 09:53||derick||Fixed in Version||=> 2.6.0|
|2018-01-22 18:21||derick||Fixed in Version||2.6.0 => 2.6.0rc1|
|2020-03-12 16:35||derick||Category||Usage problems (Wrong Results) => Variable Display|
|2020-03-12 16:38||derick||Category||Variable Display => Uncategorized|