pecl_bug10194_blob_64.phpt 1.5 KB

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