View Issue Details

IDProjectCategoryView StatusLast Update
0000701XdebugUncategorizedpublic2017-04-10 19:50
Reporterrusk Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformUNIXOSUbuntu LinuxOS Version10.10
Product Version2.1.0 
Fixed in Version2.5.2 
Summary0000701: Functions as array indexes.
Description

php with xdebug stops script without any error messages even in server logs when you use function return value as array index. It affects some big commercial frameworks that make xdebug unusable...

Steps To Reproduce

$array = array();
$array[strpos('apple','apple')] = apple;

Additional Information

Usage functions as array indexes is allowed in official PHP documentation.

TagsNo tags attached.
Operating System2.6.32-30-generic 0000059-Ubuntu i686 GNU/Linux
PHP Version5.3.6

Activities

derick

2011-07-16 14:44

administrator   ~0001762

This script works just fine for me. Can you:

  • upgrade to Xdebug 2.1.1

And then explain exactly when you get this problem.

  • What are you doing?
  • What is the command line?
  • What are the PHP.ini settings for Xdebug (only)... etc.

rusk

2011-07-26 15:02

reporter   ~0001764

The exact code from Expression Engine:

<?php
class EE_Functions {
var $action_ids = array();
function fetch_action_id($class, $method)
{
if ($class == '' OR $method == '')
{
return FALSE;
}

    $this->action_ids[ucfirst($class)][$method] = $method;

    return 'AID:'.ucfirst($class).':'.$method.RD;
}

}
$obj = new EE_Functions;
echo $obj->fetch_action_id("class", "method");

?>

This code works on production server without xdebug. On my local enviroinment it dies without any messages even in log on the line $this->action_ids[ucfirst($class)][$method] = $method;

If I assign ucfirst($class) to a variable and use that variable as array index it works fine.

xdebug settings are:

xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=off
xdebug.remote_mode=req
xdebug.show_mem_delta=On
xdebug.auto_trace=On
xdebug.collect_assignments=On
xdebug.profiler_enable=On
xdebug.show_exception_trace=On
xdebug.show_local_vars=On
xdebug.overload_var_dump=On
xdebug.show_local_vars=1
html_errors=On
xdebug.max_nesting_level = 5000

derick

2011-07-28 08:15

administrator   ~0001766

I do not get a crash here, but I do see memory reading errors with valgrind.

derick

2012-04-03 15:42

administrator   ~0002027

I've fixed the crash for Xdebug 2.2.0, but the real fix will have to wait.

derick

2016-11-28 15:45

administrator   ~0003803

Right now, we print ???, but we need to see whether we can figure out the actual value.