Annotation of embedaddon/php/ext/oci8/tests/pecl_bug10194_blob.phpt, revision 1.1.1.1

1.1       misho       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 these DBs
                      6: require(dirname(__FILE__).'/skipif.inc');
                      7: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
                      8: if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
                      9: ?> 
                     10: --INI--
                     11: memory_limit=3M
                     12: --FILE--
                     13: <?php
                     14: 
                     15: // This test is dependent on the behavior of the memory manager
                     16:     
                     17: require(dirname(__FILE__).'/connect.inc');
                     18: require(dirname(__FILE__).'/create_table.inc');
                     19: 
                     20: $ora_sql = "INSERT INTO ".$schema.$table_name." (blob) VALUES (empty_blob())";
                     21: 
                     22: $statement = oci_parse($c,$ora_sql);
                     23: oci_execute($statement);
                     24: 
                     25: $ora_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
                     26: $statement = oci_parse($c,$ora_sql);
                     27: oci_execute($statement, OCI_DEFAULT);
                     28: 
                     29: $row = oci_fetch_assoc($statement);
                     30: 
                     31: $string = str_repeat("test", 32768*4*4);
                     32: 
                     33: for ($i = 0; $i < 8; $i++) {
                     34:     $row['BLOB']->write($string);
                     35: }
                     36: 
                     37: oci_commit($c);
                     38: 
                     39: $ora_sql = "SELECT blob FROM ".$schema.$table_name;
                     40: $statement = oci_parse($c,$ora_sql);
                     41: oci_execute($statement);
                     42: 
                     43: echo "Before load()\n";
                     44: 
                     45: $row = oci_fetch_assoc($statement);
                     46: var_dump(strlen($row['BLOB']->load())); /* here it should fail */
                     47: 
                     48: require dirname(__FILE__).'/drop_table.inc';
                     49: 
                     50: echo "Done\n";
                     51: ?>
                     52: --EXPECTF-- 
                     53: Before load()
                     54: 
                     55: Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>