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 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 01:01:27 2024 UTC