Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94179 invoked from network); 7 May 2013 19:24:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 19:24:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=zelnaga@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zelnaga@gmail.com; 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:39577] helo=mail-we0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/44-06696-CE459815 for ; Tue, 07 May 2013 15:24:29 -0400 Received: by mail-we0-f177.google.com with SMTP id q58so923085wes.36 for ; Tue, 07 May 2013 12:24:26 -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=PIj2/ST1tr996cmzf8343wuTFHHQWg8D2v3wC1dHP6g=; b=jRnNNrC9x2tM198XkCmphsVl4paPcPuzki6u/YbPwNrMf9K4mCEcj3xHG6osXvfka3 YmYoZge7/7BE20+H9eMfZQWw2J6aeUyxeQ2DMt83xD4yImZ4aV1dnLvVt6JHRMN7F0Sr nGrvlOH32aKdAqUOSHSO7XqLmn2qME8TTlOsecGt+9M+tx7pLXi6ER0QNVQA5d1b3Tum P7D7UGiFYTdGV/xc+BNTT6bl4Ksl/vPbyegksWxFZcNoW0uyRBGAoCkLy5Rp7ATNODxk 9968lDIOZmOGVLuHXV4USbuT+8TQ15QlckurZHswHUjLzW9x/SEOeESuzCu6eHRLU7Hz QtOw== MIME-Version: 1.0 X-Received: by 10.180.185.207 with SMTP id fe15mr5429162wic.33.1367954666217; Tue, 07 May 2013 12:24:26 -0700 (PDT) Received: by 10.194.77.48 with HTTP; Tue, 7 May 2013 12:24:26 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 May 2013 14:24:26 -0500 Message-ID: To: Sebastian Krebs Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c36760f2e52e04dc25c366 Subject: Re: [PHP-DEV] idea: letting the line number and file name be set via user_error From: zelnaga@gmail.com (Thomas Anderson) --001a11c36760f2e52e04dc25c366 Content-Type: text/plain; charset=ISO-8859-1 On Tue, May 7, 2013 at 2:04 PM, Sebastian Krebs wrote: > > > > 2013/5/7 Thomas Anderson > >> If you do user_error('whatever') it'll show, as the line number for that >> error, the line number on which that user_error() call is made. It'd be >> nice if you could control the line number and file name that was >> displayed. >> eg. >> >> > function test() { >> user_error('whatever'); >> } >> >> test(); >> ?> >> >> That'll say "Notice: whatever in ... on line 4" (ie. the line that the >> user_error is on) instead of "Notice: whatever in ... on line 7" (ie. the >> line that the call to the test() function is made). >> > > Something I don't understand: You call test() in line 7 and line triggers > the error, so in fact it is _really_ line 3, that causes the message. So > why should it display "line 7", when it is obvious the wrong line? > > I thought half the point of OOP was to abstract away the internals and as is the error messages don't make much sense unless you *do* consider the internals. Like let's say you have a bignum library and you're doing $fifteen->divide($zero) on line 5 of test.php. Seems to me that it'd be more useful to say "error: division by zero" on line 5 of test.php instead of line line xx of file yy. It's like... "ooh - let me try to find where I'm doing division by zero. Let me to line xx of file yy that I didn't even write and don't know a thing about. ok... so it looks like that's in the private _helper_function(). And _helper_function() is called by 15x other public functions. I give up!" As an end user of a library you shouldn't have to actually look into that library if you're the one who's not properly handling something. --001a11c36760f2e52e04dc25c366--