php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58757 long != int
Submitted: 2009-07-09 13:45 UTC Modified: 2015-04-07 19:46 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: apokalyptik at apokalyptik dot com Assigned:
Status: Suspended Package: big_int (PECL)
PHP Version: 5.2.8 OS: Debian 5.0.1 x86_64 GNU/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: apokalyptik at apokalyptik dot com
New email:
PHP Version: OS:

 

 [2009-07-09 13:45 UTC] apokalyptik at apokalyptik dot com
Description:
------------
because of the type of various numeric values in the source code php5+x86_64 is not recognizing values passed in (seeing them as 0 when they are not)

bi_base_convert(): wrong [base_from]. It can be from 2 to 36 inclusive

bi_from_str(): length of the string must be greater than 0

bi_to_str(): argument number [1] cannot be empty 

etc...

Reproduce code:
---------------
var_dump( bi_from_str("abcd", 16) );

var_dump( bi_base_convert("abcd", 16, 10) );



Expected result:
----------------
no errors, non-null return values

Actual result:
--------------
errors, null return values

Patches

fix-types-for-php5-x86_64 (last revision 2013-01-26 14:23 UTC by iliya at automattic dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-09 13:46 UTC] apokalyptik at apokalyptik dot com
--- php_big_int.c.orig	2005-05-30 12:08:32.000000000 +0000
+++ php_big_int.c	2009-07-09 07:02:27.000000000 +0000
@@ -675,8 +675,8 @@
 ZEND_FUNCTION(bi_from_str)
 {
     char *str = NULL;
-    int str_len;
-    int base;
+    long str_len;
+    long base;
     big_int_str s;
     big_int *num = NULL;
     const char *errstr = NULL;
@@ -801,8 +801,8 @@
 ZEND_FUNCTION(bi_base_convert)
 {
     char *str = NULL;
-    int str_len;
-    int base_from, base_to;
+    long str_len;
+    long base_from, base_to;
     big_int_str s, *s_ptr = NULL;
     const char *errstr = NULL;
 
@@ -2087,7 +2087,7 @@
     const char *errstr = NULL;
     big_int *answer = NULL;
     char *str;
-    int str_len;
+    long str_len;
     int is_sign;
     big_int_str s;
 
@@ -2104,7 +2104,7 @@
         goto error;
     }
 
-    s.str = str;
+	s.str = str;
     s.len = str_len;
     switch (big_int_unserialize(&s, is_sign, answer)) {
         case 0: break;
 [2013-01-26 16:01 UTC] iliya at polihronov dot com
Attached a new patch for this bug that is well tested in production. Is there any 
chance we could get this committed?
 [2015-04-07 19:46 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2015-04-07 19:46 UTC] cmb@php.net
Sorry, but apparently this package is not maintained anymore.
Marking this bug as "Suspended" for now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC