php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39990 Cannot "foreach" over overloaded properties
Submitted: 2006-12-30 08:11 UTC Modified: 2007-01-10 16:01 UTC
From: michael dot walter at gmail dot com Assigned: dmitry
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID:
 [2006-12-30 08:11 UTC] michael dot walter at gmail dot com
Description:
------------
This is using PHP 5.2.1 RC 1 (the one Edin posted to PHP-DEV recently).

Reproduce code:
---------------
<?php
  class Klass
  {
    public function __get($name_)
    {
      return array('Hello', 'World');    
    }
  };
  
  $obj=new Klass();
  foreach($obj->arr as $value)
    echo $value;
?>


Expected result:
----------------
HelloWorld

Actual result:
--------------
PHP Notice:  Indirect modification of overloaded property Klass::$arr has no effect in test.php on line 11

Notice: Indirect modification of overloaded property Klass::$arr has no effect in test.php on line 11
HelloWorld

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-10 16:01 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 12:01:52 2014 UTC