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