Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101287 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42119 invoked from network); 9 Dec 2017 23:49:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2017 23:49:44 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.220.179 mail-qk0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:43144] helo=mail-qk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/F8-62356-7967C2A5 for ; Sat, 09 Dec 2017 18:49:44 -0500 Received: by mail-qk0-f179.google.com with SMTP id j207so3092639qke.10 for ; Sat, 09 Dec 2017 15:49:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=fOQJ4fFXkglNtyTa0m0Ctcyv0a8AcELSZRDUIiH8jDQ=; b=KrXtz5I1SQtvje4XdoxPvrHLknlfAw0II7FZvwlzZppNTNiJBXMHVJv2dQvk8dpDNq 8Cv7quAP+mbf5G81W2QHiKqGjgCwWd8CVNUBMqs/DCQ6GwXbyx+PindzszMEFrC7nu0j 8Hd6yOKoAofCl81y+0zolIIKsba/dVIFRYfwwCNE+PkXvs3h3RF1CtQU+ZPF0LFu3f/E DQY4gBrvJcKgwXzCKfFHOoJ6L7vBLMshzLPraIy65b2A/Rg9+oRKB0T9oe5/eXuHyZdN 1cN3zugWTVtMCyaoF98Wvss8ksr1zYTYNkPsswuPheU4q3sJXAeDPu3lNZEkkVwA0V3D IJtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=fOQJ4fFXkglNtyTa0m0Ctcyv0a8AcELSZRDUIiH8jDQ=; b=dttp7ZwKmFojlJuQxum1l4N018nqp0CYCfzt75xS8v0EpE65HNe9Va8tkqW2T4iqe+ G4fQdy3sEvNWFz8P/je3ZmYRfi4y9Ni8TT90FupKIOWQYiv3WZ4MMTGOA2bKnXd2eD3+ 7uqOWAsCuBBtZ0okTc8IbEBa03pgxMowMpTqQoB7CHNI4Raj+02LHX2qWEFbPIDRdOzB RT78qySvgve/SYhTUss5t+jUBxOuC4xSNcaUTchCHZ95YOXC/64AzyClMdW8QBgCdT1X HaRJBOajed5R2EiPMq2qUV6/jnVjyP1Vrr0wGpFexcGdlICS+RYWlr+TzcygJ/s0jxhd tXgQ== X-Gm-Message-State: AKGB3mKIB144orQNRukdAp+aOsgdxFcf4pyntq085TCHK0TmP7BtJ9D/ haOWnC42mA+4BVc8Q/R6DIbdFEmheItusMoPjN5MsrRk X-Google-Smtp-Source: ACJfBovIrZAtcwv3QcyU+FF4CogQYHDrBg5Mq+8F+0n6CyAS1wfi+ANzM5HxYI/Cktbq9Pds58iKnSshlaFomt/OGTI= X-Received: by 10.55.200.90 with SMTP id c87mr11468795qkj.132.1512863381348; Sat, 09 Dec 2017 15:49:41 -0800 (PST) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.12.158.145 with HTTP; Sat, 9 Dec 2017 15:49:40 -0800 (PST) X-Originating-IP: [71.251.16.204] In-Reply-To: References: Date: Sat, 9 Dec 2017 18:49:40 -0500 X-Google-Sender-Auth: hnYTqJeURrzqjQuaENkOxqbkMxE Message-ID: To: Andreas Hennings Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] instanceof survives non-object variables, but crashes on non-object constants. From: pollita@php.net (Sara Golemon) On Sat, Dec 9, 2017 at 1: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 is one option, and it is BC. > > - Let 1 instanceof \stdClass return false, instead of crashing. -> seems BC > This. There's nothing undefinable about "1 instanceof \stdClass", the clear and obvious answer is: "No, it's not an instance of \stdClass, it's an integer." The runtime result of false makes sense, the compile time error doesn't. Let's relax the compile time error (fold it into a const false if you truly must) and call it done. There's no need to be hostile to users just because the code *seems* silly. -Sara