MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001374XdebugRemote Debuggingpublic2016-12-03 11:302017-02-07 17:08
ReporterRadek Suski 
Assigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionunable to reproduce 
PlatformRaspberry PI OSraspbianOS Version4.4
Product Version2.4.0 
Target VersionFixed in Version 
Summary0001374: XDebug seems to be overwriting thee __FILE__ and __DIR__ constants
Descriptionas in the summary.
Steps To ReproduceWell, this is a bit strange because I know it worked before but suddenly when I am trying to debug within Joomla! my own library those constants containing values as follow:

__FILE__ = xdebug://debug-eval
__DIR__ = xdebug:

See https://pbs.twimg.com/media/CygMFz3XgAAOgQl.jpg:large [^]
TagsNo tags attached.
Operating SystemmacOS 10.12.1 (16B2555)
PHP Version7.0.10-7.0.14
Attached Files

- Relationships

-  Notes
(0003874)
Radek Suski (reporter)
2016-12-03 11:39

BTW: I am apparently not the only one:
http://stackoverflow.com/questions/21254661/xdebug-weird-dir-constant [^]
http://stackoverflow.com/a/30290059/310011 [^]
https://laracasts.com/discuss/channels/laravel/new-to-laravel-taking-over-development/replies/109105 [^]

Additionally because every time I wrote it people assuming I am using "eval", so just to clarify I don't
For debugging I am using phpStorm 2016.2.2
(0003875)
derick (administrator)
2016-12-03 12:46

Hi,

thanks for the report. In order to find and fix the bug, I really do need a reproducible case. As this seems to be a remote debugging issues, please refer to https://xdebug.org/support.php#remote [^] as to what I would require.

cheers,
Derick
(0003882)
Radek Suski (reporter)
2016-12-03 13:21

Sure thing, here is the script: https://gist.github.com/Radek-Suski/660a8b820c98763304fa8617fa7c77d1 [^]
Here is the log file: https://www.dropbox.com/s/kq5sst1maot4he4/xdebug-log.log?dl=0 [^]

What really weird, I just realised, that debugging this script gives following results:

__FILE__ = "xdebug://debug-eval"
__DIR__ = "xdebug:"
$file = "/www/Neo/libraries/Sobi/index.php"
$dir = "/www/Neo/libraries/Sobi"
$dirname = "/www/Neo/libraries/Sobi"

Which means that if I assign those constants to variables, those variables are having correct values.

Regards,
Radek
(0003924)
derick (administrator)
2016-12-04 17:33

Hi,

I see what happens now. You have these in the "Watches" field. PhpStorm handles watches by running the DBGp "eval" command. In the log, that looks like:

<- eval -i 62 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJzlmNmZiNjcxLWU0ZWItNDIyNy04Mzc2LTNhNjNkZDNiMmNmMCddPV9fRElSX18=

As the eval command really just calls PHP's eval, you get the same result:

$ php -r "echo eval('echo __FILE__;');"
Command line code(1) : eval()'d code

Xdebug *does* replace the "Command line code(1) : eval()'d code" with "xdebug://debug-eval" though.

This is something I can not change.
(0003925)
Radek Suski (reporter)
2016-12-04 17:39

@derick Thank for your answer. Yet I am not sure if you are entirely correct. Yes, I have it in watches. But even if, the logical execution is failing. I am asking:

if(file_exists( __DIR__.'/file.php'))

and it returns "false". It can't be just because I have it in my "watches" because at the first time I was debugging my case, it wasn't
(0003927)
derick (administrator)
2016-12-04 17:54

No, it can't be because it's in watches. But that "file_exists" would only file for real reasons. If you can reproduce this, I would use "strace -o /tmp/strace.log php script.php" and see for which file it is doing a "stat".
(0003928)
Radek Suski (reporter)
2016-12-04 18:50

I know for sure that this file exists. That's how I figured out this issue
(0003929)
derick (administrator)
2016-12-04 19:09

Okay - I would definitely use the strace then. There *must* be something why PHP thinks it's not there, and strace is your only hope I think.
(0003930)
Radek Suski (reporter)
2016-12-04 19:11

no problem. I will try to deliver it soon. Thank you very much
(0003943)
derick (administrator)
2016-12-05 14:19

(Changing it to feedback until you do).
(0004128)
derick (administrator)
2017-01-03 18:49

Ping?
(0004200)
derick (administrator)
2017-02-07 17:08

I am closing this, as I can't reproduce this, and the requested feedback has not been given. Please feel free to reopen this if you can provide more information as requested.

- Issue History
Date Modified Username Field Change
2016-12-03 11:30 Radek Suski New Issue
2016-12-03 11:39 Radek Suski Note Added: 0003874
2016-12-03 12:46 derick Note Added: 0003875
2016-12-03 12:46 derick Assigned To => derick
2016-12-03 12:46 derick Status new => feedback
2016-12-03 13:21 Radek Suski Note Added: 0003882
2016-12-03 13:21 Radek Suski Status feedback => assigned
2016-12-04 17:33 derick Note Added: 0003924
2016-12-04 17:33 derick Status assigned => resolved
2016-12-04 17:33 derick Resolution open => not fixable
2016-12-04 17:39 Radek Suski Note Added: 0003925
2016-12-04 17:39 Radek Suski Status resolved => feedback
2016-12-04 17:39 Radek Suski Resolution not fixable => reopened
2016-12-04 17:54 derick Note Added: 0003927
2016-12-04 17:54 derick Status feedback => resolved
2016-12-04 17:54 derick Resolution reopened => no change required
2016-12-04 18:50 Radek Suski Note Added: 0003928
2016-12-04 18:50 Radek Suski Status resolved => feedback
2016-12-04 18:50 Radek Suski Resolution no change required => reopened
2016-12-04 19:09 derick Note Added: 0003929
2016-12-04 19:11 Radek Suski Note Added: 0003930
2016-12-04 19:11 Radek Suski Status feedback => assigned
2016-12-05 14:19 derick Note Added: 0003943
2016-12-05 14:19 derick Status assigned => feedback
2017-01-03 18:49 derick Note Added: 0004128
2017-02-07 17:08 derick Note Added: 0004200
2017-02-07 17:08 derick Status feedback => resolved
2017-02-07 17:08 derick Resolution reopened => unable to reproduce


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker