mysqli_debug_ini.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. mysqli_debug() - enabling trace with ini setting
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. if (!function_exists('mysqli_debug'))
  9. die("skip mysqli_debug() not available");
  10. if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
  11. die("skip: can't say for sure if mysqli_debug works");
  12. if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
  13. die("skip: debug functionality not enabled");
  14. require_once('connect.inc');
  15. if (!$IS_MYSQLND)
  16. die("skip needs mysqlnd");
  17. if (!$fp = @fopen('/tmp/mysqli_debug_phpt.trace', 'w'))
  18. die("skip PHP cannot create a file in /tmp/mysqli_debug_phpt");
  19. else
  20. fclose($fp);
  21. @unlink("/tmp/mysqli_debug_phpt.trace");
  22. ?>
  23. --INI--
  24. mysqlnd.debug="t:O,/tmp/mysqli_debug_phpt.trace"
  25. --FILE--
  26. <?php
  27. require_once('connect.inc');
  28. require_once('table.inc');
  29. var_dump(ini_get('mysqlnd.debug'));
  30. $trace_file = '/tmp/mysqli_debug_phpt.trace';
  31. clearstatcache();
  32. if (!file_exists($trace_file))
  33. printf("[003] Trace file '%s' has not been created\n", $trace_file);
  34. if (filesize($trace_file) < 50)
  35. printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
  36. $trace_file,
  37. filesize($trace_file));
  38. mysqli_close($link);
  39. unlink($trace_file);
  40. print "done!";
  41. ?>
  42. --EXPECT--
  43. string(32) "t:O,/tmp/mysqli_debug_phpt.trace"
  44. done!