Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP weirdness extending IMagick class

This is a really weird one. I have some code that is happily working on version 2.1.1RC1 of the php5-imagick module. It's basically just a class I wrote that extends the Imagick class and manages images stored in a database.

Since upgrading to version 3.0.0RC1 (thankfully only on my dev box) things have gone to hell. It seems that object members are writeable but are NOT readable. Take the following sample code:

class db_image extends IMagick {

private $data;

function __construct( $id = null ){
    parent::__construct();

    $this->data = 'some plain text';

    echo $this->data;
}

This will output absolutely NOTHING. My debugger indicates that the contents of $this->data are the correct string value, but I am unable to read the value back out of the member variable.

Seriously. WTF? Does anyone know what is causing this or has seen it before? I don't even know how to replicate this behaviour in my own classes.

like image 235
Jamie Carl Avatar asked Nov 05 '22 07:11

Jamie Carl


1 Answers

I encountered the same problem and filed a bug report: http://pecl.php.net/bugs/bug.php?id=21229

it seems to be fixed in svn now - but haven't tried yet. Also these types of bugs don't seem to be that exotic: http://pecl.php.net/bugs/bug.php?id=15960&edit=2

like image 117
lifeofguenter Avatar answered Nov 09 '22 03:11

lifeofguenter