# foreach() broken

- Thread: https://externals.io/message/4467
- Original archive: https://news-web.php.net/php.internals/4467
- Started by Sebastian Bergmann on 2003-09-14T08:54:47+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4467 — Sebastian Bergmann — 2003-09-14T08:54:47+00:00

URL: https://externals.io/message/4467#4467

1 <?php
    2 class Foo {}
    3
    4 class Bar {
    5   protected $foo = array();
    6
    7   public function __construct() {
    8     $this->foo = array(new Foo, new Foo);
    9     foreach ($foo as $bar) {}
   10   }
   11 }
   12
   13 new Bar;
   14 ?>

   Warning: Invalid argument supplied for foreach()
   in E:\test.php on line 9

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
