|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-06-08 15:07 UTC] nick dot telford at gmail dot com
[2005-06-08 17:22 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 18:00:01 2025 UTC |
Description: ------------ Typecasting an object with a __toString() function returns the string 'Object' and doesn't run __toString(). Reproduce code: --------------- <?php class Foobar { .....public function __toString () .....{ ..........echo '__toString() was run.', "\n"; ..........return ('./includes/foobar.php'); .....} } $foobar = new Foobar (); require ((string) $foobar); ?> Expected result: ---------------- __toString() was run. require ('./includes/foobar.php'); Actual result: -------------- require ('Object');