So, I know you’re supposed to call imagecolordeallocate and create new colors when you create a new image object. And test that your colors are created successfully. But really, who can be bothered? But, if you’re running the latest PHP 5.4 RC and seeing this in your console log:
3 libphp5.so 0x00000001081c34d1 php_request_shutdown + 1121 (main.c:1780)
Or this in a GDB backtrace:
#3 0x000000010172853f in php_request_shutdown (dummy=0x0) at main.c:1776
it might mean you’ve encountered this bug, and you need to care now.
Until PHP resolves this, the way you troubleshoot it is to run PHP through GDB (on my Mac, “sudo gdb /usr/sbin/httpd” and at the prompt type “run -X”). When PHP crashes, use GDB to print the contents of last_error_message as a string: That’s the file with the error. Then print the contents of last_error_file: That’s the line the error occurred on. What is the error? No idea. That information seems to have been shifted off into oblivion, but at least you have a line to stare at.
Hope that helps someone. And in the future, we should probably be better about checking return statuses and calling destructors…