#45851 [Opn->Asn]: mysqli_fetch_object should detect empty column names

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45851
 Updated by:       [email protected]
 Reported By:      peterbelm at gmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         MySQLi related
 Operating System: *
 PHP Version:      5.2.6
-Assigned To:      
+Assigned To:      mysql


Previous Comments:
------------------------------------------------------------------------

[2008-08-18 14:18:00] peterbelm at gmail dot com

Description:
------------
If a column is select with an empty name like so:

SELECT id as ``...

You get a fatal error "Cannot access empty property". Looking through
the Zend code I found it happens when looking up property info.
Shouldn't mysqli check for empty property names when creating the
object, triggering it's own (more useful) error?

Reproduce code:
---------------
$link = mysqli_connect($host, $user, $pass);
mysqli_select_db($schema);
$result = mysqli_query("select 'test' as ``", $link);
$obj = mysqli_fetch_object($result);

Expected result:
----------------
A fatal error along the lines of "Empty column name in SQL"

Actual result:
--------------
Fatal error: "Cannot access empty property"

Generated from Zend/zend_object_handlers.c:188


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45851&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.