2013/5/7 Bob Weinand <bobw...@hotmail.com>

>
> Am 7.5.2013 um 22:11 schrieb Stas Malyshev <smalys...@sugarcrm.com>:
>
> > 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

Reply via email to