php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27902 array manipulation and references segfaults php
Submitted: 2004-04-07 06:47 UTC Modified: 2004-04-07 08:35 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mvali at urania dot ee Assigned:
Status: Wont fix Package: Reproducible crash
PHP Version: 4.3.6RC1 OS: Red Hat 8, Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
12 + 6 = ?
Subscribe to this entry?

 
 [2004-04-07 06:47 UTC] mvali at urania dot ee
Description:
------------
This is testded with 4.2.1, 4.3.4 and 4.3.6RC2, the script
produces a segfault. 
PHP is compiled with-apxs2 or with apache 1.3 with no
special parameters to ./configure.
The script produces segfaults both on console
php interpretator or when loaded with apache server.

Reproduce code:
---------------
<?php
class AClass {
  function AClass($v) {$this->v = $v;}
  function func() {return $this->v;}
}
function & func($mall) {
  if (is_array($mall))
    return array ("b" => func($mall["b"]));  
  else
    return $mall->func();
}
function random($staatus="OK\n") {
  $a1 = array();
  $a2 = func(array("b" => new AClass($staatus)));
  $a1 = array(array_merge(array(), $a2));
  $important = 0;
  return array_values($a1);
}
$out = random();
echo $out[0]["b"];
?>

Expected result:
----------------
It should print 'OK'

Actual result:
--------------
echo receives a segfault.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-07 08:35 UTC] sniper@php.net
Works fine with PHP5, won't fix in PHP 4 (just leaks for me in it).

(Hint: Don't do this. :)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 09:01:28 2024 UTC