Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47842 invoked from network); 5 Nov 2015 15:14:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2015 15:14:51 -0000 Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:33575] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/A3-24765-A627B365 for ; Thu, 05 Nov 2015 10:14:51 -0500 Received: by wmeg8 with SMTP id g8so17096112wme.0 for ; Thu, 05 Nov 2015 07:14:47 -0800 (PST) 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=Aj8MQ8Iqj1713FAvJnIlCOnmmclQfw1oM6BPN/6XNs4=; b=VFhNvEkHNwpdi930mkLdXFFEY83+nq4YvMNTbZ6Oje5i7mXsjBMLEculHGOw+mF5tn uIglRVzIUcVnFWHIeiOka4RRv/kUjRpu+HoTxIvBIywWbEI7q4QWo8dt4S1s+vXHLQ6i t9csZAz+iKoVBnXmC/2CH0qYRMdnV9kO1BAO9K6tBOWWr4AiyRpkj1NKuf5gfJKD19GA 8IyWcmSP4pfWONHQePv8wuGd0ZY5h0qIF0EeBfqwu7Ept7kiQgYFfJFE7+4LmkKdvUj9 kqtqXCAVl8zJc/D8pRwkUg99KowpLwYvfc1QHQJMLu5kpTShC6Xp85J9hpbBISAHvDNl LGEw== MIME-Version: 1.0 X-Received: by 10.28.229.70 with SMTP id c67mr4727078wmh.48.1446736487191; Thu, 05 Nov 2015 07:14:47 -0800 (PST) Received: by 10.28.145.200 with HTTP; Thu, 5 Nov 2015 07:14:47 -0800 (PST) In-Reply-To: <563B6ED1.1030601@gmail.com> References: <563B6ED1.1030601@gmail.com> Date: Thu, 5 Nov 2015 15:14:47 +0000 Message-ID: To: Rowan Collins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a1145b94a671a920523cc96ac Subject: Re: [PHP-DEV] Null bytes in anonymous class names From: leight@gmail.com (Leigh) --001a1145b94a671a920523cc96ac Content-Type: text/plain; charset=UTF-8 On 5 November 2015 at 14:59, Rowan Collins wrote: > > PHP uses null bytes quite a lot to produce deliberately illegal > identifiers. For instance the old eval-like create_function() [e.g. > https://3v4l.org/hqHjh] and the serialization of private members [e.g. > https://3v4l.org/R6Y6k] > > In this case, I guess the "@" in "class@anonymous" makes the name illegal > anyway, but I'm not sold on the null byte being more unacceptable here than > anywhere else. > > Regards, > > -- > Rowan Collins > [IMSoP] > > That doesn't mean it's a good approach (*cough* namespaces *cough*), and these bits of "magic" are supposed to be hidden away from users. I'm guessing in this particular instance, the point of the null is to make string operations cut off after "anonymous", however string operations that respect the zval string length aren't going to do this. e.g. var_dump() the class name is put through sprintf and it cuts off at the null, but get_class or ReflectionClass::getName() just returns the original string, and exposes the implementation details. --001a1145b94a671a920523cc96ac--