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