php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49499 get and set are not fixed
Submitted: 2009-09-08 11:32 UTC Modified: 2009-09-08 14:41 UTC
From: ies_clan at hotmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.0 OS: Windows XP home
Private report: No CVE-ID: None
 [2009-09-08 11:32 UTC] ies_clan at hotmail dot com
Description:
------------
look @ the code....

Reproduce code:
---------------
<?php

error_reporting(E_ALL);

class newclass {
  private $properties;

  public function &__get($key) {
    echo "get $key<br>";
    return $this->properties[$key];
  }

  public function __set($key, $val) {
    echo "set $key to $val<br>";
    $this->properties[$key] = $val;
  }
}

$c = new newclass;
$c->array['test'] = 'test';

Expected result:
----------------
get array
set array to test

Actual result:
--------------
get array

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-08 14:41 UTC] sjoerd@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The __get() function returns a reference to the array, and this reference is used to change the array.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 13:01:31 2024 UTC