The destructor of an object is called even after the constructor has an exception, this was causing the call to NDArray_FREE from the destructor to cause a segmentation fault, since with the failure of __construct, the NDArray was not allocated in the object.
The destructor must check whether the array's UUID is properly defined before attempting to remove it from the buffer.
if (GC_REFCOUNT(object) <= 1 && Z_TYPE_P(obj_uuid) != IS_UNDEF) {
The destructor of an object is called even after the constructor has an exception, this was causing the call to NDArray_FREE from the destructor to cause a segmentation fault, since with the failure of __construct, the NDArray was not allocated in the object.
The destructor must check whether the array's UUID is properly defined before attempting to remove it from the buffer.