bug36802.phpt 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Bug #36802 (crashes with with mysqli_set_charset())
  3. --EXTENSIONS--
  4. mysqli
  5. --FILE--
  6. <?php
  7. class really_my_mysqli extends mysqli {
  8. function __construct()
  9. {
  10. }
  11. }
  12. require_once("connect.inc");
  13. $mysql = mysqli_init();
  14. /* following operations should not work */
  15. if (method_exists($mysql, 'set_charset')) {
  16. try {
  17. $mysql->set_charset('utf8');
  18. } catch (Error $exception) {
  19. echo $exception->getMessage() . "\n";
  20. }
  21. } else {
  22. $x[0] = false;
  23. }
  24. try {
  25. $mysql->query("SELECT 'foo' FROM DUAL");
  26. } catch (Error $exception) {
  27. echo $exception->getMessage() . "\n";
  28. }
  29. /* following operations should work */
  30. $x[1] = ($mysql->error);
  31. $x[2] = $mysql->errno;
  32. $mysql->close();
  33. var_dump($x);
  34. ?>
  35. --EXPECT--
  36. mysqli object is not fully initialized
  37. mysqli object is not fully initialized
  38. array(2) {
  39. [1]=>
  40. string(0) ""
  41. [2]=>
  42. int(0)
  43. }