Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62005 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71104 invoked from network); 3 Aug 2012 14:19:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2012 14:19:24 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 74.125.83.42 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 74.125.83.42 mail-ee0-f42.google.com Received: from [74.125.83.42] ([74.125.83.42:46983] helo=mail-ee0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/7A-09659-BEDDB105 for ; Fri, 03 Aug 2012 10:19:24 -0400 Received: by eekb15 with SMTP id b15so200865eek.29 for ; Fri, 03 Aug 2012 07:19:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:from:to:references:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :x-mailer:x-mimeole:x-gm-message-state; bh=YzWp36vR3wyEoqQkZYWUksqqvJWeEmCOAybqxPOlh1Q=; b=krJUeZQ8T202IUh56CuoyeBd2AvToBjTvgC54Uw+RD8/R/HWgPw+f0NPR9BmkJLFzx 1yXyJQF8FmTClTSRxDEjkKqT8IPg6TWF4PkknKJj6idjqQ2aPWEE43DeQO/dDVG5ZLHE 13U9z+Tcv2jNJJJW2nWayJ0i1AdYfBbVU6cKVsGjG41yrLC4c9oRk55WC0imZppqcGU7 10BgrcER0/NMMN2M3BRcJMnL7o93KNNrPQoV20E2wpgFwbKoDBIt1eNP9+IRVYBJPq26 h+oQZEvdzXsdQcpnBoJD2/FHZz+lEZouIxg7NsmOJJBiIgzxQ38EiF19Hpc9wdQ6Y8XK dOeQ== Received: by 10.14.202.5 with SMTP id c5mr2299690eeo.43.1344003560743; Fri, 03 Aug 2012 07:19:20 -0700 (PDT) Received: from pc (87-126-4-134.btc-net.bg. [87.126.4.134]) by mx.google.com with ESMTPS id q3sm22913605eeo.4.2012.08.03.07.19.18 (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 07:19:19 -0700 (PDT) Message-ID: <3F2B7A4F937D4FA9A1CE88818CBCEB1D@pc> To: "Leigh" , References: Date: Fri, 3 Aug 2012 17:19:05 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Gm-Message-State: ALoCoQnl0FNhRTuJDW/RlesbbtU14G1ulwTYSN/KylbcIgT0L+uDZMRClxIxo3WXWcywZ4MPFtIS Subject: Re: [PHP-DEV] Why do disabled functions / classes generate a WARNING. From: sv_forums@fmethod.com ("Stan Vass") > Hi all, > > Can anyone explain to me the reason that when a function or class is > disabled via the ini setting, an attempt to access the disabled item > generates a non-fatal error? > > I'm looking at a segfault in the SPL caused by the blind creation of a > class, which seems to only fail when the class is disabled. I'm > wondering in how many other places this could occur. > > The obvious solution is to be more careful and check return values, > but a FATAL would also have prevented execution continuing. > > Thanks, > > Leigh. PHP has a long history of issuing errors of the wrong type at the wrong time. My experience shows it's best to have an error handler convert all errors to catchable exceptions, with some error types (like E_STRICT, E_ERROR etc.) to become instant fatal errors (can't be caught). This would also solve your use case since the warning will become an exception with a stack trace clearly pointing to the origin of your problem. Additionally you can handle an exception on a higher level in the stack once instead of doing it for every function/class call. I'm afraid fixing the default behavior is a big hopeless since it'll break BC and require a major rethinking of the way PHP issues errors. See: set_error_handler(). Stan