]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 8 Jul 2019 10:53:50 +0000 (12:53 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 8 Jul 2019 10:53:50 +0000 (12:53 +0200)
1  2 
ext/standard/math.c
ext/standard/tests/math/bindec_variation1.phpt
ext/standard/tests/math/bindec_variation1_64bit.phpt
ext/standard/tests/math/hexdec_variation1.phpt
ext/standard/tests/math/hexdec_variation1_64bit.phpt
ext/standard/tests/math/octdec_variation1.phpt

index d2a47ee4bdec36b089842840e5bba42f15bc1432,ba7e3944aa5dd892d679e9b41f18f75990d436a1..e224ac6c7e39195de8634c2fd8f035a69d2386fc
@@@ -847,13 -850,28 +847,25 @@@ PHPAPI void _php_math_basetozval(zend_s
  {
        zend_long num = 0;
        double fnum = 0;
-       zend_long i;
        int mode = 0;
-       char c, *s;
+       char c, *s, *e;
        zend_long cutoff;
        int cutlim;
+       int invalidchars = 0;
  
 -      if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
 -              return FAILURE;
 -      }
 -      s = Z_STRVAL_P(arg);
 -      e = s + Z_STRLEN_P(arg);
 +      s = ZSTR_VAL(str);
++      e = s + ZSTR_LEN(str);
+       /* Skip leading whitespace */
+       while (s < e && isspace(*s)) s++;
+       /* Skip trailing whitespace */
+       while (s < e && isspace(*(e-1))) e--;
+       if (e - s >= 2) {
+               if (base == 16 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) s += 2;
+               if (base == 8 && s[0] == '0' && (s[1] == 'o' || s[1] == 'O')) s += 2;
+               if (base == 2 && s[0] == '0' && (s[1] == 'b' || s[1] == 'B')) s += 2;
+       }
  
        cutoff = ZEND_LONG_MAX / base;
        cutlim = ZEND_LONG_MAX % base;
index 307d021d99ca899a0883f27555e518cabfe26165,f59cb81bbe05afa389fb2a7697520b5a52305656..a8444c5395cf3a1fa72a7576c2f8a4a05397c79e
@@@ -138,9 -148,15 +152,11 @@@ int(0
  int(0)
  
  -- Iteration 18 --
 -
 -Notice: Array to string conversion in %s on line %d
 -
 -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
 -int(0)
 +bindec() expects parameter 1 to be string, array given
  
  -- Iteration 19 --
+ Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  int(0)
  
  -- Iteration 20 --
index 9387a5adfa0be0f4fffaf2d66029bb546111c28a,4f96268b37cfcc08cfbad24944ef7a4b4c3b2db8..0fdfe4b5eb86a7276234a906ffccf4cd9ca2fafc
@@@ -138,9 -148,15 +152,11 @@@ int(0
  int(0)
  
  -- Iteration 18 --
 -
 -Notice: Array to string conversion in %s on line %d
 -
 -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
 -int(0)
 +bindec() expects parameter 1 to be string, array given
  
  -- Iteration 19 --
+ Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  int(0)
  
  -- Iteration 20 --
index 5405c72c8eea61338e8c6a50a232f1c09c8e2490,8f066cb11db305207efb3db01e270edc944c4923..e7748a04d015d3d165f9fc0f10139312bc123e00
@@@ -148,9 -154,15 +158,11 @@@ int(0
  int(0)
  
  -- Iteration 20 --
 -
 -Notice: Array to string conversion in %s on line %d
 -
 -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
 -int(170)
 +hexdec() expects parameter 1 to be string, array given
  
  -- Iteration 21 --
+ Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  int(2748)
  
  -- Iteration 22 --
index 0c463ea7507e70f9c233cc46a1b69bf3c05ad000,759997979f433b0fe3cba54d932057a15d6d240f..31cc71b0e670c7a0b3f8ee2d727d2c2c992749d2
@@@ -148,9 -154,15 +158,11 @@@ int(0
  int(0)
  
  -- Iteration 20 --
 -
 -Notice: Array to string conversion in %s on line %d
 -
 -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
 -int(170)
 +hexdec() expects parameter 1 to be string, array given
  
  -- Iteration 21 --
+ Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  int(2748)
  
  -- Iteration 22 --
index cc8369c2aa7614c9b05eb3c229414164b2bdd3bf,84be45dbb3f15f0c53f1a17f83766b7dacab6031..b59b3b71eb2b1c99da0a4cb1e247ebe994990806
@@@ -144,9 -156,15 +160,11 @@@ int(0
  int(0)
  
  -- Iteration 20 --
 -
 -Notice: Array to string conversion in %s on line %d
 -
 -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
 -int(0)
 +octdec() expects parameter 1 to be string, array given
  
  -- Iteration 21 --
+ Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
  int(0)
  
  -- Iteration 22 --