ID:               24796
 Updated by:       [EMAIL PROTECTED]
 Reported By:      acdweb at yahoo dot com
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         InterBase related
 Operating System: Redhat Linux 9.0
 PHP Version:      4.3.2
 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.




Previous Comments:
------------------------------------------------------------------------

[2003-07-24 14:25:11] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

The code has changed quite a lot, please give it a go.
also, if the problem persists, can you please give us 
a complete test script(s) to reproduce this problem?
(with db creation script too)


------------------------------------------------------------------------

[2003-07-24 11:42:51] acdweb at yahoo dot com

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
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24796&edit=1

Reply via email to