Bug #70033 [NEW]: segfault while running tests in phpunit
| From: | kolesnikov dot p at hotmail dot com | Date: | Thu, 09 Jul 2015 07:56:05 +0000 |
| Subject: | Bug #70033 [NEW]: segfault while running tests in phpunit | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194241@lists.php.net to get a copy of this message | ||
From: kolesnikov dot p at hotmail dot com
Operating system: Ubuntu 14.04
PHP version: 7.0Git-2015-07-09 (Git)
Package: Reproducible crash
Bug Type: Bug
Bug description:segfault while running tests in phpunit
Description:
------------
Test script below runs fine on PHP 5.5.9 and produces segfault on PHP 7
compiled from latest git with following config:
'./configure' '--prefix=/home/dev/php7/usr' '--with-apxs2'
'--with-xsl=/usr/lib/x86_64-linux-gnu/' '--with-curl'
'--enable-memcached' '--disable-memcached-sasl' '--with-tidy'
'--with-mcrypt' '--with-gd' '--enable-intl' '--enable-zip'
'--enable-soap' '--with-mysql-sock=/var/lib/mysql/mysql.sock'
'--enable-sockets' '--with-mysqli' '--with-openssl'
'--enable-opcache'
'--with-zlib'
PHPUnit version 4.7.6
To reproduce segfault its necessary to run both tests from test class:
phpunit saboteurTest.php
If any of tests is skipped like:
phpunit --filter testException saboteurTest.php
phpunit will finish test execution successfully.
Test script:
---------------
class saboteurTest extends TestCase {
function testException() {
$controllers = array(new saboteurTestController());
foreach ($controllers as $controller) {
try {
if ($controller->isConsistent()) return $controller;
} catch (\Exception $e) {}
}
}
function testAny() {
$this->assertTrue(true);
}
}
class saboteurTestController {
public function isConsistent() { throw new \Exception(); }
}
Expected result:
----------------
PHPUnit 4.7.6 by Sebastian Bergmann and contributors.
..
Time: 220 ms, Memory: 8.00Mb
OK (2 tests, 1 assertion)
Actual result:
--------------
PHPUnit 4.7.6 by Sebastian Bergmann and contributors.
.Segmentation fault (core dumped)
(gdb) bt
#0 zend_mm_alloc_small (size=56, bin_num=6, heap=0x7f7f40e00040) at
/home/dev/php-src/Zend/zend_alloc.c:1244
#1 _emalloc_56 () at /home/dev/php-src/Zend/zend_alloc.c:2132
#2 0x00000000007f5c70 in _array_init (arg=arg@entry=0x7f7f405c77c0,
size=1) at /home/dev/php-src/Zend/zend_API.c:1087
#3 0x000000000073ec72 in php_var_unserialize_ex
(rval=rval@entry=0x7f7f405c77c0, p=p@entry=0x7ffff2c57588,
max=max@entry=0x7f7f405ba4de "",
var_hash=var_hash@entry=0x7ffff2c57590, classes=classes@entry=0x0) at
ext/standard/var_unserializer.re:704
#4 0x000000000073ed33 in process_nested_data (rval=0x7f7f40529380,
objprops=0, elements=0, ht=0x7f7f40529380,
classes=0x0, var_hash=0x7ffff2c57590, max=0x7f7f405ba4de "",
p=0x7ffff2c57588) at ext/standard/var_unserializer.re:395
#5 php_var_unserialize_ex (rval=rval@entry=0x7f7f40590338,
p=p@entry=0x7ffff2c57588, max=max@entry=0x7f7f405ba4de "",
var_hash=var_hash@entry=0x7ffff2c57590, classes=classes@entry=0x0)
at ext/standard/var_unserializer.re:709
#6 0x00000000004434b0 in process_nested_data (rval=0x7f7f405d0780,
objprops=1, elements=0, ht=0x7f7f4058cb28, classes=0x0,
var_hash=0x7ffff2c57590, max=0x7f7f405ba4de "", p=0x7ffff2c57588) at
ext/standard/var_unserializer.re:395
#7 object_common2 (rval=0x7f7f405d0780, p=0x7ffff2c57588,
max=0x7f7f405ba4de "", var_hash=0x7ffff2c57590, classes=0x0,
elements=<optimized out>) at ext/standard/var_unserializer.re:479
#8 0x000000000073f0a2 in php_var_unserialize_ex
(rval=rval@entry=0x7f7f405d0780, p=p@entry=0x7ffff2c57588,
max=max@entry=0x7f7f405ba4de "",
var_hash=var_hash@entry=0x7ffff2c57590, classes=classes@entry=0x0) at
ext/standard/var_unserializer.re:720
#9 0x000000000073ed33 in process_nested_data (rval=0x7f7f4058ce00,
objprops=0, elements=5, ht=0x7f7f4058ce00, classes=0x0,
var_hash=0x7ffff2c57590, max=0x7f7f405ba4de "", p=0x7ffff2c57588) at
ext/standard/var_unserializer.re:395
#10 php_var_unserialize_ex (rval=rval@entry=0x7f7f4057d628,
p=p@entry=0x7ffff2c57588, max=max@entry=0x7f7f405ba4de "",
var_hash=var_hash@entry=0x7ffff2c57590, classes=classes@entry=0x0)
at ext/standard/var_unserializer.re:709
#11 0x00000000004434b0 in process_nested_data (rval=0x7f7f40e18450,
objprops=1, elements=19, ht=0x7f7f4058ce38, classes=0x0,
var_hash=0x7ffff2c57590, max=0x7f7f405ba4de "", p=0x7ffff2c57588) at
ext/standard/var_unserializer.re:395
#12 object_common2 (rval=0x7f7f40e18450, p=0x7ffff2c57588,
max=0x7f7f405ba4de "", var_hash=0x7ffff2c57590, classes=0x0,
elements=<optimized out>) at ext/standard/var_unserializer.re:479
#13 0x000000000073f0a2 in php_var_unserialize_ex
(rval=rval@entry=0x7f7f40e18450, p=p@entry=0x7ffff2c57588,
max=0x7f7f405ba4de "",
var_hash=var_hash@entry=0x7ffff2c57590, classes=classes@entry=0x0)
at ext/standard/var_unserializer.re:720
#14 0x000000000073111d in zif_unserialize (execute_data=<optimized out>,
return_value=0x7f7f40e18450) at
/home/dev/php-src/ext/standard/var.c:1037
#15 0x0000000000878936 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER () at
/home/dev/php-src/Zend/zend_vm_execute.h:706
#16 0x00000000008302eb in execute_ex (ex=<optimized out>) at
/home/dev/php-src/Zend/zend_vm_execute.h:406
#17 0x000000000087c6cc in zend_execute
(op_array=op_array@entry=0x7f7f40e80000,
return_value=return_value@entry=0x0) at
/home/dev/php-src/Zend/zend_vm_execute.h:450
#18 0x00000000007f37de in zend_execute_scripts (type=type@entry=8,
retval=retval@entry=0x0, file_count=file_count@entry=3) at
/home/dev/php-src/Zend/zend.c:1396
#19 0x0000000000795090 in php_execute_script
(primary_file=primary_file@entry=0x7ffff2c59ae0) at
/home/dev/php-src/main/main.c:2475
#20 0x000000000087def3 in do_cli (argc=3, argv=0x2c06a50) at
/home/dev/php-src/sapi/cli/php_cli.c:971
#21 0x0000000000448150 in main (argc=3, argv=0x2c06a50) at
/home/dev/php-src/sapi/cli/php_cli.c:1338
--
Edit bug report at https://bugs.php.net/bug.php?id=70033&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70033&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70033&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70033&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70033&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70033&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70033&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70033&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70033&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70033&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70033&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70033&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70033&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70033&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70033&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70033&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70033&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70033&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70033&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70033&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70033&r=mysqlcfg