Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80452 invoked from network); 26 Aug 2011 07:51:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Aug 2011 07:51:10 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:46626] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/60-12710-C60575E4 for ; Fri, 26 Aug 2011 03:51:08 -0400 Received: by gxk27 with SMTP id 27so3156214gxk.29 for ; Fri, 26 Aug 2011 00:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=YN75f0xREYHmOCe8Au6N7S3NDATlXfdZBapUl/SF0Cc=; b=BgUQC9Me7NXmY0yKdfp2y/tlfXa7g3gjsHx5z08lkyw45LlJO2jRyg3r3oj8UsXkio pU9HM7QUMrmTy14vbyC0F95eOOFVfZxOkyxy+TIfH6NgdsHXQ8FN8c8y2Y9D80spx9if Z6FQhGPC/ovAywsJJfYHrJvFWIcTTIgAUq5U4= MIME-Version: 1.0 Received: by 10.147.54.19 with SMTP id g19mr741221yak.21.1314345065621; Fri, 26 Aug 2011 00:51:05 -0700 (PDT) Received: by 10.147.168.14 with HTTP; Fri, 26 Aug 2011 00:51:05 -0700 (PDT) In-Reply-To: <4E5619ED.40609@php.net> References: <4E5619ED.40609@php.net> Date: Fri, 26 Aug 2011 09:51:05 +0200 Message-ID: To: Sebastian Bergmann Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] ReflectionClass::newInstanceWithoutConstructor() From: tyra3l@gmail.com (Ferenc Kovacs) On Thu, Aug 25, 2011 at 11:46 AM, Sebastian Bergmann wr= ote: > =C2=A0I have attached a patch to https://bugs.php.net/bug.php?id=3D55490 = that > =C2=A0implements ReflectionClass::newInstanceWithoutConstructor() to crea= te an > =C2=A0object a class without invoking the constructor. > > =C2=A0As there are certain internal classes that would "crash" when their > =C2=A0constructor is not invoked, this new method of the Reflection API o= nly > =C2=A0works for userland-defined classes. > > =C2=A0Unless there are objections, I will commit this change to PHP_5_4 a= nd > =C2=A0trunk on Monday. I will add the method to the documentation as well= , of > =C2=A0course. > > -- > Sebastian Bergmann =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0Co-Founder and Principal Consultant > http://sebastian-bergmann.de/ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://thePHP.cc/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > hi Sebastian, would this method give the same result as unserialize("O:8:\"stdClass\":0:{}") for example? I used this trick in the past when I needed to instantiate a class without calling it's constructor. of course having a dedicated method for this is much more convenient --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu