Fixed bug #66356 (Heap Overflow Vulnerability in imagecrop())

Initial fix was PHP stuff
This one is libgd fix.

- filter invalid crop size
- dont try to copy on invalid position
- fix crop size when out of src image
- fix possible NULL deref
- fix possible integer overfloow
minor fix on previous
Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer.c has dos-style ^M as lineend)

Use git blame -w to ingore the space changes
Fix dos style eol in phpts
Fix test fail
Fix leak caused by fix to bug #65667

ftp->stream is now closed in the ftp resource dtor.
Merge branch 'PHP-5.4' into PHP-5.5