pecl_bug10194.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
  10. if (getenv("USE_ZEND_ALLOC") === "0") {
  11. die("skip Zend MM disabled");
  12. }
  13. ?>
  14. --INI--
  15. memory_limit=10M
  16. --FILE--
  17. <?php
  18. require __DIR__.'/connect.inc';
  19. require __DIR__.'/create_table.inc';
  20. $ora_sql = "INSERT INTO
  21. ".$schema.$table_name." (clob)
  22. VALUES (empty_clob())
  23. ";
  24. $statement = oci_parse($c,$ora_sql);
  25. oci_execute($statement);
  26. $ora_sql = "SELECT clob FROM ".$schema.$table_name." FOR UPDATE";
  27. $statement = oci_parse($c,$ora_sql);
  28. oci_execute($statement, OCI_DEFAULT);
  29. $row = oci_fetch_assoc($statement);
  30. $string = str_repeat("test", 32768*4*4);
  31. for ($i = 0; $i < 8; $i++) {
  32. $row['CLOB']->write($string);
  33. }
  34. oci_commit($c);
  35. $ora_sql = "SELECT clob FROM ".$schema.$table_name."";
  36. $statement = oci_parse($c,$ora_sql);
  37. oci_execute($statement);
  38. $row = oci_fetch_assoc($statement);
  39. var_dump(strlen($row['CLOB']->load())); /* here it should fail */
  40. require __DIR__.'/drop_table.inc';
  41. echo "Done\n";
  42. ?>
  43. --EXPECTF--
  44. Fatal error: Allowed memory size of 10485760 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d