bug81720.phpt 696 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #81720 (Uninitialized array in pg_query_params() leading to RCE)
  3. --EXTENSIONS--
  4. pgsql
  5. --SKIPIF--
  6. <?php include("skipif.inc"); ?>
  7. --FILE--
  8. <?php
  9. include('config.inc');
  10. $conn = pg_connect($conn_str);
  11. try {
  12. pg_query_params($conn, 'SELECT $1, $2', [1, new stdClass()]);
  13. } catch (Throwable $ex) {
  14. echo $ex->getMessage(), PHP_EOL;
  15. }
  16. try {
  17. pg_send_prepare($conn, "my_query", 'SELECT $1, $2');
  18. pg_get_result($conn);
  19. pg_send_execute($conn, "my_query", [1, new stdClass()]);
  20. } catch (Throwable $ex) {
  21. echo $ex->getMessage(), PHP_EOL;
  22. }
  23. ?>
  24. --EXPECT--
  25. Object of class stdClass could not be converted to string
  26. Object of class stdClass could not be converted to string