From: Derick Rethans [mailto:der...@php.net] 
Sent: Monday, January 07, 2013 11:22 AM
To: nat...@starin.biz
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] new Class ReflectionZVal

On Mon, 7 Jan 2013, nat...@starin.biz wrote:

>> function __construct(&$variable);
> That's inherently flawed, as passing a variable in can modify it's
refcount and is_ref states. This is why Xdebug's equivalent wants a string
with the variable name instead:
> http://xdebug.org/docs/all_functions#xdebug_debug_zval

I am quite familiar with this issue. The idea I was thinking to solve that
issue is to maybe pass by-reference to the __construct. When I was drafting
this first email I had it by-ref, but opted out of it because I didn't have
a way to get the value of the reference, but reviewing I added the "
function getValueReflection();" functions which should make it possible to
use by-reference now and obtain the info to the reference of the reference.

>> function valueExists();
> What's a "referenced variable" here? If you pass in something, it will
exist.

The idea is that the value may not exist. This function would confirm that
the value of the reflected zval still exists. My first draft of this email
only had "function &getValue();" but I think it would create problems if it
stated something like, "Returns null if value does not exist" because what
if the value does exist (ie variable reference is still alive) but the value
is null? This function (ReflectionZVal::valueExists()) would return false if
the zval is gone (garbage collected).


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to