PHP  
 PHP_5_4
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

==12465== Invalid read of size 16
==12465==    at 0xB858F39: __intel_new_memcpy (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA6D1344: ttciovconv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA3D1557: kpulbcs (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA6BC6F8: ttcdrv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xBA79CD1: nioqwa (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA222561: upirtrc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA3E254E: kpurcsc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA390976: kpulfwrarr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA38EF37: kpulfwr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0xA22D38F: OCILobWrite (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==12465==    by 0x8BA4DB: php_oci_lob_write (oci8_lob.c:450)
==12465==    by 0x8D0202: zif_oci_lob_save (oci8_interface.c:219)
==12465==  Address 0x150daa80 is 2,512 bytes inside a block of size 2,524 alloc'd
==12465==    at 0x4C27AFA: malloc (vg_replace_malloc.c:291)
==12465==    by 0xD37F95: _emalloc (zend_alloc.c:2423)
==12465==    by 0xB7CBE5: zif_strrev (string.c:3233)
==12465==    by 0xDE343B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:643)
==12465==    by 0xDED5DB: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2233)
==12465==    by 0xDE1597: execute (zend_vm_execute.h:410)
==12465==    by 0xD85544: zend_execute_scripts (zend.c:1315)
==12465==    by 0xCB7791: php_execute_script (main.c:2502)
==12465==    by 0xF53688: do_cli (php_cli.c:989)
==12465==    by 0xF54CC5: main (php_cli.c:1365)
==12465== 

 

Generated at Thu, 16 Oct 2014 05:27:17 +0000 (3 days ago)

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