1--TEST-- 2SPL: Problem with casting to string 3--SKIPIF-- 4<?php 5if (!defined('GLOB_ERR')) print "skip"; 6?> 7--FILE-- 8<?php 9$d = new DirectoryIterator('.'); 10var_dump($d); 11var_dump(is_string($d)); 12preg_match('/x/', $d); 13var_dump(is_string($d)); 14?> 15--EXPECTF-- 16object(DirectoryIterator)#%d (4) { 17 %s"pathName"%s"SplFileInfo":private]=> 18 %s(%d) ".%c%s" 19 %s"fileName"%s"SplFileInfo":private]=> 20 %s(%d) "%s" 21 %s"glob"%s"DirectoryIterator":private]=> 22 bool(false) 23 %s"subPathName"%s"RecursiveDirectoryIterator":private]=> 24 %s(0) "" 25} 26bool(false) 27bool(false) 28