[MacPorts] #56317: p71-xdebug @2.6.0_0 trap 6 when executing script which generates a PHP Notice during an eval().

MacPorts noreply at macports.org
Tue Apr 17 21:57:08 UTC 2018


#56317: p71-xdebug @2.6.0_0 trap 6 when executing script which generates a PHP
Notice during an eval().
---------------------+--------------------
 Reporter:  iakoder  |      Owner:  (none)
     Type:  defect   |     Status:  new
 Priority:  Normal   |  Milestone:
Component:  ports    |    Version:
 Keywords:           |       Port:
---------------------+--------------------
 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
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/56317>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list