@@ -686,6 +686,9 @@ function tlv_unpack($raw_tlv) {
686
686
my_print ("len: {$ tlv ['len ' ]}, type: {$ tlv ['type ' ]}" );
687
687
if (($ type & TLV_META_TYPE_STRING ) == TLV_META_TYPE_STRING ) {
688
688
$ tlv = unpack ("Nlen/Ntype/a*value " , substr ($ raw_tlv , 0 , $ tlv ['len ' ]));
689
+ # PHP 5.5.0 modifed the 'a' unpack format to stop removing the trailing
690
+ # NULL, so catch that here
691
+ $ tlv ['value ' ] = str_replace ("\0" , "" , $ tlv ['value ' ]);
689
692
}
690
693
elseif (($ type & TLV_META_TYPE_UINT ) == TLV_META_TYPE_UINT ) {
691
694
$ tlv = unpack ("Nlen/Ntype/Nvalue " , substr ($ raw_tlv , 0 , $ tlv ['len ' ]));
@@ -911,7 +914,8 @@ function read($resource, $len=null) {
911
914
$ r = Array ($ resource );
912
915
my_print ("Calling select to see if there's data on $ resource " );
913
916
while (true ) {
914
- $ cnt = stream_select ($ r , $ w =NULL , $ e =NULL , 0 );
917
+ $ w =NULL ;$ e =NULL ;$ t =0 ;
918
+ $ cnt = stream_select ($ r , $ w , $ e , $ t );
915
919
916
920
# Stream is not ready to read, have to live with what we've gotten
917
921
# so far
@@ -1147,7 +1151,8 @@ function remove_reader($resource) {
1147
1151
# Main dispatch loop
1148
1152
#
1149
1153
$ r =$ GLOBALS ['readers ' ];
1150
- while (false !== ($ cnt = select ($ r , $ w =null , $ e =null , 1 ))) {
1154
+ $ w =NULL ;$ e =NULL ;$ t =1 ;
1155
+ while (false !== ($ cnt = select ($ r , $ w , $ e , $ t ))) {
1151
1156
#my_print(sprintf("Returned from select with %s readers", count($r)));
1152
1157
$ read_failed = false ;
1153
1158
for ($ i = 0 ; $ i < $ cnt ; $ i ++) {
0 commit comments