Annotation of embedaddon/php/ext/mysql/tests/mysql_deprecated_api.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Check if deprecated API calls bail out
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --INI--
! 9: mysql.trace_mode=1
! 10: error_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: */
! 19: include "table.inc";
! 20:
! 21: if (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:
! 54: if (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:
! 71: print "done!";
! 72: ?>
! 73: --CLEAN--
! 74: <?php
! 75: require_once("clean_table.inc");
! 76: ?>
! 77: --EXPECTF--
! 78: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>