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