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

==10325== Invalid read of size 16
==10325==    at 0xBA6AF39: __intel_new_memcpy (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA8E3344: ttciovconv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA5E3557: kpulbcs (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA8CE6F8: ttcdrv (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xBC8BCD1: nioqwa (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA434561: upirtrc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA5F454E: kpurcsc (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA5A2976: kpulfwrarr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA5A0F37: kpulfwr (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0xA43F38F: OCILobWrite (in /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so.11.1)
==10325==    by 0x945A95: php_oci_lob_write (oci8_lob.c:450)
==10325==    by 0x95C30C: zif_oci_lob_save (oci8_interface.c:219)
==10325==  Address 0x159f8d00 is 2,512 bytes inside a block of size 2,524 alloc'd
==10325==    at 0x4C27AFA: malloc (vg_replace_malloc.c:291)
==10325==    by 0xDF245C: _emalloc (zend_alloc.c:2427)
==10325==    by 0xC21D50: zif_strrev (string.c:3184)
==10325==    by 0xEAC2D1: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==10325==    by 0xEB63A0: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==10325==    by 0xEA9F20: execute_ex (zend_vm_execute.h:363)
==10325==    by 0xEAAAB2: zend_execute (zend_vm_execute.h:388)
==10325==    by 0xE47084: zend_execute_scripts (zend.c:1330)
==10325==    by 0xD6A0EC: php_execute_script (main.c:2506)
==10325==    by 0x102B69D: do_cli (php_cli.c:994)
==10325==    by 0x102CE4A: main (php_cli.c:1378)
==10325== 

 

Generated at Mon, 17 Nov 2014 20:38:41 +0000 (8 days ago)

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