[PHP-DEV] Returning by reference

2007-05-31 Thread Edsko de Vries
Hi, I'm trying to write a function in an extension (using PHP_FUNCTION) that returns a value by reference. I have declared an arg info block (ZEND_BEGIN_ARG_INFO_EX) to tell the engine that I am returning a value by reference. Then to return the value, I first delete the old return value (zval_ptr

[PHP-DEV] Separation anxiety

2007-01-04 Thread Edsko de Vries
Hi, In her excellent book, Sara Golemon describes how PHP's refcount/is_ref mechanism works, and the situations in which this leads to problems (section "separation anxiety"). One of the examples is $a = 1; $b =& $a; $c = $a; Since $a is a "real" reference, $c cannot be made a copy-on-write refe

[PHP-DEV] calling zend_eval_string

2006-12-31 Thread Edsko de Vries
Hi, If I try to call zend_eval_string as follows: zval* retval; MAKE_STD_ZVAL(retval); zend_eval_string("return 5;", retval, "eval'd code" TSRMLS_CC); I get the following runtime error: eval'd code(1) : Parse error - syntax error, unexpected T_RETURN It turns out that zend_eval_string actualy