1--TEST-- 2Test PHP bug #59378 writing to php://memory is incomplete 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8$imagick = new Imagick(); 9$imagick->newPseudoImage(640, 480, "LOGO:"); 10$imagick->setFormat("png"); 11 12$fp = fopen("php://memory", 'r+'); 13$imagick->writeImageFile($fp); 14rewind($fp); 15$memoryBlob = stream_get_contents($fp); 16fclose($fp); 17 18//This test depends on getImageBlob working correctly. 19$imageBlob = $imagick->getImageBlob(); 20 21//Read the images from the data blobs. 22$imageReopened = new Imagick(); 23$imageReopened->readImageBlob($imageBlob); 24$memoryReopened = new Imagick(); 25$memoryReopened->readImageBlob($memoryBlob); 26 27//Compare to see if they are identical. 28$result = $imageReopened->compareImages($memoryReopened, \Imagick::METRIC_MEANABSOLUTEERROR); 29 30if ($result[1] == 0) { 31 echo "Reopened images are identical."; 32} 33else { 34 echo "Error, reopened images have changed."; 35 var_dump($result); 36} 37 38?> 39--EXPECTF-- 40Reopened images are identical. 41