On Mon, 2013-09-30 at 21:12 +0200, Kevin Ingwersen wrote:
> Hello there.
> 
> I am trying to read/write properties. I have found the read_property
> function as such:
> 
> ZEND_API zval *zend_read_property(zend_class_entry *scope, zval
> *object, const char *name, int name_length, zend_bool silent
> TSRMLS_DC);
> 
> But, what is a zend_bool? I trued passing false to it, but i got an
> error O.o so I think I sort of missed this a bit.

A zend_bool is an unsigned char, see zend_types.h. I think we don't have
global true/false constants defined, so you can use 0 or 1 for false or
true.

But I'm not sure I understood your question correctly. Please always
share some code and error messages.

> I am essentially trying to store a resource into an object, and
> reading it off in another member function.

What exactly are you trying to achieve? Are you creating an internal
class and want to store custom data (i.e. pointers to some library
stuff) in it? Then don't mess with resources but extend the zend_object
structure

   typedef struct {
       zend_object zo; /* has to be the first element */
       void *ptr; /* custom members */
   } my_object;

See http://talks.somabo.de/200903_montreal_php_extension_writing.pdf
slides 89-92.

By overriding different property handlers these custom elements can be
exported to userland in nice ways.

johannes


-- 
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to