php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31967 mysql_fetch_field() reports weird table names on SHOW queries
Submitted: 2005-02-14 11:40 UTC Modified: 2005-02-15 17:38 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: me at derrabus dot de Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.3 OS: Linux 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: me at derrabus dot de
New email:
PHP Version: OS:

 

 [2005-02-14 11:40 UTC] me at derrabus dot de
Description:
------------
I am running php 5.0.3 and MySQL 5.0.2 on my machine. The MySQL extension is compiled against a MySQL 5.0.2 client library.

The code below returns weird table names (like #sql_f85_0) although the query should not affect any tables. So far, I could reproduce the problem with "SHOW TABLES" and "SHOW TABLE STATUS".

If I do the same on my other machine (php 5.0.3, MySQL server & client API 4.0.22), the returned table name is empty (as it should, imho).

I don't know if this is a bug of the MySQL extension or MySQL's C API, but since I cannot debug the C API right now, I'm posting this here.

Reproduce code:
---------------
<pre>
<?php

$dbh = mysql_connect('localhost', 'user', 'password');
mysql_select_db('test'); // this should be an existing DB with at least one table.
$res = mysql_query('SHOW TABLES;', $dbh);

$field = mysql_fetch_field($res);
print_r($field);

mysql_free_result($res);
mysql_close($dbh);

?>
</pre>

Expected result:
----------------
[table] should be empty.

Actual result:
--------------
stdClass Object
(
    [name] => Tables_in_test
    [table] => #sql_f85_0
    [def] => 
    [max_length] => 2
    [not_null] => 1
    [primary_key] => 0
    [multiple_key] => 0
    [unique_key] => 0
    [numeric] => 0
    [blob] => 0
    [type] => string
    [unsigned] => 0
    [zerofill] => 0
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-15 17:38 UTC] me at derrabus dot de
As I figured out, it's not a php problem. I could reproduce this with MySQL's C API, too.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 04:01:27 2024 UTC