PHP  
 PHP_5_3
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 /* $Id$ */
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

==26385== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==26385==    at 0xCD2AA8C: send (in /lib64/libc-2.12.so)
==26385==    by 0x61AB307: ??? (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x61AB5BE: ??? (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x61A002A: ??? (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x61A09E5: ??? (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x61A6BB7: ??? (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x618602B: isc_put_slice (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x61990A4: isc_array_put_slice (in /usr/lib64/libfbclient.so.2.5.2)
==26385==    by 0x762C3D: _php_ibase_bind (ibase_query.c:788)
==26385==    by 0x763AA8: _php_ibase_exec (ibase_query.c:972)
==26385==    by 0x764945: zif_ibase_query (ibase_query.c:1177)
==26385==    by 0xDBB770: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:322)
==26385==  Address 0x4054f8c is not stack'd, malloc'd or (recently) free'd
==26385== 

 

Generated at Sun, 27 Jul 2014 12:58:43 +0000 (47 hours ago)

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