bobbingwide / oik-bwtrace

debug trace for WordPress
https://www.oik-plugins.com/oik-plugins/oik-bwtrace-debug-trace-for-wordpress/
GNU General Public License v2.0
6 stars 1 forks source link

Trace fails if you don't complete a file name but check the Enabled checkbox #85

Closed bobbingwide closed 4 years ago

bobbingwide commented 4 years ago

If you select the Enabled checkbox but nothing else then you get

Warning
:  fopen(C:/apache/htdocs/wordpress/bwtrace3/.): failed to open stream: 
Permission denied in 
<b>C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace.php</b>
on line 722
bobbingwide commented 4 years ago

Workaround

Proposed solution

bobbingwide commented 4 years ago

The silly thing is that I had the second half of this problem yesterday, before I packaged v3.0.0. I didnt investigate it until I got a problem testing the package from wordpress.org.

bobbingwide commented 4 years ago

There's a TODO in get_trace_file_mask() we should deal with.

// Ignore the path. @TODO - either ensure it's not set or implement support. //$file_mask .= $this->file_path;

bobbingwide commented 4 years ago

There's also a problem if you don't specify the trace file extension and leave the trace file generation limit blank.

Warning :  fopen(C:/apache/htdocs/wordpress/bwtrace3/bwtrace.): 
failed to open stream: Permission denied 

When validating the file name we need to cater for the path and the extension and when generating the file name we need to do the same.

So now I question the decision to put the generation number after the trace file name.

Wouldn't filename.generation.ext be better than filename.ext.generation ?

bobbingwide commented 4 years ago

Proposed solution

  • Don't enable tracing when the file name's blank.

Alternative solution

Default the trace file name to bwtrace.log