Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81421 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24780 invoked from network); 30 Jan 2015 10:54:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2015 10:54:29 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:36702] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/50-23158-4E26BC45 for ; Fri, 30 Jan 2015 05:54:28 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so2136595wiv.0 for ; Fri, 30 Jan 2015 02:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=m+QBd8xMXIgoKIPq7UZYIDAU7ckoe2hoMnJ2UBtD10I=; b=qCryERYf0x5dY30y0V6Efwk37Gu9KZGGSTN2yI4SuIkkvFid2aV7glvfuAx6o9oTic zLdLuxZORABbEOH1N3SF/Q5KErZZHtqx18RyHIyIekHgPiNbwKS8u09TKncpgAFkOILX lTR8ZRELItvH57vOHS6Z/68C88kurTrLi0H06eLCRSv3Bz6xP7lKa3zehD+jML9pfeMy B4deXkgeqL9WOrLJbItWgYHmVNGvLwelzRwU3g+cZ9Ift9ZEz/8FkDhzFdUHGsRoI0UD iZFPXndhTMnTdKV6okbHhFY+9Gb/Dl19TiZmksUibe6XKfIFegCfJdeazglc/qyKKw/p HMCw== X-Received: by 10.194.59.13 with SMTP id v13mr10530466wjq.62.1422614829030; Fri, 30 Jan 2015 02:47:09 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.170.193 with HTTP; Fri, 30 Jan 2015 02:46:28 -0800 (PST) In-Reply-To: <54CB13A4.9060900@rodas.me> References: <54CB13A4.9060900@rodas.me> Date: Fri, 30 Jan 2015 11:46:28 +0100 X-Google-Sender-Auth: yDDCyzORsJT9y-6LAc8dXooxqMQ Message-ID: To: =?UTF-8?B?Q8Opc2FyIFJvZGFz?= Cc: PHP Internals Content-Type: multipart/alternative; boundary=047d7b86c8b8896424050ddc539d Subject: Re: [PHP-DEV] Is it a good idea to have a "strict" mode? From: jpauli@php.net (Julien Pauli) --047d7b86c8b8896424050ddc539d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jan 30, 2015 at 6:16 AM, C=C3=A9sar Rodas wrote: > Hi! > > I'm wondering if it would be a good idea to have a `strict` mode in PHP. > Many language have them and it is a good idea. > > I think it should be a bit different in PHP, it should encourage the > following things: > > - Avoid deprecated things, it should throw an exception. > - Avoid explicit conversions of undefined constants to strings. > - Anything else that could make run-time slower *or* bad practice. > > ```php > "use strict"; > > var_dump(FOOBAR); // should throw an exception, undefined constant. > ``` > > Good idea? > This has already been debated. Use error_reporting instead. If you write "use strict;" in PHP, you'll hit a meaningful error message btw ;-) Also, syntax checks, etc... is the job of your IDE. Mine already tells me many things about unused variables, etc... Julien P --047d7b86c8b8896424050ddc539d--