PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB_QueryTool » Bug #10073

Zero (0) bug with empty() in _localeSafeImplode()

Details

Submitted2007-02-12 17:25 UTC
Fromlukas dot ruetz at gmx dot at
Assignedquipo
StatusClosed
PackageMDB_QueryTool
PHP Version5.2.0
OSSuSE Linux 10.2
Roadmaps(Not assigned)

Comments

[2007-02-12 17:25 UTC] lukas dot ruetz at gmx dot at

Description:
------------
If the first field is a numeric-field and the value 0 (number zero), then empty() returns true twice what causes no comma between the first and the second value in _localeSafeImplode()

Test script:
---------------
--- old/Query.php 2007-01-29 13:33:15.000000000 +0100
+++ new/Query.php 2007-02-12 18:20:26.000000000 +0100
@@ -629,7 +629,7 @@
{
$str = '';
foreach ($array as $value) {
- if (!empty($str)) {
+ if ($str !== '') {
$str .= $glue;
}
$str .= is_double($value) ? $this->_floatToStringNoLocale($value) : $value;

Expected result:
----------------
0,'something'

Actual result:
--------------
0'something'