mysql_sql_safe_mode.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. if ($link = mysql_connect($host, $user, $passwd, true)) {
  21. printf("[001] Safe mode not working properly?\n");
  22. mysql_close($link);
  23. }
  24. if ($link = mysql_pconnect($host, $user, $passwd)) {
  25. printf("[002] Safe mode not working properly?\n");
  26. mysql_close($link);
  27. }
  28. print "done!\n";
  29. ?>
  30. --EXPECTF--
  31. Notice: mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d
  32. Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d
  33. Notice: mysql_pconnect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d
  34. Warning: mysql_pconnect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d
  35. done!