@@ -919,7 +919,6 @@ PHP_FUNCTION(unpack)
919
919
}
920
920
case 'A' : {
921
921
/* A will strip any trailing whitespace */
922
- char padn = '\0' ; char pads = ' ' ; char padt = '\t' ; char padc = '\r' ; char padl = '\n' ;
923
922
zend_long len = inputlen - inputpos ; /* Remaining string */
924
923
925
924
/* If size was given take minimum of len and size */
@@ -931,11 +930,11 @@ PHP_FUNCTION(unpack)
931
930
932
931
/* Remove trailing white space and nulls chars from unpacked data */
933
932
while (-- len >= 0 ) {
934
- if (input [inputpos + len ] != padn
935
- && input [inputpos + len ] != pads
936
- && input [inputpos + len ] != padt
937
- && input [inputpos + len ] != padc
938
- && input [inputpos + len ] != padl
933
+ if (input [inputpos + len ] != '\0'
934
+ && input [inputpos + len ] != ' '
935
+ && input [inputpos + len ] != '\t'
936
+ && input [inputpos + len ] != '\r'
937
+ && input [inputpos + len ] != '\n'
939
938
)
940
939
break ;
941
940
}
@@ -946,7 +945,6 @@ PHP_FUNCTION(unpack)
946
945
/* New option added for Z to remain in-line with the Perl implementation */
947
946
case 'Z' : {
948
947
/* Z will strip everything after the first null character */
949
- char pad = '\0' ;
950
948
zend_long s ,
951
949
len = inputlen - inputpos ; /* Remaining string */
952
950
@@ -959,7 +957,7 @@ PHP_FUNCTION(unpack)
959
957
960
958
/* Remove everything after the first null */
961
959
for (s = 0 ; s < len ; s ++ ) {
962
- if (input [inputpos + s ] == pad )
960
+ if (input [inputpos + s ] == '\0' )
963
961
break ;
964
962
}
965
963
len = s ;
0 commit comments