#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    /root
    Posts
    14
    Rep Power
    0

    Zend_bool, zend_read/write_property


    Hello there.

    In an extension, I am trying to read and write properties of $this. Especially, storing a resource - which is actualy a pointer to a c++ class instance.

    I know the function definition is:

    Code:
    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 tried calling it like this:

    Code:
    	 zval prop = zend_read_property(
    	 	easywsclient_ce, 
    	 	_this, "ws", 
    	 	strlen("ws"), 
    	 	false TSRMLS_CC);
    But at the line which says FALSE, g++ is telling me the argument is invaild?

    Code:
    /Users/Ingwie/Work/php-ext/php-ewsc/php_easywsclient.cpp: In function ‘void zim_easywsclient_readyState(int, zval*, zval**, zval*, int, void***)’:
    /Users/Ingwie/Work/php-ext/php-ewsc/php_easywsclient.cpp:126: error: conversion from ‘zval*’ to non-scalar type ‘_zval_struct’ requested
    Any help here? o-o
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    Generally, PHP programmers don't write in the C++ core of PHP. Moving your thread to C/C++

    Also, resource types can't be serialized or stored in any way, they have to be in active memory.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,294
    Rep Power
    9400
    zend_bool is an unsigned char. Try just passing 1.

IMN logo majestic logo threadwatch logo seochat tools logo