On Sun, 2008-01-06 at 19:18 +0200, Giedrius D wrote: > On Jan 6, 2008 5:55 PM, Sam Barrow <[EMAIL PROTECTED]> wrote: > > As I said, this patch is not intended for stuff like $_GET, $_POST, > > database data, etc. It is intended for internal functions to your > > application. > > > > function requireFile(string $file, bool $getOutput = false, array $args > > = array()) > > { > > $obLevel = ob_get_level() ; > > > > ob_start() ; > > > > $return = require_once($file) ; > > > > if ($getOutput) > > { > > $return = ob_get_clean() ; > > } > > else > > { > > if ($_mod['base']['output']['strict'] and > > ob_get_length() > 0) > > { > > ::error::go('Output > > generated in file "' . $file . '".') ; > > } > > > > ob_end_clean() ; > > } > > > > if ($obLevel !== ob_get_level()) > > { > > ::error::go('Output buffering level > > mismatch after inclusion of file > > "' . $file . '".') ; > > } > > > > return $return ; > > } > > > > This function will not be called using input data. > > I have been watching type hinting for a while now and one thing I > don't understand: hows my object of class lets say FileName that > implements __toString() is wrong parameter for your requireFile()?
No problem. My patch does not have the functionality to detect the __toString method, but this could be implemented in the future. > Why should I every time calling a function cast variables manually when it > can be perfectly done by PHP automatically? Well type hinting should be used in places where casting is not necessary. You won't have to cast variables unless you specifically make them of the wrong data type, for example $number = "5", or if using form input. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php