#49256 [NEW]: PHP ignores Where clause on Where with boolean fields
| From: | rafinguer at gmail dot com | Date: | Fri, 14 Aug 2009 16:07:02 +0000 |
| Subject: | #49256 [NEW]: PHP ignores Where clause on Where with boolean fields | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-141057@lists.php.net to get a copy of this message | ||
From: rafinguer at gmail dot com
Operating system: Windows Vista
PHP version: 5.2SVN-2009-08-14 (snap)
PHP Bug Type: PostgreSQL related
Bug description: PHP ignores Where clause on Where with boolean fields
Description:
------------
PHP ignores the true or false values in a SQL sentence, returning always
all the records:
select id_product_type, name_product_type
from sch_trazalogic.product_type
where deleted=false
order by name_product_type
I tried with "where deleted='f'" and with "where not deleted". The
result is the same. With PGAdmin (Query tool), the result is correct.
Reproduce code:
---------------
$result="";
$qry = "select id_product_type, name_product_type ".
"from sch_trazalogic.product_type ".
"where deleted=false ".
"order by name_product_type";
$result_qry = pg_query($connection, $qry);
$num_rows = pg_numrows($result_qry);
$current=0;
while ($current<$num_rows) {
$row = pg_fetch_row($result_qry, $current); // fetch current row
$result = $result_xml.$row[0]."-".$row[1]."\n";
$current++;
}
pg_close($connection);
echo $result_xml;
Expected result:
----------------
All the records with "deleted" with "false" value
Actual result:
--------------
All the records (deleted=true and deleted=false)
--
Edit bug report at http://bugs.php.net/?id=49256&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49256&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49256&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49256&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49256&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49256&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49256&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49256&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49256&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49256&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49256&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49256&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49256&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49256&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49256&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49256&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49256&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49256&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49256&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49256&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49256&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49256&r=mysqlcfg