[redland-dev] redland/php questions

Dave Beckett dave.beckett at bristol.ac.uk
Tue Mar 8 15:48:45 GMT 2005


On Mon, 2005-03-07 at 22:54 +0200, Russell Cloran wrote:

> PHP does have a special NULL value,
> http://www.php.net/manual/en/language.types.null.php
> 
> That page says it has been in existence since 4 ... and I can't imagine
> that there are too many 3 installations remaining out there (is it even
> supported any more? I see one download from a 2002 security issue for it
> on the downloads page.)

Ok, that doesn't worry me then.  So PHP's NULL can or should be used.

> Anyways, I think that the following type of patches which you sent me
> somewhere between 0.9.18.1 and 0.9.19.1 do the right sort of thing wrt
> returning PHP NULLs:
> 
> -    SWIG_SetPointerZval(return_value, (void *)result,
> SWIGTYPE_p_librdf_iterator, 1);
> +    if(!result) {
> +        ZVAL_NULL(return_value);
> +    }else {
> +        SWIG_SetPointerZval(return_value, (void *)result,
> SWIGTYPE_p_librdf_iterator, 1);
> +    }
> 
> In other words, where the C documentation says it would return NULL, it
> returns a PHP NULL - the behaviour I'd expect (I'm not sure if I'm alone
> in this thinking?).
> 
> I hope I haven't completely misunderstood the issue at hand...

No, that sounds about right.  But I need to consider whether to do this
for all pointer (object, char*) returns or just those that may return a
C NULL in non-error situations.

Maybe patching SWIG_SetPointerZval to do the ZVAL_NULL work would be
another choice?

Dave





More information about the redland-dev mailing list