MantisBT - Xdebug
View Issue Details
0000419XdebugFeature/Change requestpublic2008-11-08 18:102009-12-29 17:41
guenter 
 
normaltrivialalways
closedfixed 
 
 
all
5.2.6
0000419: make use of P_tmpdir if defined instead of hardcoded '/tmp'
I think its a good idea to make use of P_tmpdir if its defined in the OS headers - this would help on NetWare since there the default is 'sys:/tmp'.
I've checked on my Linux box that it is defined there too as '/tmp'.
--- xdebug.c.orig Wed Jul 18 19:33:52 2007
+++ xdebug.c Fri Aug 31 12:14:14 2007
@@ -71,6 +71,12 @@
 #include "xdebug_superglobals.h"
 #include "usefulstuff.h"
 
+#ifdef P_tmpdir
+#define XDEBUG_TEMP_DIR P_tmpdir
+#else
+#define XDEBUG_TEMP_DIR "/tmp"
+#endif
+
 /* execution redirection functions */
 zend_op_array* (*old_compile_file)(zend_file_handle* file_handle, int type TSRMLS_DC);
 zend_op_array* xdebug_compile_file(zend_file_handle*, int TSRMLS_DC);
@@ -252,7 +258,7 @@
 PHP_INI_BEGIN()
     /* Debugger settings */
     STD_PHP_INI_BOOLEAN("xdebug.auto_trace", "0", PHP_INI_ALL, OnUpdateBool, auto_trace, zend_xdebug_globals, xdebug_globals)
- STD_PHP_INI_ENTRY("xdebug.trace_output_dir", "/tmp", PHP_INI_ALL, OnUpdateString, trace_output_dir, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.trace_output_dir", XDEBUG_TEMP_DIR, PHP_INI_ALL, OnUpdateString, trace_output_dir, zend_xdebug_globals, xdebug_globals)
     STD_PHP_INI_ENTRY("xdebug.trace_output_name", "trace.%c", PHP_INI_ALL, OnUpdateString, trace_output_name, zend_xdebug_globals, xdebug_globals)
 #if ZEND_EXTENSION_API_NO < 90000000
     STD_PHP_INI_ENTRY("xdebug.trace_format", "0", PHP_INI_ALL, OnUpdateInt, trace_format, zend_xdebug_globals, xdebug_globals)
@@ -296,7 +302,7 @@
 
     /* Profiler settings */
     STD_PHP_INI_BOOLEAN("xdebug.profiler_enable", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable, zend_xdebug_globals, xdebug_globals)
- STD_PHP_INI_ENTRY("xdebug.profiler_output_dir", "/tmp", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_dir, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.profiler_output_dir", XDEBUG_TEMP_DIR, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_dir, zend_xdebug_globals, xdebug_globals)
     STD_PHP_INI_ENTRY("xdebug.profiler_output_name", "cachegrind.out.%p", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_name, zend_xdebug_globals, xdebug_globals)
     STD_PHP_INI_BOOLEAN("xdebug.profiler_enable_trigger", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable_trigger, zend_xdebug_globals, xdebug_globals)
     STD_PHP_INI_BOOLEAN("xdebug.profiler_append", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_append, zend_xdebug_globals, xdebug_globals)
No tags attached.
Issue History
2008-11-08 18:10guenterNew Issue
2009-12-29 15:58derickNote Added: 0001229
2009-12-29 17:29guenterNote Added: 0001232
2009-12-29 17:41derickNote Added: 0001233
2009-12-29 17:41derickStatusnew => closed
2009-12-29 17:41derickResolutionopen => fixed

Notes
(0001229)
derick   
2009-12-29 15:58   
It's only netware that has P_tmpdir; what might help is to use PHP's php_get_temporary_directory() but that is really tricky to use as default for INI settings it seems.
(0001232)
guenter   
2009-12-29 17:29   
nope - its Linux standard too - see:
http://www.delorie.com/gnu/docs/glibc/libc_295.html [^]
also see f.e. this PHP core file:
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/main/php_open_temporary_file.c?revision=282742&view=markup [^]
where P_tmpdir is used too; and even Win32 seems to have it defined:
http://doc.ddart.net/msdn/header/include/stdio.h.html [^]

Anyway, you loose nothing with my patch since P_tmpdir is only used if defined.
(0001233)
derick   
2009-12-29 17:41   
Ah ha, didn't know that. Fixed in revision 3179 and thanks!