@@ -730,10 +730,61 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
730
730
offset_key = ZSTR_EMPTY_ALLOC ();
731
731
goto str_index ;
732
732
case IS_DOUBLE :
733
- hval = zend_dval_to_lval_safe (Z_DVAL_P (dim ));
733
+ hval = zend_dval_to_lval (Z_DVAL_P (dim ));
734
+ if (!zend_is_long_compatible (Z_DVAL_P (dim ), hval )) {
735
+ /* The array may be destroyed while throwing the notice.
736
+ * Temporarily increase the refcount to detect this situation. */
737
+ if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
738
+ GC_ADDREF (ht );
739
+ }
740
+ execute_data = EG (current_execute_data );
741
+ opline = EX (opline );
742
+ zend_incompatible_double_to_long_error (Z_DVAL_P (dim ));
743
+ if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && !GC_DELREF (ht )) {
744
+ zend_array_destroy (ht );
745
+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
746
+ if (EG (exception )) {
747
+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
748
+ } else {
749
+ ZVAL_NULL (EX_VAR (opline -> result .var ));
750
+ }
751
+ }
752
+ return NULL ;
753
+ }
754
+ if (EG (exception )) {
755
+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
756
+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
757
+ }
758
+ return NULL ;
759
+ }
760
+ }
734
761
goto num_index ;
735
762
case IS_RESOURCE :
763
+ /* The array may be destroyed while throwing the notice.
764
+ * Temporarily increase the refcount to detect this situation. */
765
+ if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
766
+ GC_ADDREF (ht );
767
+ }
768
+ execute_data = EG (current_execute_data );
769
+ opline = EX (opline );
736
770
zend_use_resource_as_offset (dim );
771
+ if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && !GC_DELREF (ht )) {
772
+ zend_array_destroy (ht );
773
+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
774
+ if (EG (exception )) {
775
+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
776
+ } else {
777
+ ZVAL_NULL (EX_VAR (opline -> result .var ));
778
+ }
779
+ }
780
+ return NULL ;
781
+ }
782
+ if (EG (exception )) {
783
+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
784
+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
785
+ }
786
+ return NULL ;
787
+ }
737
788
hval = Z_RES_HANDLE_P (dim );
738
789
goto num_index ;
739
790
case IS_FALSE :
0 commit comments