PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for ext/oci8/tests/define3.phpt ('Test oci_define_by_name() LOB descriptor')

Script

1: <?php
2:
3:
require(dirname(__FILE__)."/connect.inc");
4:
5:
$stmtarray = array(
6:     
"drop table phpdefblobtable",
7:     
"create table phpdefblobtable (id number(10), fileimage blob)"
8:
);
9:                          
10:
oci8_test_sql_execute($c$stmtarray);
11:
12:
// Load data
13:
$stmt oci_parse ($c"insert into phpdefblobtable (id, fileimage) values (:id, empty_blob()) returning fileimage into :fileimage");
14:
$fileimage oci_new_descriptor($c,OCI_D_LOB);
15:
oci_bind_by_name($stmt,":id",$id);
16:
oci_bind_by_name($stmt,":fileimage",$fileimage,-1,OCI_B_BLOB);
17:
$id 1;
18:
oci_execute($stmtOCI_DEFAULT);
19:
$fileimage->savefile(dirname(__FILE__)."/test.gif");
20:
$data $fileimage->load();
21:
var_dump(md5($data));  // original md5
22:
oci_commit($c);
23:
24:
// New row with different data
25:
$id 2;
26:
$data strrev($data);
27:
var_dump(md5($data));
28:
oci_execute($stmtOCI_DEFAULT);
29:
$fileimage->save($data);
30:
oci_commit($c);
31:
32: echo 
"Test 1\n";
33:
$stmt oci_parse($c"SELECT fileimage FROM phpdefblobtable");
34:
var_dump(oci_define_by_name($stmt'FILEIMAGE'$f));
35:
oci_execute($stmt);
36:
37: while (
oci_fetch($stmt)) {
38:    
var_dump($f);
39:    echo 
"file md5:" md5($f->load()) . "\n";
40: }
41:
42: echo 
"Test 2\n";
43:
$stmt oci_parse($c"SELECT fileimage FROM phpdefblobtable");
44:
var_dump(oci_define_by_name($stmt'FILEIMAGE'$outdataSQLT_STR));
45:
oci_execute($stmt);
46:
47: while (
oci_fetch($stmt)) {
48:    echo 
"file md5:" md5($outdata) . "\n";
49: }
50:
51: echo 
"Test 3\n";
52:
$stmt oci_parse($c"SELECT fileimage FROM phpdefblobtable");
53:
var_dump(oci_define_by_name($stmt'FILEIMAGE'$outdataSQLT_BIN));
54:
oci_execute($stmt);
55:
56: while (
oci_fetch($stmt)) {
57:    echo 
"file md5:" md5($outdata) . "\n";
58: }
59:
60: echo 
"Test 4\n";
61:
$fid oci_new_descriptor($c,OCI_D_LOB);
62:
$stmt oci_parse($c"SELECT fileimage FROM phpdefblobtable");
63:
var_dump(oci_define_by_name($stmt'FILEIMAGE'$fid));
64:
oci_execute($stmt);
65:
66: while (
oci_fetch($stmt)) {
67:    echo 
"file md5:" md5($fid->load()) . "\n";
68: }
69:
70:
$stmtarray = array(
71:     
"drop table phpdefblobtable"
72:
);
73:                          
74:
oci8_test_sql_execute($c$stmtarray);
75:
76: echo 
"Done\n";
77:
78:
?>
79:

Report

==6383== Invalid read of size 16
==6383==    at 0xBA63F39: __intel_new_memcpy (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA8DC344: ttciovconv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA5DC557: kpulbcs (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA8C76F8: ttcdrv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xBC84CD1: nioqwa (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA42D561: upirtrc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA5ED54E: kpurcsc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA59B976: kpulfwrarr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA599F37: kpulfwr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0xA43838F: OCILobWrite (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==6383==    by 0x94E40D: php_oci_lob_write (oci8_lob.c:428)
==6383==    by 0x962893: zif_oci_lob_save (oci8_interface.c:219)
==6383==  Address 0x1559b4a0 is 2,512 bytes inside a block of size 2,524 alloc'd
==6383==    at 0x4C27AFA: malloc (vg_replace_malloc.c:291)
==6383==    by 0xE04418: _emalloc (zend_alloc.c:2427)
==6383==    by 0xC2A0AB: zif_strrev (string.c:3179)
==6383==    by 0xEC69CD: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==6383==    by 0xED24AE: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2595)
==6383==    by 0xEC4459: execute_ex (zend_vm_execute.h:363)
==6383==    by 0xEC4FFC: zend_execute (zend_vm_execute.h:388)
==6383==    by 0xE5A064: zend_execute_scripts (zend.c:1330)
==6383==    by 0xD7ADAA: php_execute_script (main.c:2550)
==6383==    by 0x100CA1E: do_cli (php_cli.c:994)
==6383==    by 0x100E1CB: main (php_cli.c:1378)
==6383== 

 

Generated at Mon, 04 Aug 2014 15:49:20 +0000 (23 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.