Hi! I like to suggest to improve the current test suite of the gd extension. The main issue I see with the current suite is that many (~ 28) tests use md5() to verify that a drawn image is correct. However, as Pierre mentioned long ago[1], md5() does not work (reliably) for this purpose.
An alternative would be to have prepared images, and to compare these with the actual resulting images pixel by pixel. While that might work fine for lossless compression, it still can result in failing tests, which would be hard to track down, and obviously a pure PHP implementation is slow. Especially, when it comes to verify lossy image compression a more sophisticated approach is required. Due to the necessity to test imagewebp() I had committed a very simplistic calc_image_dissimilarity() a while ago[2]. Obviously, this should be improved either regarding the algorithm as well as the performance. libgd already has a much better testing library written in C[3], which generates image diffs for failing tests, and we may consider to use parts of it for PHP. I can't see any issues regarding the license. Thoughts? [1] <https://github.com/php/php-src/pull/211#issuecomment-17224297> [2] <https://github.com/php/php-src/commit/90de2ae> [3] <https://github.com/libgd/libgd/tree/gd-2.2.1/tests/gdtest> -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php