|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-24 14:25 UTC] sniper@php.net
[2003-07-29 07:26 UTC] sniper@php.net
[2003-07-31 11:10 UTC] acdweb at yahoo dot com
[2003-07-31 11:38 UTC] acdweb at yahoo dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ Hello! PROBLEM: value "0" is replaced with "" when var type is INT64 REASON: a bug when casting INT64 to STRING FILENAME: interbase.c FUNCTION: static int _php_ibase_var_pval() Original Code: #ifdef SQL_INT64 case SQL_INT64: val->type = IS_STRING; if (scale) { int j, f = 1; double number = (double) ((ISC_INT64) (*((ISC_INT64 *)data))); char dt[20]; for (j = 0; j < -scale; j++) { f *= 10; } sprintf(dt, "%%0.%df", -scale); val->value.str.len = sprintf (string_data, dt, number/f ); } else { val->value.str.len =sprintf (string_data, "%.0" ISC_INT64_FORMAT "d", (ISC_INT64) *(ISC_INT64 *) data); } val->value.str.val = estrdup(string_data); break; #endif Fixed Code: #ifdef SQL_INT64 case SQL_INT64: val->type = IS_STRING; if (scale) { int j, f = 1; double number = (double) ((ISC_INT64) (*((ISC_INT64 *)data))); char dt[20]; for (j = 0; j < -scale; j++) { f *= 10; } sprintf(dt, "%%0.%df", -scale); val->value.str.len = sprintf (string_data, dt, number/f ); } else { if ((ISC_INT64) *(ISC_INT64 *) data == 0) { val->value.str.len =sprintf (string_data, "0"); } else { val->value.str.len =sprintf (string_data, "%.0" ISC_INT64_FORMAT "d", (ISC_INT64) *(ISC_INT64 *) data); } } val->value.str.val = estrdup(string_data); break; #endif Thank you for your work! Justin Kang Reproduce code: --------------- print_r($result) Expected result: ---------------- Array ( [ID] => 3 [BLEED] => 0 [DESCRIPTION] => Front Side ) Actual result: -------------- Array ( [ID] => 3 [BLEED] => [DESCRIPTION] => Front Side )