php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26336 mysql_list_dbs() returns all databases regardless of permissions
Submitted: 2003-11-20 19:18 UTC Modified: 2003-11-20 19:24 UTC
From: r3n at r3n dot net Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.4 OS: Redhat Linux
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: r3n at r3n dot net
New email:
PHP Version: OS:

 

 [2003-11-20 19:18 UTC] r3n at r3n dot net
Description:
------------
Regardless of the mysql user privelages, mysql_list_dbs() is returning every single database on the server.

Reproduce code:
---------------
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$db_list = mysql_list_dbs($link);

while ($row = mysql_fetch_object($db_list)) {
    echo $row->Database . "\n";
}
?>


Expected result:
----------------
List of databases which the user has access to.

Actual result:
--------------
Every database on the server is being returned.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-20 19:24 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

First of all this is not a bug, the fact you see the databases does not mean you can use them.
If it were a bug, which is it is not, then it would be a MySQL bug and not a PHP one.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Mar 15 13:00:01 2026 UTC