1--TEST-- 2Check if deprecated API calls bail out 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--INI-- 9mysql.trace_mode=1 10error_reporting=E_ALL | E_NOTICE | E_STRICT 11--FILE-- 12<?php 13/* 14 We use an extra test to cover deprecation warning. 15 Due to this extra test we can silence deprecation warnings 16 in have other test using @ operator without loosing the information 17 which function is deprecated and, without reducing test portability. 18*/ 19include "table.inc"; 20 21if (version_compare(PHP_VERSION, '5.3.0') >= 0) { 22 $error = NULL; 23 ob_start(); 24 if (!$res = mysql_db_query($db, "SELECT * FROM test", $link)) 25 $error .= sprintf("[001] [%d] %s\n", mysql_errno($link), mysql_error($link)); 26 else 27 mysql_free_result($res); 28 $output = ob_get_contents(); 29 ob_end_clean(); 30 31 if (!stristr($output, 'deprecated')) { 32 printf("[002] mysql_db_query has been deprecated in 5.3.0\n"); 33 } 34 35 /* 36 Deprecated since 2002 or the like but documented to be deprecated since 5.3. 37 In 5.3 and before the deprecation message was bound to mysql.trace_mode=1. 38 In 5.3.99 the warning will always be thrown, independent of the mysql.trace_mode 39 setting. 40 */ 41 $error = NULL; 42 ob_start(); 43 if (!$query = mysql_escape_string("charsets will be ignored")) 44 $error .= sprintf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link)); 45 $output = ob_get_contents(); 46 ob_end_clean(); 47 48 if (!stristr($output, 'deprecated')) { 49 printf("[006] mysql_escape_string has been deprecated in 5.3.0\n"); 50 } 51 52} 53 54if (version_compare(PHP_VERSION, '5.3.99') >= 0) { 55 $error = NULL; 56 ob_start(); 57 if (!$res = mysql_list_dbs($link)) 58 $error .= sprintf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); 59 else 60 mysql_free_result($res); 61 $output = ob_get_contents(); 62 ob_end_clean(); 63 64 if (!stristr($output, 'deprecated')) { 65 printf("[004] mysql_db_query has been deprecated in 5.3.0\n"); 66 } 67} 68 69 70 71print "done!"; 72?> 73--CLEAN-- 74<?php 75require_once("clean_table.inc"); 76?> 77--EXPECTF-- 78Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d 79done! 80