#43875 [Opn->Csd]: Two error messages returned for $new and $flag argument in mysql_connect()
| From: | bjori@php.net | Date: | Sun, 20 Jan 2008 14:14:45 +0000 |
| Subject: | #43875 [Opn->Csd]: Two error messages returned for $new and $flag argument in mysql_connect() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121415@lists.php.net to get a copy of this message | ||
ID: 43875
Updated by: bjori@php.net
Reported By: josmessa at uk dot ibm dot com
-Status: Open
+Status: Closed
Bug Type: MySQL related
Operating System: Windows XP
PHP Version: 5.2CVS-2008-01-17 (snap)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-01-17 10:50:30] josmessa at uk dot ibm dot com
Description:
------------
In the latest snapshot of PHP (this behaviour is *not* in PHP 5.2.5)
there appears to be a stricter check on what can be passed as the $new
and $flag argument in mysql_connect. If the wrong type of argument is
passed then two error messages are returned. The first says that the
parameter should be long, the second is a warning that the there is the
wrong parameter count in mysql_connect(). I believe that this second
error message is a bug as a) it contradicts the previous error message
and b) it does not say what the correct parameter count is as it usually
does with this type of error message.
Reproduce code:
---------------
<?php
$new = '';
$flag = 'string';
var_dump(mysql_connect('localhost', 'root', '', $new));
var_dump(mysql_connect('localhost', 'root', '', false, $flag));
?>
Expected result:
----------------
Warning: mysql_connect() expects parameter 4 to be long, string given
in ...\mysql_connect.php on line 4
NULL
Warning: mysql_connect() expects parameter 5 to be long, string given
in ...\mysql_connect.php on line 5
NULL
Actual result:
--------------
Warning: mysql_connect() expects parameter 4 to be long, string given
in C:\Josie\Workspace\Bugs\mysql\mysql_connect.php on line 4
Warning: Wrong parameter count for mysql_connect() in
C:\Josie\Workspace\Bugs\mysql\mysql_connect.php on line 4
NULL
Warning: mysql_connect() expects parameter 5 to be long, string given
in C:\Josie\Workspace\Bugs\mysql\mysql_connect.php on line 5
Warning: Wrong parameter count for mysql_connect() in
C:\Josie\Workspace\Bugs\mysql\mysql_connect.php on line 5
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43875&edit=1