mysqli_stmt_unclonable.phpt 788 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Trying to clone mysqli_stmt object
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once("connect.inc");
  12. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  13. printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  14. $host, $user, $db, $port, $socket);
  15. if (!$stmt = mysqli_stmt_init($link))
  16. printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  17. /* no, still bails out */
  18. $stmt_clone = clone $stmt;
  19. print "done!";
  20. ?>
  21. --EXPECTF--
  22. Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_stmt in %s:%d
  23. Stack trace:
  24. #0 {main}
  25. thrown in %s on line %d