Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67364 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16899 invoked from network); 7 May 2013 20:46:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 20:46:33 -0000 Authentication-Results: pb1.pair.com header.from=zelnaga@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zelnaga@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.177 as permitted sender) X-PHP-List-Original-Sender: zelnaga@gmail.com X-Host-Fingerprint: 74.125.82.177 mail-we0-f177.google.com Received: from [74.125.82.177] ([74.125.82.177:36077] helo=mail-we0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/29-06696-82869815 for ; Tue, 07 May 2013 16:46:33 -0400 Received: by mail-we0-f177.google.com with SMTP id q58so987350wes.8 for ; Tue, 07 May 2013 13:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=uq+mlPNaS1jlAIg02w/9Bcl6HeqZgmEunICEn3wpshY=; b=koVyy4oRFACajBHJuM7YBSSxMB27y1ftRoxjNEWcJ4hQcLMF5BHfQ3wUrUPWsLe+PP kuWLJb6j3pa460osl6orGfXlgOMYg/c2xBP7TaXD3P0ANajiBSYU1ePW73I5NHo58ch+ tKhK0Jo2UPAVutqgfoKn8u3dQylz9CFmVfpjv/fXNa5kWf/6rtQWyBs0g/A+JL8d+rlP APn0nIaPdCHl7xT+zpbqterIiWlKsvl6z7chVrVPhsH7/MWNMpqkIWVLIRewzvUwSv89 C390g/jfUgxC+wgNw7SMV0oMLEvOl1VAim557CxVII8WwC5d4V/TfsLuMLjil0lRnz4u MfbQ== MIME-Version: 1.0 X-Received: by 10.194.92.176 with SMTP id cn16mr5952450wjb.51.1367959589777; Tue, 07 May 2013 13:46:29 -0700 (PDT) Received: by 10.194.77.48 with HTTP; Tue, 7 May 2013 13:46:29 -0700 (PDT) In-Reply-To: <51896633.7000206@sugarcrm.com> References: <51896088.4070907@sugarcrm.com> <51896633.7000206@sugarcrm.com> Date: Tue, 7 May 2013 15:46:29 -0500 Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7beb986e6a783b04dc26e9d8 Subject: Re: [PHP-DEV] idea: letting the line number and file name be set via user_error From: zelnaga@gmail.com (Thomas Anderson) --047d7beb986e6a783b04dc26e9d8 Content-Type: text/plain; charset=ISO-8859-1 On Tue, May 7, 2013 at 3:38 PM, Stas Malyshev wrote: > Hi! > > > So the error messages your library produces have the same consistent > > look and feel to them that PHP's errors do? > > While it may be nice, I don't think it is worth changing the PHP API > for. Error messages have very defined api, which has the place in the > source where they were actually produced. > So just redefine the API lol. ie. make it so trigger_error has this as its function definition: bool trigger_error ( string $error_msg [, int $error_type = E_USER_NOTICE [, string $errfile = __FILE__ [, int $errnum = __LINE__ ]]] ) > > > Besides, keeping in mind the KISS "keep it simple stupid" principal > > gratuitous information should probably be hidden away. I mean if it's > > not going to help anyone then the only thing left for it to do is > > potentially confuse people. And why risk that? > > The place where the error is produced is definitely helpful. Now, it may > not be *all* the information you need, but error messages are simple > things, they are not meant to replace debugger with full backtrace and > stack inspection. I don't think it needs added complications just to > have some library messages look a little nicer. > In any case, one can install custom error handler which would format > messages for user errors differently, if desired. > > You shouldn't need to load up a debugger with a full backtrace and stack inspection to figure out (from my previous example) that you had a divide by 0 error. That said I will concede the "look a little nicer" point. I guess, in my mind, it's really just a matter of how many code changes would be required. If 10,000 lines of code in PHP would have to be changed... it's not worth it. If all you'd be modifying are two lines of code... doesn't seem like such a big deal to me. Besides, what if a program already has an error handler defined? --047d7beb986e6a783b04dc26e9d8--