Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101397 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67378 invoked from network); 19 Dec 2017 21:48:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2017 21:48:15 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.180 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.223.180 mail-io0-f180.google.com Received: from [209.85.223.180] ([209.85.223.180:43891] helo=mail-io0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/E7-10479-E19893A5 for ; Tue, 19 Dec 2017 16:48:14 -0500 Received: by mail-io0-f180.google.com with SMTP id k202so6887385ioe.10 for ; Tue, 19 Dec 2017 13:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nWT2QfjvNWlDNnHmlD2IxOAq/9eT/6wbcQkEPluiGHg=; b=ln+HCB1Gko9L93x4Rqw9IWahPwt9I1PXGRg6HtDW8p4S8IciGd0DdmWuumjd3ljIiY V67s1iIp8sVqCduAhHvkrA5GWYgizJOZQMVd76CbvhX4IO8vaf1oquZUrb7TiOwva9zU uzxeH6oM25oqGpmSW+/lg5vphhylc0zb6gnoN4iuWcOamHvsaaI5uu7ZWSI+gnt8gZct 1j2ozEB5TWoh1d2EtNw+Vbir0zmAkkEJ3GEChWe0nFxJpLGZ4N/tjMQZQFRo2a2Vg/+/ 6iF3E8Ua97QevYELDaiO7djDCyTx/hHPGqE0VQ4xncIoIvQmt++Htm9mjBJPWF4jHgGw w+IA== 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=nWT2QfjvNWlDNnHmlD2IxOAq/9eT/6wbcQkEPluiGHg=; b=MLTCTH6fQ0uaaZV4zYYi+uiBWqyNtm+fFzvchAu4LmvTWTufNv49lniU+zGJzZ4b/M RZjVBhW7Ii5OVq9ro/umSxibfDSCSuPqGmO0FwLTyof257b5Nv/xqzxf1nO8fP7SBcCT Z/D7OLyZz+9izIO5KSackAMNMmsgruWp1Nz2+VkFMin3MCiYryhL2JTMpt9kdT5fw0cD /Z+6XTmB8IHRNRe3nZfojidMWIZ15LssmOwCY0okXdNG5vJipvYLU+1BOoscd2dRqjd/ LNDAOs/7PCFx9HhUrIkinT1tMN8AGxvheySPqBPX9o91eZimQa9s6q4/cHGDFdF+mo6T WL6w== X-Gm-Message-State: AKGB3mK/t5d5bj5mUvd86g3sNqGvF7ATMo9jeEkSGSWrDfkzRow4rAdF el1X/oNC88DJ1xolFczGgoE/QKRtI2pLAyjddEeDSw== X-Google-Smtp-Source: ACJfBot1HeR2qrtXlOrQapx5c9Bjt6Z/aElhROSBmZU3rxCtHlH670H2N5hZyPR5c3h8ZVQnfwYQOTvJ1w0FbvnA0v0= X-Received: by 10.107.17.33 with SMTP id z33mr406986ioi.219.1513720091308; Tue, 19 Dec 2017 13:48:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.173.139 with HTTP; Tue, 19 Dec 2017 13:48:10 -0800 (PST) In-Reply-To: References: Date: Tue, 19 Dec 2017 22:48:10 +0100 Message-ID: To: Andreas Hennings Cc: PHP internals Content-Type: multipart/alternative; boundary="001a113f729254f8980560b86ca3" Subject: Re: [PHP-DEV] instanceof survives non-object variables, but crashes on non-object constants. From: nikita.ppv@gmail.com (Nikita Popov) --001a113f729254f8980560b86ca3 Content-Type: text/plain; charset="UTF-8" On Sat, Dec 9, 2017 at 7:28 AM, Andreas Hennings wrote: > The following (https://3v4l.org/A2Tp6) is ok, it simply returns false: > > $x = 1; > $x instanceof \stdClass; > > > The following (https://3v4l.org/IdSBu) gives a fatal error: > > 1 instanceof \stdclass; > > t think this behavior is inconsistent, and we should consider changing it. > > There are two options, but only one is BC. > > - Let 1 instanceof \stdClass return false, instead of crashing. -> seems BC > - Let $x instanceof \stdClass crash, if $x is not an object. -> BC break. > > So it seems the first would the option we should take. > This is also what hhvm does, according to https://3v4l.org/IdSBu. > I've prepared a PR for this change: https://github.com/php/php-src/pull/2978 From the discussion I'm understanding that our consensus is to implement this change, so if there are no further objection I'll merge this in a few days. Nikita --001a113f729254f8980560b86ca3--