File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -739,7 +739,11 @@ impl<'a> Iter<'a> {
739739 )
740740 } ;
741741
742- if key_type == -1 {
742+ // Key type `-1` is ???
743+ // Key type `1` is string
744+ // Key type `2` is long
745+ // Key type `3` is null meaning the end of the array
746+ if key_type == -1 || key_type == 3 {
743747 return None ;
744748 }
745749
@@ -753,10 +757,16 @@ impl<'a> Iter<'a> {
753757 ) ;
754758 }
755759 let value = unsafe {
756- & * zend_hash_get_current_data_ex (
760+ let val_ptr = zend_hash_get_current_data_ex (
757761 self . ht as * const ZendHashTable as * mut ZendHashTable ,
758762 & mut self . pos as * mut HashPosition ,
759- )
763+ ) ;
764+
765+ if val_ptr. is_null ( ) {
766+ return None ;
767+ }
768+
769+ & * val_ptr
760770 } ;
761771
762772 if !key. is_long ( ) && !key. is_string ( ) {
Original file line number Diff line number Diff line change 33require ('_utils.php ' );
44
55// Tests sequential arrays
6- $ array = test_array (['a ' , 'b ' , 'c ' ]);
6+ $ array = test_array (['a ' , 'b ' , 'c ' , 'd ' ]);
7+ unset($ array [2 ]);
78
89assert (is_array ($ array ));
910assert (count ($ array ) === 3 );
1011assert (in_array ('a ' , $ array ));
1112assert (in_array ('b ' , $ array ));
12- assert (in_array ('c ' , $ array ));
13+ assert (in_array ('d ' , $ array ));
1314
1415// Tests associative arrays
1516$ assoc = test_array_assoc ([
Original file line number Diff line number Diff line change 11#[ test]
2- fn binary_works ( ) {
2+ fn array_works ( ) {
33 assert ! ( crate :: integration:: run_php( "array.php" ) ) ;
44}
You can’t perform that action at this time.
0 commit comments