File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5514,19 +5514,21 @@ PHP_FUNCTION(str_split)
5514
5514
RETURN_FALSE ;
5515
5515
}
5516
5516
5517
- array_init_size (return_value , ((str_len - 1 ) / split_length ) + 1 );
5518
-
5519
- if (split_length >= str_len ) {
5517
+ if (0 == str_len ) {
5518
+ array_init_size (return_value , 1 );
5520
5519
add_next_index_stringl (return_value , str , str_len , 1 );
5521
5520
return ;
5522
5521
}
5523
5522
5523
+ array_init_size (return_value , ((str_len - 1 ) / split_length ) + 1 );
5524
+
5524
5525
n_reg_segments = str_len / split_length ;
5525
5526
p = str ;
5526
5527
5527
- while (n_reg_segments -- > 0 ) {
5528
+ while (n_reg_segments > 0 ) {
5528
5529
add_next_index_stringl (return_value , p , split_length , 1 );
5529
5530
p += split_length ;
5531
+ n_reg_segments -- ;
5530
5532
}
5531
5533
5532
5534
if (p != (str + str_len )) {
You can’t perform that action at this time.
0 commit comments