php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47755 get_resource_type() returns bool false on valid resource
Submitted: 2009-03-23 19:23 UTC Modified: 2009-03-23 21:03 UTC
From: jbricci at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.9 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jbricci at gmail dot com
New email:
PHP Version: OS:

 

 [2009-03-23 19:23 UTC] jbricci at gmail dot com
Description:
------------
get_resource_type() returns bool false on a valid resource handle.

Reproduce code:
---------------
<?php

$host = 'localhost';
$user = 'user';
$pass = 'pass';
$dbpn = 'database';

$connection = mysqli_connect ( $host, $user, $pass, $dbpn );

if ( ! $connection )
{
	echo 'bad connection';

	exit ();
}

var_dump ( get_resource_type ( $connection ) );

mysqli_close ( $connection );

?>



Expected result:
----------------
I expect...

string(unknown)


Because it seems that mysqli_() is not in the (List of Resource Types) supported. But it would be nice if mysqli_() and the rest of the database extensions that PHP supports were added to the (List of Resource Types) supported.





Actual result:
--------------
I get..

bool(false)

[23-Mar-2009 15:07:18] PHP Warning:  Supplied argument is not a valid resource handle in X:\http\docs\test.php on line [17]

Which clearly states that $connection is not a valid resource, when it really is!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-23 21:03 UTC] kalle@php.net
The return value of mysqli_connect() is an object, not a resource. Please read the documentation for mysqli more carefully
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Apr 01 03:00:01 2026 UTC