Annotation of embedaddon/php/ext/mysql/tests/mysql_sql_safe_mode.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysql_[p]connect() - safe_mode
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: $link = @mysql_connect("", "", "", true);
! 8: if ($link)
! 9: die("skip Test cannot be run if annonymous connections are allowed");
! 10: ?>
! 11: --INI--
! 12: sql.safe_mode=1
! 13: --FILE--
! 14: <?php
! 15: require_once('connect.inc');
! 16: if ($socket)
! 17: $host = sprintf("%s:%s", $host, $socket);
! 18: else if ($port)
! 19: $host = sprintf("%s:%s", $host, $port);
! 20:
! 21: if ($link = mysql_connect($host, $user, $passwd, true)) {
! 22: printf("[001] Safe mode not working properly?\n");
! 23: mysql_close($link);
! 24: }
! 25:
! 26: if ($link = mysql_pconnect($host, $user, $passwd)) {
! 27: printf("[002] Safe mode not working properly?\n");
! 28: mysql_close($link);
! 29: }
! 30: print "done!\n";
! 31: ?>
! 32: --EXPECTF--
! 33: Notice: mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d
! 34:
! 35: Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d
! 36:
! 37: Notice: mysql_pconnect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d
! 38:
! 39: Warning: mysql_pconnect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d
! 40: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>