Re: How should one check if a zval is "undefined" ?

From: Date: Wed, 07 May 2014 05:58:14 +0000
Subject: Re: How should one check if a zval is "undefined" ?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-73995@lists.php.net to get a copy of this message
Hi,

On Wed, May 7, 2014 at 10:45 AM, Aaron Lewis <the.warl0ck.1989@gmail.com>wrote:

> Hi,
>
> I'm trying to check if a zval is undefined,
>
> But Z_STRLEN_P(return_value) == 0 seems incorrect, 'case the strlen
> part sometimes returns a negative value
>

Shouldn't you already know whether you had set return_value to something
in particular?

In any case, undefined (or null) is defined as a special type:

if (Z_TYPE_P(return_value) == IS_NULL) { ... }



>
> So, what's the right way to do it? Even regardless of the zval type
>
> --
> Best Regards,
> Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
> Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
--
Tjerk


Thread (2 messages)

« previous php.internals (#73995) next »