I have an array containing about 75 elements (not very deeply nested). When I try to add a new element with:
$myArray['mykey'][] = $newElement;
I get a segfault with php error 4. Is there a way to prevent from it? how can I change this code to avoid such things. Tried array_merge, array_unshift or += operation - all with the same result
Edit:
Sorry, here are details: PHP 5.5.9-1ubuntu4.14, Ubuntu 14.04 x64. Application also usess RabbitMQ, Redis, Elasticsearch
public function modify($stock, $new) {
if (!isset($stock['data_sets'])) {
$stock['data_sets'] = [];
}
$stock['data_sets'][]= $new;
if (!isset($stock['garbage_sets'])) {
$stock['garbage_sets'] = [];
}
return $stock;
}