From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.3.0RC1
PHP Bug Type:     MySQL related
Bug description:  All spaces on a right padded string getting chopped

The following mysql query should return the data padded with spaces on the
right:
<?php
$query = '
SELECT
    RPAD(t1.f_field1,15,\' \'),
    RPAD(t2.f_field2, 15, \' \')
FROM
    test.table1 as t1
    LEFT JOIN test.table2 AS t2 ON t1.record=t2.joinID
ORDER BY t1.record DESC';

$link = mysql_connect('localhost', 'root', 'password');
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    var_dump($row);
}
?>

However, the all spaces to the right of the string are chopped off, as if
PHP (or maybe the MySQL api?) is doing an rtrim on the data.  

Some details:
* The exact same query run from the MySQL console returns the correctly
padded data.
* If the ORDER BY is commented out the data comes back padded correctly.
* If the query does not contain a JOIN the data comes back padded
correctly (even if there is an ORDER BY)
* It doesn't matter what the data is for table1 and  table2 so long as the
two tables can be joined and have some data in the fields
* I am using MySQL version 3.23.52
-- 
Edit bug report at http://bugs.php.net/?id=20510&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20510&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20510&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20510&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20510&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20510&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20510&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20510&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20510&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20510&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20510&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20510&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20510&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20510&r=isapi

Reply via email to