php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57914 ImagickDraw::clone() returns uncloned object
Submitted: 2007-11-16 16:55 UTC Modified: 2007-11-17 03:13 UTC
From: sleeperseven at hotmail dot com Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.2.1 OS: Linux
Private report: No CVE-ID: None
 [2007-11-16 16:55 UTC] sleeperseven at hotmail dot com
Description:
------------
Setting properties of an ImagickDraw object, and then calling clone() on that object, does not return a true clone with the original object's properties.  (Linux, PHP 5.2.5, ImageMagick 6.3.6-10, Imagick 2.0.1)

On line 14871 of imagick.c (from SVN), we see the following:

IMAGICKDRAW_REPLACE_DRAWINGWAND( internd, tmpWand );

Shouln't this be the following?

IMAGICKDRAW_REPLACE_DRAWINGWAND( intern_return, tmpWand );

Reproduce code:
---------------
$hDraw = new ImagickDraw();
$hDraw->setFontSize(100);
$hDraw->setFillColor(new ImagickPixel("rgba(128,128,128,0.5)"));
$hClone = $hDraw->clone();
echo "Original ImagickDraw:<pre>" . print_r($hDraw->getFillColor()->getColor(), true) . "</pre>";
echo $hDraw->getFontSize() . "<br>";
echo "Cloned ImagickDraw:<pre>" . print_r($hClone->getFillColor()->getColor(), true) . "</pre>";
echo $hClone->getFontSize() . "<br>";


Expected result:
----------------
Original and Cloned ImagickDraw objects should have the same properties.

Actual result:
--------------
Cloned result has a fill-color of black and a font-size of 12 (the default values for a new ImagickDraw object).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-17 03:13 UTC] mkoppanen@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Thanks for the heads up!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC