Bug #52360 [Bgs->Ver]: Strval documentation is unclear on whether it works on objects
| From: | degeberg@php.net | Date: | Fri, 16 Jul 2010 12:21:31 +0000 |
| Subject: | Bug #52360 [Bgs->Ver]: Strval documentation is unclear on whether it works on objects | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4700@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52360&edit=1
ID: 52360
Updated by: degeberg@php.net
Reported by: sjoerd-php at linuxonly dot nl
Summary: Strval documentation is unclear on whether it works on
objects
-Status: Bogus
+Status: Verified
Type: Bug
Package: Documentation problem
PHP Version: Irrelevant
New Comment:
It isn't bogus. The example contradicts the parameter description. It
can take objects iff they implement the __toString() method.
Previous Comments:
------------------------------------------------------------------------
[2010-07-16 14:16:05] rquadling@php.net
Please explain what else needs to be said in the Parameters section
regarding the $var parameter which currently reads:
"The variable that is being converted to a string.
var may be any scalar type. You cannot use strval() on arrays or
objects."
Clearly, new StrValTest which returns an object of class StrValTest, is
an object and can't be used by strval().
------------------------------------------------------------------------
[2010-07-16 14:01:36] sjoerd-php at linuxonly dot nl
Description:
------------
Strval documentation is unclear on whether it works on objects.
Parameter documentation for val:
var may be any scalar type. You cannot use strval() on arrays or
objects.
Example #1:
echo strval(new StrValTest);
Does not compute.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52360&edit=1