Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54078 invoked from network); 3 Aug 2012 11:59:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2012 11:59:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qc0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:63317] helo=mail-qc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/87-09659-C2DBB105 for ; Fri, 03 Aug 2012 07:59:40 -0400 Received: by qcmt36 with SMTP id t36so346554qcm.29 for ; Fri, 03 Aug 2012 04:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=krdPgjKhw9W0ZwThF4gJ/rSmgQ46XRFcTHO5gmFRp0A=; b=fC5C2FA2xbtdwHXQDT4eyKS5tcYn+Fsg/whNpIo958l9O3wG0C68JLB3yvMfBgOU3/ Fo7m8DFEOmzda0IgIXLFctOU/ZzKhUF1RyZzLct9Y3V0QFsDBdQCq1pQCg6liDKAwCvC qF+nZz4rperiV7SLGPInqmaGeB9gEUT2Bs9c+E6pZMgDmf27A4wLpD0JJw9j/Srz2xBs tR0Rz+Wu8AD4G6VQgN6CKaDqY4ne6nP6DtBEGZpVPiM62zAkG97wT1CsyrIn6eH+frhh POcmzHMWpXAIjFR8XDTBOGrTJhRQML9JEOZY92PJc4bP8WVln3izeHgm2lMq0GAn2SF2 HiCA== MIME-Version: 1.0 Received: by 10.224.217.7 with SMTP id hk7mr2273283qab.9.1343995177789; Fri, 03 Aug 2012 04:59:37 -0700 (PDT) Received: by 10.229.149.203 with HTTP; Fri, 3 Aug 2012 04:59:37 -0700 (PDT) In-Reply-To: References: Date: Fri, 3 Aug 2012 12:59:37 +0100 Message-ID: To: Hannes Magnusson Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Why do disabled functions / classes generate a WARNING. From: leight@gmail.com (Leigh) > Because there isn't anything actually wrong. > > A fatal error is reserved for things we cannot recover from, but a > disabled function is easily recoverable. I don't see how it is any more recoverable than the function/class not existing at all. How much code do you know of that checks for the existence of every function it expects to be there, before using it? The matter is even worse with classes, since creating a disabled class does not return null. It returns an instantiated object with no methods. When an unexpected function is disabled, the engine can recover, sure. The code, probably not. In my opinion it's better to stop the code doing something potentially harmful than allowing it to continue with bad data. It seems inconsistent to me. -- $a = new UndefinedClass; // PHP Fatal error: Class 'UndefinedClass' not found -- $a = new DisabledClass; // Warning var_dump(get_class($a)); // string(13) "disabledclass" -- $a = undefinedFunction(); // PHP Fatal error: Call to undefined function undefinedFunction() -- $a = disabledFunction(); // Warning var_dump($a); // null