PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #1017

QuoteSmart not very smart (BC break)

Details

Submitted2004-03-15 15:17 UTC
Frombmansion at mamasam dot com
StatusBogus
PackageDB
PHP Version4.3.3
OSMacosx
Roadmaps(Not assigned)

Comments

[2004-03-15 15:17 UTC] bmansion at mamasam dot com

Description:
------------
The way values are handled in the mysql wrapper (not tested with others...) by the quote method does not work as it used to be when the given value is 'NULL' (with quotes).

DB is 1.6 and 1.6.1

Reproduce code:
---------------
CREATE TABLE `panier` (
`pkpanier` char(32) NOT NULL default '',
`pan_special` float(10,2) unsigned default NULL,
`pan_datemodif` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`pkpanier`)
) TYPE=MyISAM COMMENT='Shopping cart';

<?php
$pkpanier= 'AAAAA';
$special = 'NULL';
$datemodif = time();
$query = "INSERT INTO panier SET "
."pkpanier='$pkpanier', "
."pan_special=".$db->quote($special).", "
."pan_datemodif=$datemodif";
$db->query($query);
?>

Expected result:
----------------
INSERT INTO panier VALUES ('AAAAA', NULL, 1079363642);

Actual result:
--------------
INSERT INTO panier VALUES ('AAAAA', '0.00', 1079363642);

[2004-03-15 15:31 UTC] mansion at php dot net

My mistake, sorry :)
I should have used $special = null;