[xdebug-dev] xdebug xdebug/xdebug.c xdebug/tests/start_trace.phpt - Make the filename parameter to the xdebug_start_trace() function optional. If

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 3 Oct 2006 21:05:34 +0200

Date: Tue Oct 3 21:05:33 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Make the filename parameter to the xdebug_start_trace() function optional. If
  left empty it will use the same algorithm to pick a filename as when you are
  using the xdebug.auto_trace setting.

Modified files:
           xdebug/xdebug.c (version: 1.347)
Added files:
           xdebug/tests/start_trace.phpt (new version: 1.1)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -r1.346 -r1.347
--- xdebug/xdebug.c:1.346 Fri Sep 29 08:07:16 2006 GMT
+++ xdebug/xdebug.c Tue Oct 03 17:05:33 2006 GMT
@@ -2436,22 +2436,19 @@
         long options = 0;
 
         if (XG(do_trace) == 0) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &fname, &fname_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &fname, &fname_len, &options) == FAILURE) {
                         return;
                 }
 
- if (fname && strlen(fname)) {
- if ((trace_fname = xdebug_start_trace(fname, options TSRMLS_CC)) != NULL) {
- XG(do_trace) = 1;
- RETVAL_STRING(trace_fname, 1);
- xdfree(trace_fname);
- return;
- } else {
- php_error(E_NOTICE, "Trace could not be started");
- }
+ if ((trace_fname = xdebug_start_trace(fname, options TSRMLS_CC)) != NULL) {
+ XG(do_trace) = 1;
+ RETVAL_STRING(trace_fname, 1);
+ xdfree(trace_fname);
+ return;
                 } else {
- php_error(E_NOTICE, "Filename can not be empty");
+ php_error(E_NOTICE, "Trace could not be started");
                 }
+
                 XG(do_trace) = 0;
                 RETURN_FALSE;
         } else {
@@ -2467,7 +2464,7 @@
         char cwd[128];
         char *tmp_fname;
 
- if (fname) {
+ if (fname && strlen(fname)) {
                 filename = xdstrdup(fname);
         } else {
                 if (strcmp(XG(trace_output_name), "crc32") == 0) {

[FILE: /xdebug/tests/start_trace.phpt]

--TEST--
xdebug_start_trace() without filename
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
--INI--
xdebug.enable=1
xdebug.auto_trace=0
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_output_name=crc32
--FILE--
<?php
        $tf = xdebug_start_trace();
        echo $tf, "\n";
        unlink($tf);
?>
--EXPECTF--
/tmp/trace.%d.xt
Received on Tue Oct 03 2006 - 21:05:35 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST