klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

Memory leak? Allowed memory size of 134217728 bytes exhausted (tried to allocate 54407168 bytes) #301

Closed funkytaco closed 9 years ago

funkytaco commented 9 years ago

The exception points to this line: https://github.com/chriso/klein.php/blob/master/src/Klein/AbstractResponse.php#L382

I'm using the example from this page (as a Composer package): https://github.com/hipchat/hipchat-php

$token = '<your api token>';
$hc = new HipChat\HipChat($token);

// list rooms
foreach ($hc->get_rooms() as $room) {
                    $arrRooms[] = ['id' => $room->room_id, 'name' => $room->name];
}

and I'm returning the array.

funkytaco commented 9 years ago

Interesting - If I print_r($hipchatModule->get_rooms()); to the page via Klein, it works fine.

funkytaco commented 9 years ago

I think this is a problem with PHP's foreach() copying the array, unrelated to Klein.