write_property_strict.phpt 671 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Writing to mysqli properties (strict_types)
  3. --EXTENSIONS--
  4. mysqli
  5. --FILE--
  6. <?php
  7. declare(strict_types=1);
  8. $driver = new mysqli_driver;
  9. try {
  10. /* Read-only property */
  11. $driver->client_info = 42;
  12. } catch (Error $e) {
  13. echo $e->getMessage(), "\n";
  14. }
  15. try {
  16. $driver->reconnect = 0;
  17. } catch (Error $e) {
  18. echo $e->getMessage(), "\n";
  19. }
  20. try {
  21. $driver->report_mode = "1";
  22. } catch (Error $e) {
  23. echo $e->getMessage(), "\n";
  24. }
  25. ?>
  26. --EXPECT--
  27. Cannot write read-only property mysqli_driver::$client_info
  28. Cannot assign int to property mysqli_driver::$reconnect of type bool
  29. Cannot assign string to property mysqli_driver::$report_mode of type int