Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 22:50 Go to next message
Ali B. is currently offline Ali B.Friend
Messages: 66
Registered: July 2009
Member
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 #55975 is a reply to message #55914] Sat, 29 September 2007 11:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Martin.eisengardt.de

IMHO this is a bug. Stepping into dynamic functions/ eval would be nice but
I think it is not possible inside PDT. Because create function compiles this
code and the debugger does not have any source file it could start with.
Source can be located in some strings read from database. The only way is to
display disassembly (zend opcodes). That would be a nice feature at all ;-)

> Would it be possible to disable the "step into" button when reaching lines
> that contain such calls?
Disabling would be nice or simply step over instead of displaying any error
message. Eclipse (JDT with native functions and PDT with built in or c
methods) already ignores every step into non debuggable code.
Re: create_function and step-into (xdebug) [message #56030 is a reply to message #55914] Sun, 30 September 2007 13:40 Go to previous messageGo to next message
D Kelsey is currently offline D KelseyFriend
Messages: 232
Registered: July 2009
Senior Member
I doubt it would be possible to disable the step into button, as there is no
way to know the behaviour of the next line to be executed (the wonders of
a dynamic language). A better message could be displayed of course but it would
be generic for all scenarios where source could not be located.
On the whole though this doesn't really detract from the debug experience. It is
telling you that the source cannot be located and there is indication in the
extra stack frame created by PHP as well. You can always press F7 (Step return) to
jump out of the method/function that doesn't have any source.

This is what happens in java as well if you enter a method where there is no source
available for the class.

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 #56057 is a reply to message #55914] Sun, 30 September 2007 15:54 Go to previous messageGo to next message
Eclipse UserFriend
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 20:31 Go to previous messageGo to next message
Ali B. is currently offline Ali B.Friend
Messages: 66
Registered: July 2009
Member
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 10:21 Go to previous messageGo to next message
D Kelsey is currently offline D KelseyFriend
Messages: 232
Registered: July 2009
Senior Member
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 13:14 Go to previous message
Ali B. is currently offline Ali B.Friend
Messages: 66
Registered: July 2009
Member
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
Previous Topic:debug fails when stepping into included file
Next Topic:Where is PDT's preferences file? - Regards Bug #204525
Goto Forum:
  


Current Time: Sat Apr 27 04:42:13 GMT 2024

Powered by FUDForum. Page generated in 0.03340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top