php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26059 Call to __set() crashes when setting array element
Submitted: 2003-10-31 12:41 UTC Modified: 2004-02-15 19:07 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: myle34 at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-02-10 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: myle34 at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-10-31 12:41 UTC] myle34 at hotmail dot com
Description:
------------
I am using PHP5-b2 and Apache 2.0.47 with Windows XP. Apache crashes when the below code is run.

Reproduce code:
---------------
class Foo {
    private $bar = array();
    function __get($var) {
        return(isset($this->bar[$var]) ? $this->bar[$var] : NULL);
    }
    function __set($var,$val) {
        $this->bar[$var] = $val;
    }
}

$foo = new Foo();

// Works
// $foo->test = array('testing'=>'testing, 1...2...3...');

// Doesn't work, crashes Apache
$foo->test = array();
$foo->test['testing'] = 'testing, 1...2...3...';

print_r($foo->test);

Expected result:
----------------
Array
(
    [testing] => testing, 1...2...3...
)

Actual result:
--------------
Apache crashes! No output.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-15 19:07 UTC] helly@php.net
Thie script is no longer possible since it produces a fatal error. The problem here was accessing an indexed  value through a virtual property of type array. This is now no longer possible, you may want to use array overloading instead.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 19:01:28 2024 UTC