At 03:46 AM 9/4/2004 +0000, Curt Zirzow wrote:
* Thus wrote Andi Gutmans:
> It probably makes sense to add SEPARATE_ZVAL_IF_NOT_REF() to that code.
> This would provide the same behavior as for example for long's.
> Can you please check out the following patch?

Nice! That fixed the $file holding the value between iterations

Test 1: ($file now is reset on iteration)
  <?php
  foreach (new DirectoryIterator('.') as $file) {
    echo "\n--\n";
    var_dump($file);
    preg_match("/xxx/", $file);
    var_dump($file);
    echo "--";
  }
--
object(DirectoryIterator)#1 (0) {
}
string(1) "."
--
--
object(DirectoryIterator)#1 (0) {
}
string(2) ".."
--


What are the possibilities of thrown E_STRICT or E_WARNING, since the object gets lost? Or should this simply be a documented behaviour? If possible, any pointers where to consider applying them at?

Didn't quite understand. Why does the object get lost after my fix?

>From what I've seen there are a lot of convert_to_xxx_ex()'s around
and can cause a some of unexpected results, without some sort of
notice.  Of course ideally, an attempt to fetch a __toString()
value would be really nice :)  I'm way over my head at this point.

convert_to_xx_ex() does not destroy any values (except if they are by reference).


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to