MeltwaterArchive/storyplayer

PHP Segfault

mheap opened this issue · 2 comments

When running a simple test I noticed that PHP was segfaulting. I tracked it down to the following code:

In UsingRuntimeTable::remoteItem:

This segfaults:

$log->addStep("table '{$tableName}' is empty, removing from runtime config", function() use ($tables, $tableName){
      unset($tables->$tableName);
});

This works:

$r = array($tables, $tableName);
$log->addStep("table '{$tableName}' is empty, removing from runtime config", function() use ($r){
      list($tables, $tableName) = $r;
      unset($tables->$tableName);
});

It's not related to $tables and $tableName as the following code fails too:

$a = 1;
$b = 2;
$log->addStep("table '{$tableName}' is empty, removing from runtime config", function() use ($a, $b){
      unset($tables->$tableName);
});
$ php --version
PHP 5.5.12-2ubuntu4.4 (cli) (built: Apr 17 2015 11:47:44) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans

@mheap: Which version of PHP on which operating system, please? And which release of Storyplayer?

$ cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.10
DISTRIB_CODENAME=utopic
DISTRIB_DESCRIPTION="Ubuntu 14.10"
NAME="Ubuntu"
VERSION="14.10 (Utopic Unicorn)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.10"
VERSION_ID="14.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
$ php --version
PHP 5.5.12-2ubuntu4.4 (cli) (built: Apr 17 2015 11:47:44) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans