Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97835 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49838 invoked from network); 17 Jan 2017 21:42:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2017 21:42:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.216.180 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.216.180 mail-qt0-f180.google.com Received: from [209.85.216.180] ([209.85.216.180:36192] helo=mail-qt0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/7E-00729-CDF8E785 for ; Tue, 17 Jan 2017 16:42:53 -0500 Received: by mail-qt0-f180.google.com with SMTP id k15so182204367qtg.3 for ; Tue, 17 Jan 2017 13:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X6owax31QptWHe9lHfclbv6opn10UcXEUW3VyuIoGjI=; b=WnchnX0yo5HqT1vRl+UT/v2fpTwTqowliupFSeQprTVsA6Cc02aYNDrC8E1eTYb3x4 Wqh1ycJ0+6Ixn9coJaOCu1vRy5XsW/vQCpCU/aNV8G5bYSTFAoMlLdkvfJ4QyGJlYj0C 6+petzcq1AOEEgv2da3eUXXO4OYes1p1j3HdGqa0icOLVwhf6e5DmSdybaxHFXcSVOIs qSR+nxsSPjaRx0RPaoTLHcHsjq0ZUKlZ65K3cH6Tib6wtiRNTP6Ds0YgDctrMQCKEDyX g0amA3oB/cYPWjRQ+NVDJR1UF6Y8hjf5a8JzDFklTiO/HHuoWwwePggJ1l+9BFNKTedv hkDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X6owax31QptWHe9lHfclbv6opn10UcXEUW3VyuIoGjI=; b=d5Dm19QIraH8mMmHEB3VN+m3empUhCx/kwXBu/O/O1ZBClFVN1wmNYGU7fu76sGbhy FR4SJQsSYASoG4tqtJbTxc5uC9izsXNLU0sv0ZpeYE47NES7PkWGmZAFgcGIQox7CAYO zDa20mkb7fwvE6JqD9lLAzd783tsrasmJkkpsd5ZieH/7c6JxjcZVduIjKegLBMX63us RFczV2cUZrcxcvMUezlyy1kulfPQxiHvdnQgxTw7IuQpuTsoePOiCAfmmSsMslTj/wN+ ARCKtQPPNwRHyi3oNnnacC1+2Qs/mepHfB0lBiUxes48z01nFpvM+RKcx+/OkkRD6p7a t+aw== X-Gm-Message-State: AIkVDXLCs1ywtjpzVZ7TwECIRud9MElQJo7LG+QKTozU5WtPvhgZqCrUYl1E4VO2Y6rZ9DIR3AI35yoSbIfOoA== X-Received: by 10.200.47.129 with SMTP id l1mr35417058qta.148.1484689369375; Tue, 17 Jan 2017 13:42:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.47.231 with HTTP; Tue, 17 Jan 2017 13:42:48 -0800 (PST) In-Reply-To: References: Date: Tue, 17 Jan 2017 22:42:48 +0100 Message-ID: To: Dmitry Stogov Cc: Bob Weinand , Joe Watkins , PHP internals list Content-Type: multipart/alternative; boundary=001a113776f276d3870546512e99 Subject: Re: [PHP-DEV] Typed properties problems From: rasmus@mindplay.dk (Rasmus Schultz) --001a113776f276d3870546512e99 Content-Type: text/plain; charset=UTF-8 On regular PHP 7, the array weirdness (Dmitry's last example) doesn't even produce a warning: class Shit { public $yo = false; } $shit = new Shit(); $shit->yo[] = "what"; // quitly turns $yo into an array! echo gettype($shit->yo); // array That's pretty messed-up right there. At least in the object cases there's an E_WARNING "Creating default object from empty value" - with the array case, nothing, it just converts your boolean into an array. Yiiiiikes. On Tue, Jan 17, 2017 at 11:03 AM, Dmitry Stogov wrote: > Hi Bob, > > > I've found a number of problems: > > > $ sapi/cli/php -r 'class Foo {public bool $b = false;} $x = new Foo; > $x->b->ops += 5; echo gettype($x->b),"\n";' > > object > > $ sapi/cli/php -r 'class Foo {public bool $b = false;} $x = new Foo; > $x->b->ops++; echo gettype($x->b),"\n";' > object > > $ sapi/cli/php -r 'class Foo {public bool $b = false;} $x = new Foo; > $x->b->ops = 5; echo gettype($x->b),"\n";' > object > > $ sapi/cli/php -r 'class Foo {public bool $b = false;} $x = new Foo; > $x->b[] = 5; echo gettype($x->b),"\n";' > array > > Thanks. Dmitry. > > --001a113776f276d3870546512e99--