Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003310 [Quercus] block always 01-30-09 17:18 10-07-10 07:15
Reporter koreth View Status public  
Assigned To
Priority normal Resolution no change required  
Status assigned   Product Version 4.0.0
Summary 0003310: mysql_fetch_assoc() discards data types
Description mysql_fetch_assoc() returns an array of string values even when the database columns are numeric. This messes up some equality tests because, e.g., 0 == null but '0' != null.

Patch attached.
Additional Information
Attached Files  patch.txt [^] (1,187 bytes) 01-30-09 17:18

- Relationships

- Notes
(0003794)
nam
02-02-09 15:49

The original behavior should be correct because it matches PHP's.


Test Case
=========
$link = mysql_connect();
mysql_select_db("test");

mysql_query("DROP TABLE test");
mysql_query("CREATE TABLE test (id INTEGER, data DOUBLE)");
mysql_query("INSERT INTO test VALUES (123, 4.56)");
mysql_query("INSERT INTO test VALUES (0, 0.0)");

$result = mysql_query("SELECT * FROM test");

while ($line = mysql_fetch_assoc($result)) {
  var_dump($line);
}


Expected Output
===============
array(2) {
  ["id"]=>
  string(3) "123"
  ["data"]=>
  string(4) "4.56"
}
array(2) {
  ["id"]=>
  string(1) "0"
  ["data"]=>
  string(3) "0"
}
 

- Issue History
Date Modified Username Field Change
01-30-09 17:18 koreth New Issue
01-30-09 17:18 koreth File Added: patch.txt
02-02-09 15:49 nam Note Added: 0003794
02-03-09 07:18 nam Status new => assigned
02-03-09 07:18 nam Assigned To  => nam
02-03-09 07:19 nam Status assigned => closed
02-03-09 07:19 nam Resolution open => no change required
02-04-09 11:39 nam Status closed => assigned
10-07-10 07:15 domdorn Assigned To nam =>


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker