PHP segfaults when there are too many elements added to a linked list