From: jap1968 at yahoo dot es
Operating system: Linux (RedHat 9)
PHP version: 4.3.8
PHP Bug Type: Sybase (dblib) related
Bug description: Returns wrong result under certain circumstances
Description:
------------
When using a LC_TIME locale which do represent time in 0..24h manner in
spite of using AM/PM, wrong results are obtained.
Results are always in the range 0..11, so if the time corresponds to a PM
hour, the returned result is wrong. It does not correspond with the real
value stored in the database!
Reproduce code:
---------------
// Asking a MS_SQLServer through FreeTDS + Sybase functions
$linkBD = sybase_connect("SGBD", "user", "pass");
sybase_select_db("BD", $linkBD);
$query = "select fecha from table";
/* RIGHT */
setlocale (LC_TIME, "en_US"); // Returns correct time
$res = sybase_query($query, $linkBD);
if ($fila = sybase_fetch_array($res)) {
$fecha = $fila['fecha'];
echo 'en_US'.$fecha;
}
/* WRONG */
setlocale (LC_TIME, "es_ES"); // Returns wrong time
$res = sybase_query($query, $linkBD);
if ($fila = sybase_fetch_array($res)) {
$fecha = $fila['fecha'];
echo 'es_ES'.$fecha;
}
sybase_close($linkBD);
Expected result:
----------------
en_US:NOV 25 2004 01:00PM
es_ES:nov 25 2004 01:00
Actual result:
--------------
en_US:NOV 25 2004 01:00PM
es_ES:nov 25 2004 13:00
--
Edit bug report at http://bugs.php.net/?id=30898&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30898&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=30898&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=30898&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30898&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30898&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30898&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30898&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30898&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30898&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30898&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=30898&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=30898&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30898&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30898&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30898&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30898&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30898&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30898&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30898&r=mysqlcfg