xref: /imagick/tests/bug_73840.phpt (revision 89dada42)
1--TEST--
2ImagickPixel iterator
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__) . '/skipif.inc'); ?>
6--XFAIL--
7This needs a significant amount of work to fix. The issue is the iterator object is going out of scope and being freed, but the row object still has a reference to that pixel iterator,  internally in ImageMagick. We need to stop the pixeliterator being freed while the row is still active.
8--FILE--
9<?php
10
11//$im = new Imagick();
12//$im->newImage(1, 1, 'black');
13//
14//// This works fine
15//$it = $im->getPixelIterator();
16//$row = $it->getCurrentIteratorRow();
17//$rgb = $row[0]->getColor();
18//
19//$expected = array (
20//  "r" => 0,
21//  "g" => 0,
22//  "b" => 0,
23//  "a" => 1,
24//);
25//
26//if ($rgb !== $expected) {
27//	echo "values are incorrect:\n";
28//	var_dump($rgb);
29//}
30//
31//// This crashes with SIGABRT
32//$row = $im->getPixelIterator()->getCurrentIteratorRow();
33//$rgb = $row[0]->getColor();
34//
35//if ($rgb !== $expected) {
36//    echo "values are incorrect:\n";
37//    var_dump($rgb);
38//}
39
40echo "Not ok";
41
42?>
43--EXPECTF--
44Not ok