@@ -63,45 +63,43 @@ mysqli.max_persistent=1
6363 mysqli_query ($ link , "DELETE FROM test " );
6464 mysqli_close ($ link );
6565
66- if ($ IS_MYSQLND ) {
67- /*
68- mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
69- At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
70- 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
71- not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc.
72- It's only about malloc() vs. emalloc().
73-
74- However, the bug is about malloc() and efree(). You can make mysqlnd use malloc() by either using
75- pconnect or mysql_init() - so we should test pconnect as well.
76- */
77- $ host = 'p: ' . $ host ;
78- if (!$ link = my_mysqli_connect ($ host , $ user , $ passwd , $ db , $ port , $ socket )) {
79- printf ("[007] Connect failed, [%d] %s \n" , mysqli_connect_errno (), mysqli_connect_error ());
80- }
66+ /*
67+ mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
68+ At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
69+ 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
70+ not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc.
71+ It's only about malloc() vs. emalloc().
72+
73+ However, the bug is about malloc() and efree(). You can make mysqlnd use malloc() by either using
74+ pconnect or mysql_init() - so we should test pconnect as well.
75+ */
76+ $ host = 'p: ' . $ host ;
77+ if (!$ link = my_mysqli_connect ($ host , $ user , $ passwd , $ db , $ port , $ socket )) {
78+ printf ("[007] Connect failed, [%d] %s \n" , mysqli_connect_errno (), mysqli_connect_error ());
79+ }
8180
82- /* bug happened during query processing */
83- if (!@mysqli_query ($ link , sprintf ("LOAD DATA LOCAL INFILE '%s'
84- INTO TABLE test
85- FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
86- LINES TERMINATED BY ' \n' " ,
87- mysqli_real_escape_string ($ link , $ file )))) {
88- printf ("[008] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
89- }
81+ /* bug happened during query processing */
82+ if (!@mysqli_query ($ link , sprintf ("LOAD DATA LOCAL INFILE '%s'
83+ INTO TABLE test
84+ FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
85+ LINES TERMINATED BY ' \n' " ,
86+ mysqli_real_escape_string ($ link , $ file )))) {
87+ printf ("[008] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
88+ }
9089
91- /* we survived? that's good enough... */
90+ /* we survived? that's good enough... */
9291
93- if (!$ res = mysqli_query ($ link , "SELECT * FROM test ORDER BY id " ))
94- printf ("[009] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
92+ if (!$ res = mysqli_query ($ link , "SELECT * FROM test ORDER BY id " ))
93+ printf ("[009] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
9594
96- $ i = 0 ;
97- while ($ row = mysqli_fetch_assoc ($ res )) {
98- if (($ row ['id ' ] != $ rows [$ i ]['id ' ]) || ($ row ['label ' ] != $ rows [$ i ]['label ' ])) {
99- printf ("[010] Wrong values, check manually! \n" );
100- }
101- $ i ++;
95+ $ i = 0 ;
96+ while ($ row = mysqli_fetch_assoc ($ res )) {
97+ if (($ row ['id ' ] != $ rows [$ i ]['id ' ]) || ($ row ['label ' ] != $ rows [$ i ]['label ' ])) {
98+ printf ("[010] Wrong values, check manually! \n" );
10299 }
103- mysqli_close ( $ link ) ;
100+ $ i ++ ;
104101 }
102+ mysqli_close ($ link );
105103
106104 print "done! " ;
107105?>
0 commit comments