Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75660 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54887 invoked from network); 17 Jul 2014 08:23:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 08:23:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.41 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.192.41 mail-qg0-f41.google.com Received: from [209.85.192.41] ([209.85.192.41:41260] helo=mail-qg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/39-09067-8E787C35 for ; Thu, 17 Jul 2014 04:23:05 -0400 Received: by mail-qg0-f41.google.com with SMTP id q107so1743347qgd.14 for ; Thu, 17 Jul 2014 01:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Z0i2aRjvbD/NFNwQpy5bnLfafv/b7kdRagZC4CKu+vw=; b=XXBFul2+caItwziWEFD2FoktfvLVMulcM+pfOX1zp9BBW/aHr8WufKqBtczAEcjR6f wpW0Jyv0D5cccX2IY9MPZKLUpgVA6zUOCefkzwLm6cumjpqEhcxzCyXWot+IPT97f9Gm 0DMLPPTDspQ8SI8bB6Es+wA/2pvpC/jkoCdV+uLcdmv47oAdb/c+8aXn5m8VFc+RTuck aEZlS3+nGILkTSPU3ZBlQh4lxL1m7Nu64JkVkluSYL+Pr9M+QF4Qb5AFOEXXv2TLc0Z4 bP5NeOGxAwHRTOqB1EFARl5b1AINXgtVawOWilYp1mqBUfZVQSEVuceqPG49aqcjeK43 oXWg== X-Received: by 10.224.29.201 with SMTP id r9mr54419254qac.25.1405585382206; Thu, 17 Jul 2014 01:23:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.21.81 with HTTP; Thu, 17 Jul 2014 01:22:42 -0700 (PDT) In-Reply-To: <53C7821F.8040301@sugarcrm.com> References: <53C75A89.5000401@fedoraproject.org> <53C7685B.3040302@sugarcrm.com> <248a94f0ee70cf99ffbb0f204443ebbf@mail.gmail.com> <53C7709D.5060208@sugarcrm.com> <53C7821F.8040301@sugarcrm.com> Date: Thu, 17 Jul 2014 10:22:42 +0200 Message-ID: To: Stas Malyshev Cc: Zeev Suraski , Laruence , Remi Collet , PHP Internals Content-Type: multipart/alternative; boundary=047d7bf0cad468721804fe5f593c Subject: Re: [PHP-DEV] An BC issue in unserialize From: ocramius@gmail.com (Marco Pivetta) --047d7bf0cad468721804fe5f593c Content-Type: text/plain; charset=UTF-8 On Thu, Jul 17, 2014 at 9:58 AM, Stas Malyshev wrote: > Hi! > > > As discussed in previous threads about this failure, we (doctrine) can > > move away from the `unserialize()` hack if > > `ReflectionClass#newInstanceWithoutConstructor()` provides support for > > internal classes. > > Could you explain why it is needed to instantiate internal classes > without calling the ctor? I'd like to understand the use case more. > I honestly don't have a use-case for it myself, and I also strongly disagree with extending internal PHP classes due to their fragility. What I know is that many Doctrine users extend `ArrayObject` in entities, which is what caused us to apply a hotfix only for 5.4.29 and 5.5.13, and NOT 5.6.0. > > It doesn't need to cover ALL internal classes, just the most commonly > > extended ones. > > The problem is we do not know which of these classes may fail if > instantiated without initializing. With PHP classes, it's easy since the > engine takes care of the basic plumbing. With C classes, if you don't > call the function, you get nulls or worse, garbage, in places where > values are expected. Yes, that indeed. What I am suggesting is to provide a small map of internal PHP classes that are supported by `ReflectionClass#newInstanceWithoutConstructor()`, so that their internal data can be initialized even if the userland constructor is not invoked. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --047d7bf0cad468721804fe5f593c--