Opened 7 years ago
Closed 7 years ago
#56317 closed defect (invalid)
php71-xdebug @2.6.0_0 trap 6 when executing script which generates a PHP Notice during an eval().
Reported by: | iakoder | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | php71-xdebug |
Description
I thought this might be an xdebug issue so I reported this to https://bugs.xdebug.org/view.php?id=1545 Turns out it's more likely a macports/xdebug/php issue.
The following script when executed in PHP 7.0 or 7.1 w/ xdebug 2.6.0 crashes when executed with MacPorts php70 or php71 with xdebug 2.6.0. Without xdebug it works fine. Using PHP 5.6 w/ xdebug 2.5.5 works fine. Using PHP 7.1.16 + xdebug 2.6.0 built from source works fine.
Crashes
$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";
Doesn't Crash
$t = "\$arr[0] = \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";
Relevant Versions:
macOS High Sierra 10.31.2 XCode 9.3 9E145 MacPorts 2.4.3 php70 @7.0.29_0+libedit php70-xdebug @2.6.0_0 php71 @7.1.16_0+libedit php71-xdebug @2.6.0_0
PHP 7.1.16 + xdebug 2.6.0 crashes
$ php71 --version PHP 7.1.16 (cli) (built: Apr 2 2018 22:57:16) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.16, Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans $ php71 -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; php71(20604,0x7fffb6ad6340) malloc: *** error for object 0x10cd30dbf: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6
A version that doesn't generate notices doesn't fail
$ php71 -r '$t = "\$arr[0] = \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] = "abc"; Done
PHP 7.0.29 w/ xdebug 2.6.0 crashes
$ php70 --version PHP 7.0.29 (cli) (built: Mar 30 2018 05:11:11) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.29, Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans $ php70 -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; php70(20607,0x7fffb6ad6340) malloc: *** error for object 0x10ae81dbf: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6
Version that doesn't generate notices during eval works fine
$ php70 -r '$t = "\$arr[0] = \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] = "abc"; Done
After disabling xdebug everything works fine
$ php71 --version PHP 7.1.16 (cli) (built: Apr 2 2018 22:57:16) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.16, Copyright (c) 1999-2018, by Zend Technologies dwilks-mbp-l:xdebug-2.6.0 dwilks$ $ php71 -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; Done $ php70 --version PHP 7.0.29 (cli) (built: Mar 30 2018 05:11:11) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.29, Copyright (c) 1999-2017, by Zend Technologies $ php70 -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; Done
PHP 5.6 works fine with xdebug 2.5.5
$ php56 --version PHP 5.6.35 (cli) (built: Mar 30 2018 07:58:04) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans $ php56 -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; Done
With PHP 7.1.6 + xdebug 2.6.0 built from source:
$ /usr/local/php71/bin/php --version PHP 7.1.16 (cli) (built: Apr 17 2018 14:04:52) ( NTS DEBUG ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans $ /usr/local/php71/bin/php -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; Done
PHP configuration:
./configure --prefix=/usr/local/php71 \ --enable-debug \ --with-config-file-path=/usr/local/php71/etc \ --with-config-file-scan-dir=/usr/local/php71/etc/conf.d \ --disable-all \ --enable-bcmath \ --enable-ctype \ --enable-dom \ --enable-filter \ --enable-hash \ --enable-json \ --enable-libxml \ --enable-pdo \ --enable-session \ --enable-simplexml \ --enable-tokenizer \ --enable-xml \ --enable-xmlreader \ --enable-xmlwriter \ --with-bz2=/opt/local \ --with-mhash=/opt/local \ --with-pcre-regex=/opt/local \ --with-libxml-dir=/opt/local \ --with-zlib=/opt/local \ --without-pear \ --disable-cgi \ --enable-cli \ --enable-fileinfo \ --enable-phar \ --disable-fpm \ --with-apxs2=/opt/local/bin/apxs make make test sudo make install
xdebug configuration:
/usr/local/php71/bin/phpize ./configure --prefix=/usr/local/php71 --with-php-config=/usr/local/php71/bin/php-config make make test sudo make install sudo bash -c 'echo zend_extension=xdebug.so > /usr/local/php71/etc/conf.d/xdebug.ini' /usr/local/php71/bin/php -i | grep xdebug
Change History (7)
comment:1 Changed 7 years ago by iakoder
Summary: | p71-xdebug @2.6.0_0 trap 6 when executing script which generates a PHP Notice during an eval(). → php71-xdebug @2.6.0_0 trap 6 when executing script which generates a PHP Notice during an eval(). |
---|
comment:2 Changed 7 years ago by Schamschula (Marius Schamschula)
Owner: | set to ryandesign |
---|---|
Status: | new → assigned |
comment:3 Changed 7 years ago by Schamschula (Marius Schamschula)
Port: | php71-xdebug added |
---|
comment:4 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
comment:5 Changed 7 years ago by iakoder
I thought this might be an xdebug issue so I reported this to https://bugs.xdebug.org/view.php?id=1545 Turns out it's more likely a macports/xdebug/php issue.
If you can explain in what way this is our issue and what we need to do to fix it, I'm happy to do so.
I don't know that it is a MacPorts problem. I only know that it only happens when I use MacPorts php70+php70-xdebug or php71+php71-xdebug. It doesn't happen when I use my own compiled-from-source php71+xdebug with matching versions of MacPorts php71. Derick, the xdebug author, couldn't reproduce it on his Linux system.
I'm more than willing to help narrow it down if I can.
comment:6 Changed 7 years ago by iakoder
Apologies. My php.ini was slightly different between macports in /opt/local/etc/php71 and built-from-scratch /usr/local/php71/etc. Copied macports into /usr/local and boom. Back to Derick.
Feel free to close, reject, whatever.
$ /usr/local/php71/bin/php -r '$t = "\$arr[0] .= \"abc\";"; echo "$t\n"; eval($t); echo "Done\n";' $arr[0] .= "abc"; php(30348,0x7fffb6ad6340) malloc: *** error for object 0x10ecaa1ec: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6
comment:7 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Replying to iakoder:
If you can explain in what way this is our issue and what we need to do to fix it, I'm happy to do so.