#30419 [Opn->Csd]: strpos does not autocast integer needles
| From: | aidan@php.net | Date: | Wed, 13 Oct 2004 11:38:29 +0000 |
| Subject: | #30419 [Opn->Csd]: strpos does not autocast integer needles | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969364523@lists.php.net to get a copy of this message | ||
ID: 30419
Updated by: aidan@php.net
Reported By: m dot konings at knowmany dot nl
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows XP SP2
PHP Version: 4.3.8
New Comment:
All fixed!
Previous Comments:
------------------------------------------------------------------------
[2004-10-13 13:26:39] derick@php.net
True, but it should be done here becuase it makes the function behave
in two TOTALLY different ways.
------------------------------------------------------------------------
[2004-10-13 13:23:47] aidan@php.net
I'm not sure I agree with that. Almost all the functions take scalar
values, but the prefered (or optimal) is listed.
PHP is loosely typed, I can't think of many situations were "1" instead
of 1 will not work as expected (there are a few of course), I don't
think these declarations should be changed to mixed either.
------------------------------------------------------------------------
[2004-10-13 09:59:27] derick@php.net
I agree with that, making it a documentation problem.
------------------------------------------------------------------------
[2004-10-13 09:30:33] m dot konings at knowmany dot nl
Thanks for the explanation. Although I feel that in this case the
documenation should reflect that strpos() takes a mixed needle variable
type, not a string. There are lots of other PHP functions that take
mixed variable types as parameter, and for those, the manual states so
in the function declaration.
------------------------------------------------------------------------
[2004-10-13 09:24:24] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
See the manual (http://php.net/strpos):
If needle is not a string, it is converted to an integer
and applied as the ordinal value of a character.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30419
--
Edit this bug report at http://bugs.php.net/?id=30419&edit=1