Home » Language IDEs » PHP Development Tools (PDT) » create_function and step-into (xdebug)
create_function and step-into (xdebug) [message #55914] |
Fri, 28 September 2007 18:50  |
Eclipse User |
|
|
|
Debug the the below breaking at the fist line:
<?php
$newfunc = create_function('$a,$b', 'return "Avarage=" . ($a+$b)/2;');
echo "functio name: $newfunc\n";
echo $newfunc(7,5) . "\n";
?>
Now if you reach the 3rd line and try to "step into" it to execute the
anonymous function, the debugger would give you an error stating that it
cannot reach the file where the function exists, which osofcourse normal
since there is not file where this function is defined.
I don't know if this would be a bug or just a new feature (new feature
is more like it). Would it be possible to disable the "step into" button
when reaching lines that contain such calls? Or at least, give a more
informative error message?
Cheers,
Ali
|
|
| | |
Re: create_function and step-into (xdebug) [message #56057 is a reply to message #55914] |
Sun, 30 September 2007 11:54   |
Eclipse User |
|
|
|
Originally posted by: dkel50.hotnospmail.com
Sorry, forgot to add, to get the message improved you will need to raise
a bugzilla about it and quote the example you gave in the append to show
how it doesn't cover this.
Cheers
Dave Kelsey
Ali B. wrote:
> Debug the the below breaking at the fist line:
>
> <?php
> $newfunc = create_function('$a,$b', 'return "Avarage=" . ($a+$b)/2;');
> echo "functio name: $newfunc\n";
> echo $newfunc(7,5) . "\n";
> ?>
>
> Now if you reach the 3rd line and try to "step into" it to execute the
> anonymous function, the debugger would give you an error stating that it
> cannot reach the file where the function exists, which osofcourse normal
> since there is not file where this function is defined.
>
> I don't know if this would be a bug or just a new feature (new feature
> is more like it). Would it be possible to disable the "step into" button
> when reaching lines that contain such calls? Or at least, give a more
> informative error message?
>
> Cheers,
> Ali
|
|
|
Re: create_function and step-into (xdebug) [message #56082 is a reply to message #56057] |
Sun, 30 September 2007 16:31   |
Eclipse User |
|
|
|
Dave,
Thanks. But can't it just handles this case the same way it does to
bultin functions for example (as Martin suggested)?
Cheers,
Ali
Dave wrote:
> Sorry, forgot to add, to get the message improved you will need to raise
> a bugzilla about it and quote the example you gave in the append to show
> how it doesn't cover this.
>
> Cheers
> Dave Kelsey
>
>
> Ali B. wrote:
>> Debug the the below breaking at the fist line:
>>
>> <?php
>> $newfunc = create_function('$a,$b', 'return "Avarage=" . ($a+$b)/2;');
>> echo "functio name: $newfunc\n";
>> echo $newfunc(7,5) . "\n";
>> ?>
>>
>> Now if you reach the 3rd line and try to "step into" it to execute the
>> anonymous function, the debugger would give you an error stating that
>> it cannot reach the file where the function exists, which osofcourse
>> normal since there is not file where this function is defined.
>>
>> I don't know if this would be a bug or just a new feature (new feature
>> is more like it). Would it be possible to disable the "step into"
>> button when reaching lines that contain such calls? Or at least, give
>> a more informative error message?
>>
>> Cheers,
>> Ali
|
|
|
Re: create_function and step-into (xdebug) [message #56182 is a reply to message #56082] |
Mon, 01 October 2007 06:21   |
Eclipse User |
|
|
|
It would not be possible to gray out the step into buttons (note they aren't grayed out
when you are about to execute a built-in or extension function). As built-in
and extension functions are c code, not php, xdebug won't be able to interrupt
the execution of them (so to xdebug these are atomic). PDT won't know what the next
line will do, even PHP doesn't know what the next line will do until it actually
executes it so PHP+Xdebug isn't able to tell PDT that the next line should not
support step into.
As you have created an anonymous php function which can be interrupted
by xdebug it will be able to step into it like any other function. Xdebug would have to
be to determine it was in an anonymous function and to not allow stepping
into it (a step_into request would be interpreted as step_over). There isn't anything
PDT can do about this except provide a better error message.
You could try raising an enhancement on xdebug itself at http://www.xdebug.org which
would then have some sort of configurable option to allow it to behave the way you want, then
it will be upto Derick to assess the feasibility of this.
Cheers
Dave Kelsey
Ali B. wrote:
> Dave,
>
> Thanks. But can't it just handles this case the same way it does to
> bultin functions for example (as Martin suggested)?
>
> Cheers,
> Ali
>
> Dave wrote:
>> Sorry, forgot to add, to get the message improved you will need to raise
>> a bugzilla about it and quote the example you gave in the append to
>> show how it doesn't cover this.
>>
>> Cheers
>> Dave Kelsey
>>
>>
>> Ali B. wrote:
>>> Debug the the below breaking at the fist line:
>>>
>>> <?php
>>> $newfunc = create_function('$a,$b', 'return "Avarage=" . ($a+$b)/2;');
>>> echo "functio name: $newfunc\n";
>>> echo $newfunc(7,5) . "\n";
>>> ?>
>>>
>>> Now if you reach the 3rd line and try to "step into" it to execute
>>> the anonymous function, the debugger would give you an error stating
>>> that it cannot reach the file where the function exists, which
>>> osofcourse normal since there is not file where this function is
>>> defined.
>>>
>>> I don't know if this would be a bug or just a new feature (new
>>> feature is more like it). Would it be possible to disable the "step
>>> into" button when reaching lines that contain such calls? Or at
>>> least, give a more informative error message?
>>>
>>> Cheers,
>>> Ali
|
|
|
Re: create_function and step-into (xdebug) [message #56254 is a reply to message #56182] |
Mon, 01 October 2007 09:14  |
Eclipse User |
|
|
|
Dave,
You made that crystal clear.. Thanks.
Cheers
Ali
Dave Kelsey wrote:
> It would not be possible to gray out the step into buttons (note they
> aren't grayed out
> when you are about to execute a built-in or extension function). As
> built-in
> and extension functions are c code, not php, xdebug won't be able to
> interrupt
> the execution of them (so to xdebug these are atomic). PDT won't know
> what the next
> line will do, even PHP doesn't know what the next line will do until it
> actually
> executes it so PHP+Xdebug isn't able to tell PDT that the next line
> should not
> support step into.
>
> As you have created an anonymous php function which can be interrupted
> by xdebug it will be able to step into it like any other function.
> Xdebug would have to
> be to determine it was in an anonymous function and to not allow stepping
> into it (a step_into request would be interpreted as step_over). There
> isn't anything
> PDT can do about this except provide a better error message.
>
> You could try raising an enhancement on xdebug itself at
> http://www.xdebug.org which
> would then have some sort of configurable option to allow it to behave
> the way you want, then
> it will be upto Derick to assess the feasibility of this.
>
> Cheers
> Dave Kelsey
>
>
> Ali B. wrote:
>> Dave,
>>
>> Thanks. But can't it just handles this case the same way it does to
>> bultin functions for example (as Martin suggested)?
>>
>> Cheers,
>> Ali
>>
>> Dave wrote:
>>> Sorry, forgot to add, to get the message improved you will need to raise
>>> a bugzilla about it and quote the example you gave in the append to
>>> show how it doesn't cover this.
>>>
>>> Cheers
>>> Dave Kelsey
>>>
>>>
>>> Ali B. wrote:
>>>> Debug the the below breaking at the fist line:
>>>>
>>>> <?php
>>>> $newfunc = create_function('$a,$b', 'return "Avarage=" . ($a+$b)/2;');
>>>> echo "functio name: $newfunc\n";
>>>> echo $newfunc(7,5) . "\n";
>>>> ?>
>>>>
>>>> Now if you reach the 3rd line and try to "step into" it to execute
>>>> the anonymous function, the debugger would give you an error stating
>>>> that it cannot reach the file where the function exists, which
>>>> osofcourse normal since there is not file where this function is
>>>> defined.
>>>>
>>>> I don't know if this would be a bug or just a new feature (new
>>>> feature is more like it). Would it be possible to disable the "step
>>>> into" button when reaching lines that contain such calls? Or at
>>>> least, give a more informative error message?
>>>>
>>>> Cheers,
>>>> Ali
|
|
|
Goto Forum:
Current Time: Fri May 23 17:08:19 EDT 2025
Powered by FUDForum. Page generated in 0.04633 seconds
|