php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #66399
Patch inconsistent-bin-hex-handling.patch revision 2014-01-03 14:25 UTC by krakjoe@php.net
revision 2014-01-03 14:15 UTC by krakjoe@php.net
revision 2014-01-03 14:13 UTC by krakjoe@php.net
revision 2014-01-03 13:39 UTC by krakjoe@php.net

Patch inconsistent-bin-hex-handling.patch for Strings related Bug #66399

Patch version 2014-01-03 14:25 UTC

Return to Bug #66399 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2014-01-03 14:25 UTC | 2014-01-03 14:15 UTC | 2014-01-03 14:13 UTC | 2014-01-03 13:39 UTC

Developer: krakjoe@php.net



  diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
 index e862929..98d34de 100644
 index e862929..d6d5c9b 100644
  --- a/Zend/zend_operators.c
  +++ b/Zend/zend_operators.c
  @@ -79,6 +79,24 @@ static const unsigned char tolower_map[256] = {
   		zend_binary_strncasecmp


  +static inline long zendi_strtol(const char *str, int base) {
  +	long converted = 0L;
  +	
  +	if (str[0] == '0') {
 +		if (str[1] != '\0' && str[1] != '\0') {
 +		if (str[1] != '\0' && str[2] != '\0') {
  +			if (str[1] == 'x' || str[1] == 'X') {
  +				return strtol(&str[2], NULL, 8);
  +			} else {
  +				if (str[1] == 'b' || str[1] == 'B') {


   		}
   
   		/* Skip any leading 0s */
  diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c
 index 4546614..0348778 100644
 index 4546614..55bfa68 100644
  --- a/Zend/zend_strtod.c
  +++ b/Zend/zend_strtod.c
  @@ -2063,7 +2063,7 @@ ZEND_API double zend_strtod (CONST char *s00, CONST char **se)
   	} else if (*s == '+') {


  +	
   	s0 = s;
   	y = z = 0;
   	for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
 @@ -2591,7 +2600,9 @@ ZEND_API double zend_hex_strtod(const char *str, const char **endptr)
  	double value = 0;
  
  	if (strlen(str) < 2) {
 -		*endptr = str;
 +		if (endptr != NULL) {
 +			*endptr = str;
 +		}
  		return 0.0;
  	}
  
 @@ -2629,7 +2640,9 @@ ZEND_API double zend_oct_strtod(const char *str, const char **endptr)
  	int any = 0;
  
  	if (strlen(str) < 1) {
 -		*endptr = str;
 +		if (endptr != NULL) {
 +			*endptr = str;
 +		}
  		return 0.0;
  	}
  
 @@ -2662,7 +2675,9 @@ ZEND_API double zend_bin_strtod(const char *str, const char **endptr)
  	int 		any = 0;
  
  	if (strlen(str) < 2) {
 -		*endptr = str;
 +		if (endptr != NULL) {
 +			*endptr = str;
 +		}
  		return 0.0;
  	}
  
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Oct 05 22:05:53 2022 UTC