Bug #62633 [Opn]: strcasecmp does not warn user if both params are not strings
| From: | iam4webwork at hotmail dot com | Date: | Sun, 22 Jul 2012 21:23:23 +0000 |
| Subject: | Bug #62633 [Opn]: strcasecmp does not warn user if both params are not strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172156@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62633&edit=1
ID: 62633
User updated by: iam4webwork at hotmail dot com
Reported by: iam4webwork at hotmail dot com
Summary: strcasecmp does not warn user if both params are not
strings
Status: Open
Type: Bug
Package: Scripting Engine problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I believe that somewhere the underlying C source code is converting the PHP TRUE,
i.e. 1 to "1"
Previous Comments:
------------------------------------------------------------------------
[2012-07-22 21:19:42] iam4webwork at hotmail dot com
Description:
------------
When I provide strcasecmp with two parameters where one is TRUE and the other is a
string, php does not generate a warning to say that the first parameter needs to
be a string and silently converts TRUE to "1" and executes.
Test script:
---------------
<?php
var_dump(strcasecmp(TRUE, "bob"));
// -49
Expected result:
----------------
I expected a parser error message.
Actual result:
--------------
-49
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62633&edit=1