ID:               35470
 User updated by:  prgallier at yahoo dot com
 Reported By:      prgallier at yahoo dot com
 Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5CVS-2005-11-29 (cvs)
 Assigned To:      dmitry
 New Comment:

Tested and working great here.  Kudos to Dmitry!


Previous Comments:
------------------------------------------------------------------------

[2005-11-30 11:10:53] [EMAIL PROTECTED]

Fixed in CVS HEAD and PHP_5_1.

------------------------------------------------------------------------

[2005-11-29 20:11:25] [EMAIL PROTECTED]

<?php
function dotest()
{
    $array = array(array("test", "blah"),array("test", "blah"));
    $i = 0;
      while ($row = $array[$i++])
      {
          global ${$row[0]};
          ${$row[0]} = $row[1];
      }
}

dotest();
?>

Valgrind shows several errors:
==3742== Invalid read of size 4
==3742==    at 0x823AAEA: zend_fetch_dimension_address
(zend_execute.c:1092)
==3742==    by 0x826DEE0: ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER
(zend_vm_execute.h:20390)
==3742==    by 0x823B348: execute (zend_vm_execute.h:88)
==3742==    by 0x823B7A9: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:222)
==3742==    by 0x823E294: ZEND_DO_FCALL_SPEC_CONST_HANDLER
(zend_vm_execute.h:1578)
==3742==    by 0x823B348: execute (zend_vm_execute.h:88)
==3742==    by 0x8214E75: zend_execute_scripts (zend.c:1090)
==3742==    by 0x81D43AD: php_execute_script (main.c:1704)
==3742==    by 0x828025D: main (php_cli.c:1039)

etc.

------------------------------------------------------------------------

[2005-11-29 19:58:50] prgallier at yahoo dot com

The following generates a segfault on my system:

function dotest()
{
  $link = mysql_connect("localhost","test","test");
  mysql_select_db("test");
  mysql_query("CREATE TABLE config (num smallint(5) unsigned NOT NULL
auto_increment, conf varchar(20) NOT NULL default '')");
  mysql_query("INSERT INTO config (conf,type) VALUES('Test1','33')");
  $result = mysql_query("SELECT conf,value FROM config");
  while ($row = mysql_fetch_row($result))
  {
    global ${$row[0]};
    ${$row[0]} = $row[1];
  }
  mysql_free_result($result);
}

dotest();
echo "Test: $test<br>\n";

------------------------------------------------------------------------

[2005-11-29 13:09:49] [EMAIL PROTECTED]

Dmitry, can you check this out please.

------------------------------------------------------------------------

[2005-11-29 11:33:26] prgallier at yahoo dot com

Oops...the expected and actual result fields are switched.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/35470

-- 
Edit this bug report at http://bugs.php.net/?id=35470&edit=1

Reply via email to