php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43742 mysql_field_name does not return FALSE on error
Submitted: 2008-01-03 21:09 UTC Modified: 2008-01-07 15:02 UTC
From: mo at modejong dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.5 OS: WinXP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mo at modejong dot com
New email:
PHP Version: OS:

 

 [2008-01-03 21:09 UTC] mo at modejong dot com
Description:
------------
The mysql_field_name API should return FALSE on errror,
that is what the docs state, but the impl returns NULL.

Here is what the current code returns:

mysql_field_name($res):
Warning: Wrong parameter count for mysql_field_name() in C:\caucho_dev\trunk\qa\php\f.qa on line 11
NULL

Reproduce code:
---------------
<php out='stdout'>
<?php

mysql_connect("localhost", "", "");
mysql_query("USE test");
$res = mysql_query("SELECT * FROM test WHERE id = 1");

echo 'mysql_field_name($res): ';
var_dump(mysql_field_name($res));

?>
</php>

Expected result:
----------------
Should return FALSE.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-07 15:02 UTC] iliaa@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

When functions receive invalid number of parameters they raise an error 
and return NULL, that's a typically PHP behavior. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC