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

Valgrind Report for ext/interbase/tests/007.phpt ('InterBase: array handling')

Script

1: <?php
2:
3:     
require("interbase.inc");
4:
5:     
ibase_connect($test_base);
6:
7:     
ibase_query(
8:         
"create table test7 (
9:             iter        integer,
10:             v_multi        integer[10,10,10],
11:             v_char        char(100)[10],
12:             v_date      timestamp[10],
13:             v_decimal   decimal(18,3)[10],
14:             v_double      double precision[10],
15:             v_float     float[10],
16:             v_integer   integer[10],
17:             v_numeric   numeric(9,2)[10],
18:             v_smallint  smallint[10],
19:             v_varchar   varchar(1000)[10]
20:             )"
);
21:     
ibase_commit();
22:
23:     
/* if timefmt not supported, hide error */
24:     
ini_set('ibase.timestampformat',"%m/%d/%Y %H:%M:%S");
25:
26:     echo 
"insert\n";
27:
28:     for (
$i 1$i <= 10; ++$i) {
29:         for (
$j 1$j <= 10; ++$j) {
30:             for (
$k 1$k <= 10; ++$k) {
31:                 
$v_multi[$i][$j][$k] = $i $j $k;
32:             }
33:         }
34:     }
35:
36:     for(
$iter 0$iter 3$iter++) {
37:
38:         
/* prepare data  */
39:         
$v_char = array();
40:         
$v_date = array();
41:         
$v_decimal = array();
42:         
$v_double  = array();
43:         
$v_float = array();
44:         
$v_integer = array();
45:         
$v_numeric = array();
46:         
$v_smallint = array();
47:         
$v_varchar = array();
48:
49:         for (
$i 1$i <= 10; ++$i) {
50:             
$v_char[$i] = rand_str(100);
51:             
$v_date[$i] = rand_datetime();
52:             
$v_decimal[$i] = rand_number(18,3);
53:             
$v_double[$i]  = rand_number(20);
54:             
$v_float[$i]   = rand_number(7);
55:             
$v_integer[$i] = rand_number(9,0);
56:             
$v_numeric[$i] = rand_number(9,2);
57:             
$v_smallint[$i] = rand_number(5) % 32767;
58:             
$v_varchar[$i] = rand_str(1000);
59:         }
60:
61:         
ibase_query("insert into test7
62:             (iter,v_multi,v_char,v_date,v_decimal,v_double,v_float,
63:             v_integer,v_numeric,v_smallint,v_varchar)
64:             values (?,?,?,?,?,?,?,?,?,?,?)"
,
65:             
$iter$v_multi$v_char$v_date$v_decimal$v_double$v_float,
66:             
$v_integer$v_numeric$v_smallint$v_varchar);
67:         
$sel ibase_query("select * from test7 where iter = $iter");
68:
69:         
$row ibase_fetch_object($sel,IBASE_FETCH_ARRAYS);
70:         for (
$i 1$i <= 10; ++$i) {
71:
72:             if(
strncmp($row->V_CHAR[$i],$v_char[$i],strlen($v_char[$i])) != 0) {
73:                 echo 
" CHAR[$i] fail:\n";
74:                 echo 
" in:  ".$v_char[$i]."\n";
75:                 echo 
" out: ".$row->V_CHAR[$i]."\n";
76:             }
77:             if(
$row->V_DATE[$i] != $v_date[$i]) {
78:                 echo 
" DATE[$i] fail\n";
79:                 echo 
" in:  ".$v_date[$i]."\n";
80:                 echo 
" out: ".$row->V_DATE[$i]."\n";
81:             }
82:             if(
$row->V_DECIMAL[$i] != $v_decimal[$i]) {
83:                 echo 
" DECIMAL[$i] fail\n";
84:                 echo 
" in:  ".$v_decimal[$i]."\n";
85:                 echo 
" out: ".$row->V_DECIMAL[$i]."\n";
86:             }
87:             if(
abs($row->V_DOUBLE[$i] - $v_double[$i]) > abs($v_double[$i] / 1E15)) {
88:                 echo 
" DOUBLE[$i] fail\n";
89:                 echo 
" in:  ".$v_double[$i]."\n";
90:                 echo 
" out: ".$row->V_DOUBLE[$i]."\n";
91:             }
92:             if(
abs($row->V_FLOAT[$i] - $v_float[$i]) > abs($v_float[$i] / 1E7)) {
93:                 echo 
" FLOAT[$i] fail\n";
94:                 echo 
" in:  ".$v_float[$i]."\n";
95:                 echo 
" out: ".$row->V_FLOAT[$i]."\n";
96:             }
97:             if(
$row->V_INTEGER[$i] != $v_integer[$i]) {
98:                 echo 
" INTEGER[$i] fail\n";
99:                 echo 
" in:  ".$v_integer[$i]."\n";
100:                 echo 
" out: ".$row->V_INTEGER[$i]."\n";
101:             }
102:             if (
$row->V_NUMERIC[$i] != $v_numeric[$i]) {
103:                 echo 
" NUMERIC[$i] fail\n";
104:                 echo 
" in:  ".$v_numeric[$i]."\n";
105:                 echo 
" out: ".$row->V_NUMERIC[$i]."\n";
106:             }
107:             if (
$row->V_SMALLINT[$i] != $v_smallint[$i]) {
108:                 echo 
" SMALLINT[$i] fail\n";
109:                 echo 
" in:  ".$v_smallint[$i]."\n";
110:                 echo 
" out: ".$row->V_SMALLINT[$i]."\n";
111:             }
112:             if (
$row->V_VARCHAR[$i] != $v_varchar[$i]) {
113:                 echo 
" VARCHAR[$i] fail:\n";
114:                 echo 
" in:  ".$v_varchar[$i]."\n";
115:                 echo 
" out: ".$row->V_VARCHAR[$i]."\n";
116:             }
117:         }
118:         
ibase_free_result($sel);
119:     }
/* for($iter) */
120:
121:     
echo "select\n";
122:
123:     
$sel ibase_query("SELECT v_multi[5,5,5],v_multi[10,10,10] FROM test7 WHERE iter = 0");
124:     
print_r(ibase_fetch_row($sel));
125:     
ibase_free_result($sel);
126:
127:     for(
$iter 1$iter <= 3$iter++) {
128:
129:         if(!(
$sel ibase_query(
130:             
"select iter from test7 where v_char[$iter] LIKE ?"$v_char[$iter]."%")) ||
131:             !
ibase_fetch_row($sel)) {
132:             echo 
"CHAR fail\n";
133:         }
134:         
ibase_free_result($sel);
135:
136:         if(!(
$sel ibase_query(
137:             
"select iter from test7 where v_date[$iter] = ?"$v_date[$iter])) ||
138:             !
ibase_fetch_row($sel)) {
139:             echo 
"DATE fail\n";
140:         }
141:         
ibase_free_result($sel);
142:         if(!(
$sel ibase_query(
143:             
"select iter from test7 where v_decimal[$iter] = ?"$v_decimal[$iter])) ||
144:             !
ibase_fetch_row($sel)) {
145:             echo 
"DECIMAL fail\n";
146:         }
147:         
ibase_free_result($sel);
148:         if(!(
$sel ibase_query(
149:             
"select iter from test7 where v_integer[$iter] = ?"$v_integer[$iter])) ||
150:             !
ibase_fetch_row($sel)) {
151:             echo 
"INTEGER fail\n";
152:         }
153:         
ibase_free_result($sel);
154:         if(!(
$sel ibase_query(
155:             
"select iter from test7 where v_numeric[$iter] = ?"$v_numeric[$iter])) ||
156:             !
ibase_fetch_row($sel)) {
157:             echo 
"NUMERIC fail\n";
158:         }
159:         
ibase_free_result($sel);
160:         if(!(
$sel ibase_query(
161:             
"select iter from test7 where v_smallint[$iter] = ?"$v_smallint[$iter])) ||
162:             !
ibase_fetch_row($sel)) {
163:             echo 
"SMALLINT fail\n";
164:         }
165:         
ibase_free_result($sel);
166:     }
167:     
ibase_close();
168:     echo 
"end of test\n";
169:
?>
170:

Report

==6783== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==6783==    at 0xD7FDB7C: send (in /lib64/libc-2.12.so)
==6783==    by 0x6610227: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x66104DE: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x660523A: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x6605C25: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x660E747: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x65EACFB: isc_put_slice (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x65FDF84: isc_array_put_slice (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x79EC90: _php_ibase_bind (ibase_query.c:789)
==6783==    by 0x79FE2A: _php_ibase_exec (ibase_query.c:975)
==6783==    by 0x7A0C7F: zif_ibase_query (ibase_query.c:1175)
==6783==    by 0x1208286: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:655)
==6783==    by 0x1208286: execute_ex (zend_vm_execute.h:54819)
==6783==  Address 0x4154078 is in a rw- anonymous segment
==6783== 
==6783== Invalid read of size 4
==6783==    at 0x65F7A82: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x65E9759: isc_database_info (in /usr/lib64/libfbclient.so.2.5.7)
==6783==    by 0x79C130: _php_ibase_free_stmt_handle (ibase_query.c:127)
==6783==    by 0x79C26F: _php_ibase_free_result (ibase_query.c:148)
==6783==    by 0x102A02D: zend_resource_dtor (zend_list.c:74)
==6783==    by 0x102AA54: zend_close_rsrc (zend_list.c:228)
==6783==    by 0x102013F: zend_hash_reverse_apply (zend_hash.c:1836)
==6783==    by 0x102AAA0: zend_close_rsrc_list (zend_list.c:236)
==6783==    by 0xFB7B93: shutdown_executor (zend_execute_API.c:265)
==6783==    by 0xFE9E9B: zend_deactivate (zend.c:1144)
==6783==    by 0xED7B06: php_request_shutdown (main.c:1932)
==6783==    by 0x12376DF: do_cli (php_cli.c:1164)
==6783==  Address 0x15fefa10 is 0 bytes inside a block of size 32 free'd
==6783==    at 0x4C28BD4: free (vg_replace_malloc.c:529)
==6783==    by 0xF7C850: _efree (zend_alloc.c:2497)
==6783==    by 0x79852B: _php_ibase_close_link (interbase.c:643)
==6783==    by 0x102A02D: zend_resource_dtor (zend_list.c:74)
==6783==    by 0x102A110: zend_list_close (zend_list.c:87)
==6783==    by 0x79A6C0: zif_ibase_close (interbase.c:1065)
==6783==    by 0x1208286: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:655)
==6783==    by 0x1208286: execute_ex (zend_vm_execute.h:54819)
==6783==    by 0x1230790: zend_execute (zend_vm_execute.h:60223)
==6783==    by 0xFEBDCB: zend_execute_scripts (zend.c:1608)
==6783==    by 0xED9F70: php_execute_script (main.c:2643)
==6783==    by 0x1236556: do_cli (php_cli.c:997)
==6783==    by 0x1238014: main (php_cli.c:1390)
==6783==  Block was alloc'd at
==6783==    at 0x4C291FA: malloc (vg_replace_malloc.c:298)
==6783==    by 0xF8058A: __zend_malloc (zend_alloc.c:2893)
==6783==    by 0xF77668: _emalloc_32 (zend_alloc.c:2410)
==6783==    by 0x799FA2: _php_ibase_connect (interbase.c:988)
==6783==    by 0x79A507: zif_ibase_connect (interbase.c:1030)
==6783==    by 0x1208286: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:655)
==6783==    by 0x1208286: execute_ex (zend_vm_execute.h:54819)
==6783==    by 0x1230790: zend_execute (zend_vm_execute.h:60223)
==6783==    by 0xFEBDCB: zend_execute_scripts (zend.c:1608)
==6783==    by 0xED9F70: php_execute_script (main.c:2643)
==6783==    by 0x1236556: do_cli (php_cli.c:997)
==6783==    by 0x1238014: main (php_cli.c:1390)
==6783== 

 

Generated at Tue, 06 Nov 2018 09:43:32 +0000 (7 days ago)

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