View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001545 | Xdebug | Step Debugging | public | 2018-04-16 23:45 | 2018-08-01 18:55 |
Reporter | dwilks | Assigned To | derick | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Apple | OS | MacOS High Sierra | OS Version | 10.13.2 |
Product Version | 2.6.0 | ||||
Fixed in Version | 2.6.1 | ||||
Summary | 0001545: Script using notice-generating eval crashes with trap 6 | ||||
Description | Not sure if this is unique to the MacPorts build or a general issue in xdebug so i decided to start here... A simple script using eval() crashes PHP when xdebug 2.6 is loaded both from the command line (-R) or through an Apache request if the eval causes a Notice to be generated. My PHP 5.6 w/ xdebug 2.5.5 also works fine. I have a CentOS environment with php 7.0.20 w/ xdebug 2.5.5 and a 7.1.8 w/o xdebug and neither exhibit this issue. | ||||
Steps To Reproduce | $ php71 --version $ php71 -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' Without the .= and associated Undefined variable notice $ php71 -r 'error_reporting(E_ALL); $t = "\$arr[0] = \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $ php70 --version $ php70 -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' Again without the notice php70 -r 'error_reporting(E_ALL); $t = "\$arr[0] = \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' | ||||
Additional Information | phpinfo() System => Darwin dwilks-mbp-l.intacct.com 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64 PHP API => 20160303 Registered PHP Streams => compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar This program makes use of the Zend Scripting Language Engine: Configuration bcmath BCMath support => enabled Directive => Local Value => Master Value bz2 BZip2 Support => Enabled Core PHP Version => 7.1.16 Directive => Local Value => Master Value ctype ctype functions => enabled date date/time support => enabled Directive => Local Value => Master Value dom DOM/XML => enabled fileinfo fileinfo support => enabled filter Input Validation and Filtering => enabled Directive => Local Value => Master Value hash hash support => enabled MHASH support => Enabled json json support => enabled libxml libXML support => active mysqlnd mysqlnd => enabled mysqlnd statistics => pcre PCRE (Perl Compatible Regular Expressions) Support => enabled Directive => Local Value => Master Value PDO PDO support => enabled Phar Phar: PHP Archive support => enabled Phar based on pear/PHP_Archive, original concept by Davey Shafik. readline Readline Support => enabled Directive => Local Value => Master Value Reflection Reflection => enabled session Session Support => enabled Directive => Local Value => Master Value SimpleXML Simplexml support => enabled SPL SPL support => enabled standard Dynamic Library Support => enabled Directive => Local Value => Master Value tokenizer Tokenizer Support => enabled xdebug xdebug support => enabled Supported protocols Directive => Local Value => Master Value xml XML Support => active xmlreader XMLReader => enabled xmlwriter XMLWriter => enabled zlib ZLib Support => enabled Directive => Local Value => Master Value Additional Modules Module Name Environment Variable => Value PHP Variables Variable => Value $_SERVER['argc'] => 0 PHP License This program is distributed in the hope that it will be useful, If you did not receive a copy of the PHP license, or have any | ||||
Tags | No tags attached. | ||||
Attached Files | xdebug_log_phpstorm_2017_3_4 (2,131 bytes)
Log opened at 2018-05-17 00:10:41 I: Connecting to configured address/port: localhost:9000. I: Connected to client. :-) -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="dbgp://stdin" language="PHP" xdebug:language_version="7.1.16" protocol_version="1.0" appid="30533" idekey="dwilks"><engine version="2.6.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 by Derick Rethans]]></copyright></init> <- feature_set -i 1 -n show_hidden -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response> <- feature_set -i 2 -n max_depth -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response> <- feature_set -i 3 -n max_children -v 100 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response> <- feature_set -i 4 -n extended_properties -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response> <- status -i 5 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="5" status="starting" reason="ok"></response> <- step_into -i 6 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="6" status="stopping" reason="ok"></response> <- eval -i 7 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="7"><error code="5"><message><![CDATA[command is not available]]></message></error></response> Log closed at 2018-05-17 00:10:41 xdebug_log_phpstorm_2018_1_4 (2,882 bytes)
Log opened at 2018-05-17 00:09:17 I: Connecting to configured address/port: localhost:9000. I: Connected to client. :-) -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="dbgp://stdin" language="PHP" xdebug:language_version="7.1.16" protocol_version="1.0" appid="13235" idekey="dwilks"><engine version="2.6.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 by Derick Rethans]]></copyright></init> <- feature_set -i 1 -n show_hidden -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response> <- feature_set -i 2 -n max_depth -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response> <- feature_set -i 3 -n max_children -v 100 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response> <- feature_set -i 4 -n extended_properties -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response> <- feature_set -i 5 -n notify_ok -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response> <- stdout -i 6 -c 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="6" success="1"></response> <- status -i 7 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="7" status="starting" reason="ok"></response> <- step_into -i 8 -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[JGFyclswXSAuPSAiYWJjIjsK]]></stream> -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[Ck5vdGljZTogVW5kZWZpbmVkIHZhcmlhYmxlOiBhcnIgaW4gQ29tbWFuZCBsaW5lIGNvZGUoMSkgOiBldmFsKCknZCBjb2RlIG9uIGxpbmUgMQoKQ2FsbCBTdGFjazoKICAgIDAuMDExMyAgICAgMzc4OTEyICAgMS4ge21haW59KCkgQ29tbWFuZCBsaW5lIGNvZGU6MAogICAgMC4wMTE2ICAgICAzODA1NzYgICAyLiB7bWFpbn0oKSBDb21tYW5kIGxpbmUgY29kZTowCgo=]]></stream> -> <notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" name="error"><xdebug:message filename="Command line code(1) : eval()'d code" lineno="1" type="Notice"><![CDATA[Undefined variable: arr]]></xdebug:message></notify> | ||||
Operating System | |||||
PHP Version | 7.1.15-7.1.19 | ||||
|
I can't reproduce this on Linux: [PHP: 7.1.15-dev ] derick@singlemalt:~ $ php -v [PHP: 7.1.15-dev ] derick@singlemalt:~ $ php -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' Notice: Undefined variable: arr in Command line code(1) : eval()'d code on line 1 Call Stack: Notice: Undefined offset: 0 in Command line code(1) : eval()'d code on line 1 Call Stack: Done Can you attach the output of "php --ri Xdebug" in a file? If you want, you can also try to make a backtrace. For that you need GDB installed, and then you can run: gdb --args php -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' (Using your correct php71/php70 binary, of course). |
|
|
|
Ok, I just pulled php 7.1.16 and xdebug 2.6.0 and built from sources and can't repro either. Looks like a macports build issue. I'll submit a case there and reference this. Thanks |
|
Reported to MacPorts team https://trac.macports.org/ticket/56317 |
|
I've reproduced this in a minimal php 7.1 build on Linux. $ ~/php71/bin/php -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' Notice: Undefined variable: arr in Command line code(1) : eval()'d code on line 1 Call Stack: Segmentation fault What's needed: php.ini A PhpStorm project open and primed to accept incoming debugger connections (telephone icon enabled). Note: PhpStorm doesn't need to debug the script. I have no idea if other debuggers would exhibit the same behavior. [dwilks@dev01 xdebug-2.6.0]$ gdb --args ~/php71/bin/php -r 'error_reporting(E_ALL); $t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' Notice: Undefined variable: arr in Command line code(1) : eval()'d code on line 1 Call Stack: Program received signal SIGSEGV, Segmentation fault. PHP ./configure --prefix=/u02/home/dwilks/php71 \ xdebug /u02/home/dwilks/php71/bin/phpize |
|
Any luck reproducing this? I just ran into this trying to test our our app in php7.2. It took me a few minutes before I noticed the segfault in the apache error log and then traced it down to an eval(). |
|
On the CentOS box I just noticed that this issue does NOT reproduce if PhpStorm 2017.3.4 is running and listening for the debug connection. It does reproduce with 2018.1.4 EAP 181.5087.11 (and earlier versions of 2018.1 - just not sure which ones). I had the same empty default project open listening for debug connections in both cases. This is for both PHP 7.1.16 and 7.2.4. Seems like something that PhpStorm is sending to xdebug that's causing it. I've attached the xdebug_log for both version. Seems like it might be <- feature_set -i 5 -n notify_ok -v 1 |
|
Just had to help out someone else here that had been force-fed an upgrade to xdebug 2.6.0 through MacPorts. He's on PHP 7.0. |
|
This appears to be fixed in 2.6.1-dev (downloaded today 18/Jun/2018) |
|
I can now confirm that this was indeed a bug in Xdebug 2.6.0, and I can reproduce it. I can also confirm that this is fixed in 2.6.1-dev, which I really ought to release very soon. I think this is a duplicate of https://bugs.xdebug.org/view.php?id=1532 |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-04-16 23:45 | dwilks | New Issue | |
2018-04-17 08:45 | derick | Note Added: 0004636 | |
2018-04-17 08:45 | derick | Assigned To | => derick |
2018-04-17 08:45 | derick | Status | new => feedback |
2018-04-17 19:18 | dwilks | Note Added: 0004637 | |
2018-04-17 19:18 | dwilks | Status | feedback => assigned |
2018-04-17 19:19 | dwilks | File Added: php70.xdebug.info | |
2018-04-17 19:19 | dwilks | File Added: php71.xdebug.info | |
2018-04-17 21:31 | dwilks | Note Added: 0004638 | |
2018-04-17 22:19 | dwilks | Note Added: 0004639 | |
2018-04-18 20:11 | dwilks | Note Added: 0004640 | |
2018-04-18 20:12 | dwilks | Note Edited: 0004640 | |
2018-05-16 19:01 | dwilks | Note Added: 0004654 | |
2018-05-17 00:17 | dwilks | Note Added: 0004657 | |
2018-05-17 00:20 | dwilks | File Added: xdebug_log_phpstorm_2017_3_4 | |
2018-05-17 00:21 | dwilks | File Added: xdebug_log_phpstorm_2018_1_4 | |
2018-05-25 21:38 | dwilks | Note Added: 0004659 | |
2018-06-18 19:03 | dwilks | Note Added: 0004673 | |
2018-08-01 09:54 | derick | Note Added: 0004687 | |
2018-08-01 09:54 | derick | Relationship added | duplicate of 0001532 |
2018-08-01 09:54 | derick | Status | assigned => resolved |
2018-08-01 09:54 | derick | Fixed in Version | => 2.6.1 |
2018-08-01 09:54 | derick | Resolution | open => fixed |
2018-08-01 18:55 | derick | Category | Usage problems (Wrong Results) => Remote Debugging |
2020-03-12 16:33 | derick | Category | Remote Debugging => Step Debugging |