Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73995 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10045 invoked from network); 7 May 2014 05:58:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2014 05:58:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:46114] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/51-32043-97BC9635 for ; Wed, 07 May 2014 01:58:18 -0400 Received: by mail-vc0-f173.google.com with SMTP id il7so642971vcb.4 for ; Tue, 06 May 2014 22:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+JHi3RHmLguZ2TDTHmqozoZiTtH1m9OQ/hq+PHTtENA=; b=XlKbJOBE0sXUjOomglUsowHyu1RY2B8S5ONLQdSBpAz+YVw6Uoc7K23x6uQNGQXze3 SHvaR1U5mYj5Pph+NqgmmwrDMwASspBXPgiN3CudE7pCZVEIN7IrxM/cGGoNV169+lHQ JdknUpOOOAbshQPpgUM6lpQZE5DULl1dpnYN4252+oiK3/hhmYtxFwc20fgC7/RNu4aJ FF38t6mqv3FNxAXF4r0St2DGzEvd7Oh5ZSglTt2B1u8pK2XBsCFyuxwGTjHGX+YsXtAO KMkKd1oAv20YN+PsUjwLYMBxX8V1H7tO6x26++UOMiGVBADaTrYkDfuiSRk1uxHETNKD 3gXg== MIME-Version: 1.0 X-Received: by 10.58.34.67 with SMTP id x3mr1545419vei.37.1399442294995; Tue, 06 May 2014 22:58:14 -0700 (PDT) Received: by 10.58.133.84 with HTTP; Tue, 6 May 2014 22:58:14 -0700 (PDT) In-Reply-To: References: Date: Wed, 7 May 2014 13:58:14 +0800 Message-ID: To: Aaron Lewis Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e013a0d72e07ff904f8c90c03 Subject: Re: [PHP-DEV] How should one check if a zval is "undefined" ? From: tjerk.meesters@gmail.com (Tjerk Meesters) --089e013a0d72e07ff904f8c90c03 Content-Type: text/plain; charset=UTF-8 Hi, On Wed, May 7, 2014 at 10:45 AM, Aaron Lewis 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 --089e013a0d72e07ff904f8c90c03--