|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-12 15:31 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 30 11:00:01 2025 UTC |
Description: ------------ There is some unusual behaviour in the attached function. When a new Database object is created, and a query called by: $result = $this->db_connection->query($valid_sql_query); Different results will occur, depending on the layout of the Database::query method. PHP version: 5.2.2 I do not own the webserver, and I doubt that they will be willing to upgrade to an unstable version to test it. Reproduce code: --------------- Works: class Database{ function query($_sql) { $q = mysql_query($_sql)or die("Invalid Query: $_sql <br />" . mysql_error()); return $q; } } --- Returns true: class Database{ function query($_sql) { return mysql_query($_sql) or die("Invalid Query: $_sql <br />" . mysql_error()); } } --- Works: class Database{ function query($_sql) { return mysql_query($_sql); } } Expected result: ---------------- In all cases, a mysql resource should be returned. Actual result: -------------- In cases 1 and 3 a mysql result is returned. In case 2, the function simply returns true.