1--TEST-- 2Bug #71742 polyline touched by array_walk 3--SKIPIF-- 4<?php 5require_once(dirname(__FILE__) . '/skipif.inc'); 6?> 7--FILE-- 8<?php 9 10$coordinates = array(); 11 12foreach (range (0, 100) as $index) { 13 $coordinates[] = array( 14 'x' => 2 * $index, 15 'y' => pow($index, 2) 16 ); 17} 18 19$callback = function (&$coordinate) { 20 $coordinate['y'] = 200 - $coordinate['y'] / 50; 21}; 22 23array_walk($coordinates, $callback); 24 25$imagick = new Imagick(); 26$imagick->newImage(200, 200, "white"); 27 28$draw = new ImagickDraw (); 29$draw->setFillColor("none"); 30$draw->setStrokeColor("black"); 31 32//Fatal error in PHP 7, but not in PHP <= 5.6 33$draw->polyline($coordinates); 34 35$draw->translate(0, -20); 36////Works in PHP 7 37$draw->polyline (array_values($coordinates)); 38$imagick->drawImage($draw); 39//$imagick->writeImage(getcwd()."/test.png"); 40$imagick->setImageFormat('png'); 41$bytes = $imagick->getImageBlob(); 42 43if (strlen($bytes) <= 0) { 44 echo "Failed to generate image."; 45} 46 47//$imagick->writeImage("./bugTest.png"); 48 49echo "Ok"; 50 51?> 52--EXPECT-- 53Ok