Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67366 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32380 invoked from network); 7 May 2013 21:30:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 21:30:58 -0000 Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.181 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.181 mail-we0-f181.google.com Received: from [74.125.82.181] ([74.125.82.181:59088] helo=mail-we0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/6C-06696-09279815 for ; Tue, 07 May 2013 17:30:57 -0400 Received: by mail-we0-f181.google.com with SMTP id q55so1029495wes.26 for ; Tue, 07 May 2013 14:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=DtSqsC8XgKtsmH6h+5XoUBhehREMUBM6TsmOEmlB9LE=; b=QoqawysS5AgMDb/ZmvHVN3SRsBDFGU54/08okAUtSGfvcXwX8+nzrT8XRmCnko3Tw9 +RDeIU4RDhZmbKBJJk6dVcXobixr1e4Gsb2eo+OVx0YamHfD88rrQcdp4OISIrbBxJql GR/vCsZ7wNDkAofDzy5v2oM5dL4T6wy/gjA8oim4zE608vi/s5XhRQSyGMZ01UHW8ajk uMGB0NsoUkdNiBhS+PNmqAJ4J8RHH8mx0y8/4TJwx9qHev3PSyJMqsYA3xK2tSRqfH0D PdPCU2V6/XkUco0/NyuYiHIX92CqX8Q717IkvQpWGowoMxWBimETMUjfniC46MuFxNEv LykA== X-Received: by 10.194.158.37 with SMTP id wr5mr6160939wjb.23.1367962253971; Tue, 07 May 2013 14:30:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.79.142 with HTTP; Tue, 7 May 2013 14:30:33 -0700 (PDT) In-Reply-To: References: <51895FF2.3080809@sugarcrm.com> Date: Tue, 7 May 2013 23:30:33 +0200 Message-ID: To: Bob Weinand Cc: Stas Malyshev , PHP Mailing List Developers Content-Type: multipart/alternative; boundary=089e013c650a36d5e004dc27889a Subject: Re: [PHP-DEV] idea: letting the line number and file name be set via user_error From: krebs.seb@gmail.com (Sebastian Krebs) --089e013c650a36d5e004dc27889a Content-Type: text/plain; charset=ISO-8859-1 2013/5/7 Bob Weinand > > Am 7.5.2013 um 22:11 schrieb Stas Malyshev : > > > Hi! > > > >> And today we have the problem that we cannot use in any useful manner > >> trigger_error in libraries, when we don't know where the error > >> originates from. You debug today trigger_error's in libraries with > >> putting a debug_print_backtrace behind the trigger_error. I think you > > > > Why not use a debugger to debug? Debuggers have backtrace tools. > > > >> (there you can add a backtrace) too, but you have to catch them, if > >> not your script will abort; but I only need a notice...) > > > > If you need additional information in the notice, you can always add it > > to the text of the notice. > > > > -- > > Stanislav Malyshev, Software Architect > > SugarCRM: http://www.sugarcrm.com/ > > (408)454-6900 ext. 227 > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > nothing against the debugger, but it'd be something really time saving to > see the entry point instantly instead of having to use the debugger first... > > And yes, I can add it to the text (I can even add a function between which > analyses the backtrace first), but I think we need more useful (= more > information) error throwing in PHP? > How do you want to find out, which call _initially_ set the invalid values? Is this even (reliable) possible? I've given an example, that it isn't that trivial. So even if you have the two additional parameters, what will you set there (except maybe something like "__LINE__-4", which is as trivial as useless)? With this in mind: How do you think the additional parameters _can_ help? Another example function foo() { return 0; } function bar($a) { div($a); } function div($a) { if ($a == 0) trigger_error(''); } div(bar(foo())); Which line should the message report now: - bar() because it calls div()? - or foo() because it is the function, that returns the invalid value, that is used later? But 0 is maybe a valid return value for foo()? - or div(bar(foo()));, but how to find out, that foo() _really_ returned the invalid value? Like in my other example you can report any file and line you want and which is maybe/probably involved, but in most if not all cases it doesn't prevent you from debugging. Regards, Sebastian > > Bob > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch --089e013c650a36d5e004dc27889a--