From 70b9635be3b1a2f681eeaa1a237e6bdecd7b9ef2 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 28 Jul 2023 16:21:19 +0100 Subject: [PATCH 01/14] ext/mysqli: Batch 1 of amending tests so they can run in parallel --- ext/mysqli/tests/001.phpt | 5 +- ext/mysqli/tests/002.phpt | 86 --------- ext/mysqli/tests/004.phpt | 90 ---------- ext/mysqli/tests/005.phpt | 62 ------- ext/mysqli/tests/009.phpt | 117 ------------- ext/mysqli/tests/021.phpt | 60 ------- ext/mysqli/tests/022.phpt | 65 ------- ext/mysqli/tests/023.phpt | 84 --------- ext/mysqli/tests/024.phpt | 84 --------- ext/mysqli/tests/025.phpt | 89 ---------- ext/mysqli/tests/026.phpt | 66 ------- ext/mysqli/tests/029.phpt | 43 ----- ext/mysqli/tests/030.phpt | 31 ---- ext/mysqli/tests/031.phpt | 31 ---- ext/mysqli/tests/032.phpt | 43 ----- ext/mysqli/tests/035.phpt | 25 --- ext/mysqli/tests/037.phpt | 54 ------ ext/mysqli/tests/038.phpt | 48 ----- ext/mysqli/tests/040.phpt | 48 ----- ext/mysqli/tests/041.phpt | 39 ----- ext/mysqli/tests/050.phpt | 25 --- ext/mysqli/tests/051.phpt | 26 --- ext/mysqli/tests/052.phpt | 26 --- ext/mysqli/tests/053.phpt | 24 --- ext/mysqli/tests/054.phpt | 24 --- ext/mysqli/tests/055.phpt | 23 --- ext/mysqli/tests/068.phpt | 11 -- ext/mysqli/tests/bind_fetch/bigint_types.phpt | 83 +++++++++ .../tests/bind_fetch/char_text_big_types.phpt | 51 ++++++ .../tests/bind_fetch/char_text_types.phpt | 80 +++++++++ .../datetime_types.phpt} | 64 ++++--- .../{010.phpt => bind_fetch/float_types.phpt} | 30 ++-- .../identical_fetch_row.phpt} | 35 ++-- .../integer_types.phpt} | 32 ++-- .../mysql_functions.phpt} | 12 +- .../smallint_types.phpt} | 32 ++-- .../system_variable.phpt} | 8 +- .../tinyint_types.phpt} | 30 ++-- .../bind_fetch/unsigned_integer_types.phpt | 45 +++++ .../user_db_variable.phpt} | 8 +- .../tests/bind_fetch/varied_data_types.phpt | 78 +++++++++ .../varied_data_types2.phpt} | 30 ++-- .../varied_data_types3.phpt} | 30 ++-- .../bind_insert/char_text_big_types.phpt | 57 ++++++ .../tests/bind_insert/char_text_types.phpt | 52 ++++++ .../datetime_types.phpt} | 39 ++--- .../tests/bind_insert/integer_types.phpt | 76 ++++++++ .../tests/bind_insert/send_long_data.phpt | 58 +++++++ .../tests/bind_insert/smallint_types.phpt | 76 ++++++++ .../tests/bind_insert/tinyint_types.phpt | 79 +++++++++ .../varied_data_types.phpt} | 33 ++-- .../call_statement_after_close.phpt | 29 ++++ .../free_nothing.phpt | 21 +++ .../free_resultset_after_close.phpt | 22 +++ .../free_statement_after_close.phpt | 24 +++ .../non_freed_resultset.phpt | 22 +++ .../non_freed_statement.phpt | 23 +++ .../tests/functions/mysqli_affected_rows.phpt | 35 ++++ .../mysqli_character_set_name.phpt} | 12 +- ext/mysqli/tests/functions/mysqli_errno.phpt | 40 +++++ ext/mysqli/tests/functions/mysqli_error.phpt | 39 +++++ .../tests/functions/mysqli_field_count.phpt | 44 +++++ .../functions/mysqli_get_client_info.phpt | 12 ++ .../mysqli_get_host_info.phpt} | 8 +- .../mysqli_get_proto_info.phpt} | 8 +- .../functions/mysqli_get_server_info.phpt | 26 +++ .../mysqli_get_server_version.phpt} | 8 +- ext/mysqli/tests/functions/mysqli_info.phpt | 35 ++++ .../tests/functions/mysqli_num_fields.phpt | 39 +++++ .../mysqli_num_fields_show_variables.phpt} | 8 +- .../tests/functions/mysqli_num_rows.phpt | 40 +++++ .../{027.phpt => functions/mysqli_stat.phpt} | 8 +- .../tests/functions/mysqli_warning_count.phpt | 33 ++++ ext/mysqli/tests/test_setup/test_helpers.inc | 164 ++++++++++++++++++ ext/mysqli/tests/{ => transactions}/014.phpt | 8 +- ext/mysqli/tests/{ => transactions}/015.phpt | 8 +- 76 files changed, 1567 insertions(+), 1596 deletions(-) delete mode 100644 ext/mysqli/tests/002.phpt delete mode 100644 ext/mysqli/tests/004.phpt delete mode 100644 ext/mysqli/tests/005.phpt delete mode 100644 ext/mysqli/tests/009.phpt delete mode 100644 ext/mysqli/tests/021.phpt delete mode 100644 ext/mysqli/tests/022.phpt delete mode 100644 ext/mysqli/tests/023.phpt delete mode 100644 ext/mysqli/tests/024.phpt delete mode 100644 ext/mysqli/tests/025.phpt delete mode 100644 ext/mysqli/tests/026.phpt delete mode 100644 ext/mysqli/tests/029.phpt delete mode 100644 ext/mysqli/tests/030.phpt delete mode 100644 ext/mysqli/tests/031.phpt delete mode 100644 ext/mysqli/tests/032.phpt delete mode 100644 ext/mysqli/tests/035.phpt delete mode 100644 ext/mysqli/tests/037.phpt delete mode 100644 ext/mysqli/tests/038.phpt delete mode 100644 ext/mysqli/tests/040.phpt delete mode 100644 ext/mysqli/tests/041.phpt delete mode 100644 ext/mysqli/tests/050.phpt delete mode 100644 ext/mysqli/tests/051.phpt delete mode 100644 ext/mysqli/tests/052.phpt delete mode 100644 ext/mysqli/tests/053.phpt delete mode 100644 ext/mysqli/tests/054.phpt delete mode 100644 ext/mysqli/tests/055.phpt delete mode 100644 ext/mysqli/tests/068.phpt create mode 100644 ext/mysqli/tests/bind_fetch/bigint_types.phpt create mode 100644 ext/mysqli/tests/bind_fetch/char_text_big_types.phpt create mode 100644 ext/mysqli/tests/bind_fetch/char_text_types.phpt rename ext/mysqli/tests/{003.phpt => bind_fetch/datetime_types.phpt} (52%) rename ext/mysqli/tests/{010.phpt => bind_fetch/float_types.phpt} (57%) rename ext/mysqli/tests/{013.phpt => bind_fetch/identical_fetch_row.phpt} (50%) rename ext/mysqli/tests/{006.phpt => bind_fetch/integer_types.phpt} (56%) rename ext/mysqli/tests/{017.phpt => bind_fetch/mysql_functions.phpt} (71%) rename ext/mysqli/tests/{007.phpt => bind_fetch/smallint_types.phpt} (56%) rename ext/mysqli/tests/{018.phpt => bind_fetch/system_variable.phpt} (74%) rename ext/mysqli/tests/{008.phpt => bind_fetch/tinyint_types.phpt} (57%) create mode 100644 ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt rename ext/mysqli/tests/{016.phpt => bind_fetch/user_db_variable.phpt} (75%) create mode 100644 ext/mysqli/tests/bind_fetch/varied_data_types.phpt rename ext/mysqli/tests/{011.phpt => bind_fetch/varied_data_types2.phpt} (55%) rename ext/mysqli/tests/{012.phpt => bind_fetch/varied_data_types3.phpt} (54%) create mode 100644 ext/mysqli/tests/bind_insert/char_text_big_types.phpt create mode 100644 ext/mysqli/tests/bind_insert/char_text_types.phpt rename ext/mysqli/tests/{020.phpt => bind_insert/datetime_types.phpt} (57%) create mode 100644 ext/mysqli/tests/bind_insert/integer_types.phpt create mode 100644 ext/mysqli/tests/bind_insert/send_long_data.phpt create mode 100644 ext/mysqli/tests/bind_insert/smallint_types.phpt create mode 100644 ext/mysqli/tests/bind_insert/tinyint_types.phpt rename ext/mysqli/tests/{019.phpt => bind_insert/varied_data_types.phpt} (53%) create mode 100644 ext/mysqli/tests/closing_connection_tests/call_statement_after_close.phpt create mode 100644 ext/mysqli/tests/closing_connection_tests/free_nothing.phpt create mode 100644 ext/mysqli/tests/closing_connection_tests/free_resultset_after_close.phpt create mode 100644 ext/mysqli/tests/closing_connection_tests/free_statement_after_close.phpt create mode 100644 ext/mysqli/tests/closing_connection_tests/non_freed_resultset.phpt create mode 100644 ext/mysqli/tests/closing_connection_tests/non_freed_statement.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_affected_rows.phpt rename ext/mysqli/tests/{028.phpt => functions/mysqli_character_set_name.phpt} (52%) create mode 100644 ext/mysqli/tests/functions/mysqli_errno.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_error.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_field_count.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_get_client_info.phpt rename ext/mysqli/tests/{033.phpt => functions/mysqli_get_host_info.phpt} (59%) rename ext/mysqli/tests/{034.phpt => functions/mysqli_get_proto_info.phpt} (55%) create mode 100644 ext/mysqli/tests/functions/mysqli_get_server_info.phpt rename ext/mysqli/tests/{044.phpt => functions/mysqli_get_server_version.phpt} (56%) create mode 100644 ext/mysqli/tests/functions/mysqli_info.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_num_fields.phpt rename ext/mysqli/tests/{039.phpt => functions/mysqli_num_fields_show_variables.phpt} (68%) create mode 100644 ext/mysqli/tests/functions/mysqli_num_rows.phpt rename ext/mysqli/tests/{027.phpt => functions/mysqli_stat.phpt} (55%) create mode 100644 ext/mysqli/tests/functions/mysqli_warning_count.phpt create mode 100644 ext/mysqli/tests/test_setup/test_helpers.inc rename ext/mysqli/tests/{ => transactions}/014.phpt (94%) rename ext/mysqli/tests/{ => transactions}/015.phpt (94%) diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt index ec4cbc2c2d23..a97152ed5f6b 100644 --- a/ext/mysqli/tests/001.phpt +++ b/ext/mysqli/tests/001.phpt @@ -2,13 +2,16 @@ mysqli connect --EXTENSIONS-- mysqli +--CONFLICTS-- +mysqli --SKIPIF-- --FILE-- ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(11) { - [0]=> - int(1) - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL - [5]=> - NULL - [6]=> - NULL - [7]=> - NULL - [8]=> - NULL - [9]=> - string(4) "foo1" - [10]=> - string(4) "1000" -} -done! diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt deleted file mode 100644 index 09eff4a1ecfd..000000000000 --- a/ext/mysqli/tests/004.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -mysqli fetch char/text ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(15) "this is a test0" -} -array(2) { - [0]=> - string(10) "1234567891" - [1]=> - string(15) "this is a test1" -} -array(2) { - [0]=> - string(10) "1234567892" - [1]=> - string(15) "this is a test2" -} -array(2) { - [0]=> - string(10) "1234567893" - [1]=> - string(15) "this is a test3" -} -done! diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt deleted file mode 100644 index f5e97beebd2b..000000000000 --- a/ext/mysqli/tests/005.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -mysqli fetch char/text long ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(13) "32K String ok" -} -done! diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt deleted file mode 100644 index 7067cebd05c0..000000000000 --- a/ext/mysqli/tests/009.phpt +++ /dev/null @@ -1,117 +0,0 @@ ---TEST-- -mysqli fetch bigint values (ok to fail with 4.1.x) ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(8) { - [0]=> - int(5) - [1]=> - int(-23) - [2]=> - int(4) - [3]=> - string(14) "33333333333333" - [4]=> - int(0) - [5]=> - int(0) - [6]=> - int(100) - [7]=> - int(4567) -} -20123456 -3123456789 -done! diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt deleted file mode 100644 index e1d8838ef5b8..000000000000 --- a/ext/mysqli/tests/021.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysqli bind_param+bind_result char/text ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - string(14) "this is a test" -} -done! diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt deleted file mode 100644 index a3f0775fb8ae..000000000000 --- a/ext/mysqli/tests/022.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result char/text long ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -array(2) { - [0]=> - string(10) "1234567890" - [1]=> - %s(13) "32K String ok" -} -done! diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt deleted file mode 100644 index 9a7b84984db6..000000000000 --- a/ext/mysqli/tests/023.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -mysqli bind_param/bind_prepare fetch long values ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-9999999) - [5]=> - int(0) - [6]=> - int(0) -} -done! diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt deleted file mode 100644 index 0ce6e04144b6..000000000000 --- a/ext/mysqli/tests/024.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result short values ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(7) { - [0]=> - int(0) - [1]=> - int(35999) - [2]=> - NULL - [3]=> - int(-500) - [4]=> - int(-32768) - [5]=> - int(0) - [6]=> - int(0) -} -done! diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt deleted file mode 100644 index e0cae799342f..000000000000 --- a/ext/mysqli/tests/025.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result tinyint values ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(7) { - [0]=> - int(-23) - [1]=> - int(255) - [2]=> - int(0) - [3]=> - int(-100) - [4]=> - int(-127) - [5]=> - int(30) - [6]=> - int(0) -} -done! diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt deleted file mode 100644 index 02d1777752ac..000000000000 --- a/ext/mysqli/tests/026.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result with send_long_data ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - string(10) "Hello Worl" - [1]=> - string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence." -} -done! diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt deleted file mode 100644 index 8a167f195602..000000000000 --- a/ext/mysqli/tests/029.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -function test: mysqli_affected_rows ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -int(3) -done! diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt deleted file mode 100644 index 4c307f54407a..000000000000 --- a/ext/mysqli/tests/030.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -function test: mysqli_errno ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(0) -int(1146) -done! diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt deleted file mode 100644 index 9b66dd1c945d..000000000000 --- a/ext/mysqli/tests/031.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -function test: mysqli_error ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(0) "" -string(%d) "%s" -done! diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt deleted file mode 100644 index 16ddb62be717..000000000000 --- a/ext/mysqli/tests/032.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -function test: mysqli_info ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -string(38) "Records: 3 Duplicates: 0 Warnings: 0" -done! diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt deleted file mode 100644 index 8cda4e121dfa..000000000000 --- a/ext/mysqli/tests/035.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -function test: mysqli_get_server_info ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(1) -done! diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt deleted file mode 100644 index e9c3fd2dcaf2..000000000000 --- a/ext/mysqli/tests/037.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -function test: mysqli_field_count() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - int(0) - [1]=> - int(2) -} -done! diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt deleted file mode 100644 index 9e58e41bad49..000000000000 --- a/ext/mysqli/tests/038.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -function test: mysqli_num_fields() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -int(2) diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt deleted file mode 100644 index 1977d839b8fb..000000000000 --- a/ext/mysqli/tests/040.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -function test: mysqli_num_rows() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -int(1) -done! diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt deleted file mode 100644 index 14ca81db38a9..000000000000 --- a/ext/mysqli/tests/041.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -function test: mysqli_warning_count() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -int(1) -done! diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt deleted file mode 100644 index 311f724ac9c8..000000000000 --- a/ext/mysqli/tests/050.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -non freed statement test ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt deleted file mode 100644 index 30324e0103af..000000000000 --- a/ext/mysqli/tests/051.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -free statement after close ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt deleted file mode 100644 index 07ef84f9d6dc..000000000000 --- a/ext/mysqli/tests/052.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -call statement after close ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt deleted file mode 100644 index 6648aecd4e85..000000000000 --- a/ext/mysqli/tests/053.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -not freed resultset ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt deleted file mode 100644 index e6001f8edd40..000000000000 --- a/ext/mysqli/tests/054.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -free resultset after close ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt deleted file mode 100644 index d7784f3870c2..000000000000 --- a/ext/mysqli/tests/055.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -free nothing ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Ok diff --git a/ext/mysqli/tests/068.phpt b/ext/mysqli/tests/068.phpt deleted file mode 100644 index 9975da927273..000000000000 --- a/ext/mysqli/tests/068.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -mysqli get_client_info ---EXTENSIONS-- -mysqli ---FILE-- - ---EXPECT-- -string diff --git a/ext/mysqli/tests/bind_fetch/bigint_types.phpt b/ext/mysqli/tests/bind_fetch/bigint_types.phpt new file mode 100644 index 000000000000..cd95d6c045ff --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/bigint_types.phpt @@ -0,0 +1,83 @@ +--TEST-- +mysqli fetch bigint values (ok to fail with 4.1.x) +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(8) { + [0]=> + int(5) + [1]=> + int(-23) + [2]=> + int(4) + [3]=> + string(14) "33333333333333" + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(100) + [7]=> + int(4567) +} +done! diff --git a/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt b/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt new file mode 100644 index 000000000000..b055ba5a9f47 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt @@ -0,0 +1,51 @@ +--TEST-- +mysqli fetch long char/text +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + string(10) "1234567890" + [1]=> + string(13) "32K String ok" +} +done! diff --git a/ext/mysqli/tests/bind_fetch/char_text_types.phpt b/ext/mysqli/tests/bind_fetch/char_text_types.phpt new file mode 100644 index 000000000000..1ca6758982d2 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/char_text_types.phpt @@ -0,0 +1,80 @@ +--TEST-- +mysqli fetch char/text +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + string(10) "1234567890" + [1]=> + string(15) "this is a test0" +} +array(2) { + [0]=> + string(10) "1234567891" + [1]=> + string(15) "this is a test1" +} +array(2) { + [0]=> + string(10) "1234567892" + [1]=> + string(15) "this is a test2" +} +array(2) { + [0]=> + string(10) "1234567893" + [1]=> + string(15) "this is a test3" +} +done! diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/bind_fetch/datetime_types.phpt similarity index 52% rename from ext/mysqli/tests/003.phpt rename to ext/mysqli/tests/bind_fetch/datetime_types.phpt index 6ec2632a074b..53ffe7618f4a 100644 --- a/ext/mysqli/tests/003.phpt +++ b/ext/mysqli/tests/bind_fetch/datetime_types.phpt @@ -1,31 +1,33 @@ --TEST-- -mysqli connect +mysqli bind_result datetimes --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(7) { @@ -97,8 +91,8 @@ array(7) { [4]=> string(19) "2010-07-10 00:00:00" [5]=> - string(19) "0000-00-00 00:00:00" + string(24) "0000-00-00 00:00:00.0000" [6]=> - string(19) "1999-12-29 00:00:00" + string(26) "1999-12-29 00:00:00.000000" } done! diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/bind_fetch/float_types.phpt similarity index 57% rename from ext/mysqli/tests/010.phpt rename to ext/mysqli/tests/bind_fetch/float_types.phpt index 1a287360d8f8..07ba0efb8054 100644 --- a/ext/mysqli/tests/010.phpt +++ b/ext/mysqli/tests/bind_fetch/float_types.phpt @@ -6,36 +6,33 @@ precision=12 mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(7) { diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt similarity index 50% rename from ext/mysqli/tests/013.phpt rename to ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt index ff0ea29644b1..1d88f597013a 100644 --- a/ext/mysqli/tests/013.phpt +++ b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt @@ -1,44 +1,40 @@ --TEST-- -mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x server) +mysqli binding resulting of a fetch and fetching a row directly produce same results --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- ok diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/bind_fetch/integer_types.phpt similarity index 56% rename from ext/mysqli/tests/006.phpt rename to ext/mysqli/tests/bind_fetch/integer_types.phpt index 42a3467ad492..904095ba9f06 100644 --- a/ext/mysqli/tests/006.phpt +++ b/ext/mysqli/tests/bind_fetch/integer_types.phpt @@ -1,38 +1,35 @@ --TEST-- -mysqli fetch long values +mysqli fetch integer values --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(7) { diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt similarity index 71% rename from ext/mysqli/tests/017.phpt rename to ext/mysqli/tests/bind_fetch/mysql_functions.phpt index f4520483574a..9cebc6ce06c3 100644 --- a/ext/mysqli/tests/017.phpt +++ b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt @@ -1,17 +1,17 @@ --TEST-- -mysqli fetch functions +mysqli fetch MySQL functions --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --FILE-- --CLEAN-- --EXPECT-- array(7) { diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/bind_fetch/system_variable.phpt similarity index 74% rename from ext/mysqli/tests/018.phpt rename to ext/mysqli/tests/bind_fetch/system_variable.phpt index e452af7060c4..0304a3405c39 100644 --- a/ext/mysqli/tests/018.phpt +++ b/ext/mysqli/tests/bind_fetch/system_variable.phpt @@ -4,14 +4,14 @@ mysqli fetch system variables mysqli --SKIPIF-- --FILE-- --FILE-- --CLEAN-- --EXPECT-- array(7) { diff --git a/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt new file mode 100644 index 000000000000..97866fb05776 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt @@ -0,0 +1,45 @@ +--TEST-- +mysqli fetch unsigned integer values +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +20123456 +3123456789 +done! diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt similarity index 75% rename from ext/mysqli/tests/016.phpt rename to ext/mysqli/tests/bind_fetch/user_db_variable.phpt index 65414c34781e..01c53b616f2c 100644 --- a/ext/mysqli/tests/016.phpt +++ b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt @@ -4,14 +4,14 @@ mysqli fetch user variable mysqli --SKIPIF-- --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(11) { + [0]=> + int(1) + [1]=> + NULL + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL + [5]=> + NULL + [6]=> + NULL + [7]=> + NULL + [8]=> + NULL + [9]=> + string(4) "foo1" + [10]=> + string(4) "1000" +} +done! diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt similarity index 55% rename from ext/mysqli/tests/011.phpt rename to ext/mysqli/tests/bind_fetch/varied_data_types2.phpt index d962c8c473de..93d46ec4562a 100644 --- a/ext/mysqli/tests/011.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt @@ -6,33 +6,30 @@ precision=12 mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(8) { diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt similarity index 54% rename from ext/mysqli/tests/012.phpt rename to ext/mysqli/tests/bind_fetch/varied_data_types3.phpt index cdb9446ba1d0..e5527dde92fc 100644 --- a/ext/mysqli/tests/012.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt @@ -6,32 +6,29 @@ precision=12 mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(8) { diff --git a/ext/mysqli/tests/bind_insert/char_text_big_types.phpt b/ext/mysqli/tests/bind_insert/char_text_big_types.phpt new file mode 100644 index 000000000000..9918ba503946 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/char_text_big_types.phpt @@ -0,0 +1,57 @@ +--TEST-- +mysqli insert (bind_param + bind_result) long char/text types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +array(2) { + [0]=> + string(10) "1234567890" + [1]=> + %s(13) "32K String ok" +} +done! diff --git a/ext/mysqli/tests/bind_insert/char_text_types.phpt b/ext/mysqli/tests/bind_insert/char_text_types.phpt new file mode 100644 index 000000000000..17037aaf4e19 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/char_text_types.phpt @@ -0,0 +1,52 @@ +--TEST-- +mysqli insert (bind_param + bind_result) char/text types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + string(10) "1234567890" + [1]=> + string(14) "this is a test" +} +done! diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/bind_insert/datetime_types.phpt similarity index 57% rename from ext/mysqli/tests/020.phpt rename to ext/mysqli/tests/bind_insert/datetime_types.phpt index c009cab47975..f87cad279c87 100644 --- a/ext/mysqli/tests/020.phpt +++ b/ext/mysqli/tests/bind_insert/datetime_types.phpt @@ -1,24 +1,23 @@ --TEST-- -mysqli bind_param/bind_result date +mysqli insert (bind_param + bind_result) datetime types --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- array(7) { diff --git a/ext/mysqli/tests/bind_insert/integer_types.phpt b/ext/mysqli/tests/bind_insert/integer_types.phpt new file mode 100644 index 000000000000..8055c247f618 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/integer_types.phpt @@ -0,0 +1,76 @@ +--TEST-- +mysqli insert (bind_param + bind_result) integer types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + int(0) + [1]=> + int(35999) + [2]=> + NULL + [3]=> + int(-500) + [4]=> + int(-9999999) + [5]=> + int(0) + [6]=> + int(0) +} +done! diff --git a/ext/mysqli/tests/bind_insert/send_long_data.phpt b/ext/mysqli/tests/bind_insert/send_long_data.phpt new file mode 100644 index 000000000000..29fa1dc260b1 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/send_long_data.phpt @@ -0,0 +1,58 @@ +--TEST-- +mysqli insert (bind_param + bind_result) with send_long_data +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + string(10) "Hello Worl" + [1]=> + string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence." +} +done! diff --git a/ext/mysqli/tests/bind_insert/smallint_types.phpt b/ext/mysqli/tests/bind_insert/smallint_types.phpt new file mode 100644 index 000000000000..91ade03bb99c --- /dev/null +++ b/ext/mysqli/tests/bind_insert/smallint_types.phpt @@ -0,0 +1,76 @@ +--TEST-- +mysqli insert (bind_param + bind_result) small integer types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + int(0) + [1]=> + int(35999) + [2]=> + NULL + [3]=> + int(-500) + [4]=> + int(-32768) + [5]=> + int(0) + [6]=> + int(0) +} +done! diff --git a/ext/mysqli/tests/bind_insert/tinyint_types.phpt b/ext/mysqli/tests/bind_insert/tinyint_types.phpt new file mode 100644 index 000000000000..4eeddcc372b0 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/tinyint_types.phpt @@ -0,0 +1,79 @@ +--TEST-- +mysqli insert (bind_param + bind_result) tiny integer types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + int(-23) + [1]=> + int(255) + [2]=> + int(0) + [3]=> + int(-100) + [4]=> + int(-127) + [5]=> + int(30) + [6]=> + int(0) +} +done! diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/bind_insert/varied_data_types.phpt similarity index 53% rename from ext/mysqli/tests/019.phpt rename to ext/mysqli/tests/bind_insert/varied_data_types.phpt index 03d18d4a0350..761d3b311da8 100644 --- a/ext/mysqli/tests/019.phpt +++ b/ext/mysqli/tests/bind_insert/varied_data_types.phpt @@ -1,32 +1,29 @@ --TEST-- -mysqli fetch (bind_param + bind_result) +mysqli insert (bind_param + bind_result) --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(11) { diff --git a/ext/mysqli/tests/closing_connection_tests/call_statement_after_close.phpt b/ext/mysqli/tests/closing_connection_tests/call_statement_after_close.phpt new file mode 100644 index 000000000000..f77393adab66 --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/call_statement_after_close.phpt @@ -0,0 +1,29 @@ +--TEST-- +mysqli_stmt_execute() after mysqli_close() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- +getMessage(), PHP_EOL; +} +mysqli_stmt_close($stmt2); +printf("Ok\n"); +?> +--EXPECT-- +MySQL server has gone away +Ok diff --git a/ext/mysqli/tests/closing_connection_tests/free_nothing.phpt b/ext/mysqli/tests/closing_connection_tests/free_nothing.phpt new file mode 100644 index 000000000000..e02d6eef4ada --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/free_nothing.phpt @@ -0,0 +1,21 @@ +--TEST-- +free nothing (e.g. no mysqli_close()) +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/mysqli/tests/closing_connection_tests/free_resultset_after_close.phpt b/ext/mysqli/tests/closing_connection_tests/free_resultset_after_close.phpt new file mode 100644 index 000000000000..58f9030d6913 --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/free_resultset_after_close.phpt @@ -0,0 +1,22 @@ +--TEST-- +free resultset (mysqli_free_result()) after mysqli_close() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/mysqli/tests/closing_connection_tests/free_statement_after_close.phpt b/ext/mysqli/tests/closing_connection_tests/free_statement_after_close.phpt new file mode 100644 index 000000000000..50cac5949e16 --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/free_statement_after_close.phpt @@ -0,0 +1,24 @@ +--TEST-- +free statement (mysqli_stmt_close()) after mysqli_close() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/mysqli/tests/closing_connection_tests/non_freed_resultset.phpt b/ext/mysqli/tests/closing_connection_tests/non_freed_resultset.phpt new file mode 100644 index 000000000000..07017f5107f3 --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/non_freed_resultset.phpt @@ -0,0 +1,22 @@ +--TEST-- +not freed resultset (missing mysqli_free_result()) +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/mysqli/tests/closing_connection_tests/non_freed_statement.phpt b/ext/mysqli/tests/closing_connection_tests/non_freed_statement.phpt new file mode 100644 index 000000000000..feed6b8e0bec --- /dev/null +++ b/ext/mysqli/tests/closing_connection_tests/non_freed_statement.phpt @@ -0,0 +1,23 @@ +--TEST-- +non freed statement (missing mysqli_stmt_close()) +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/mysqli/tests/functions/mysqli_affected_rows.phpt b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt new file mode 100644 index 000000000000..99756905b03c --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt @@ -0,0 +1,35 @@ +--TEST-- +function test: mysqli_affected_rows +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(3) +done! diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt similarity index 52% rename from ext/mysqli/tests/028.phpt rename to ext/mysqli/tests/functions/mysqli_character_set_name.phpt index 19b03d07e8d3..ce135be2f2ec 100644 --- a/ext/mysqli/tests/028.phpt +++ b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt @@ -4,14 +4,14 @@ function test: mysqli_character_set_name mysqli --SKIPIF-- --FILE-- ---EXPECTF-- -string(%d) "%s" +--EXPECT-- +string(6) "utf8mb" done! diff --git a/ext/mysqli/tests/functions/mysqli_errno.phpt b/ext/mysqli/tests/functions/mysqli_errno.phpt new file mode 100644 index 000000000000..49d22ebb6302 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_errno.phpt @@ -0,0 +1,40 @@ +--TEST-- +function test: mysqli_errno +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(0) +int(1146) +done! diff --git a/ext/mysqli/tests/functions/mysqli_error.phpt b/ext/mysqli/tests/functions/mysqli_error.phpt new file mode 100644 index 000000000000..a5e9827673f4 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +function test: mysqli_error +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +string(0) "" +string(%d) "%s" +done! diff --git a/ext/mysqli/tests/functions/mysqli_field_count.phpt b/ext/mysqli/tests/functions/mysqli_field_count.phpt new file mode 100644 index 000000000000..5702381605a8 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_field_count.phpt @@ -0,0 +1,44 @@ +--TEST-- +function test: mysqli_field_count() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + int(0) + [1]=> + int(2) +} +done! diff --git a/ext/mysqli/tests/functions/mysqli_get_client_info.phpt b/ext/mysqli/tests/functions/mysqli_get_client_info.phpt new file mode 100644 index 000000000000..c868c714004e --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_get_client_info.phpt @@ -0,0 +1,12 @@ +--TEST-- +function test: mysqli_get_client_info +--EXTENSIONS-- +mysqli +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/functions/mysqli_get_host_info.phpt similarity index 59% rename from ext/mysqli/tests/033.phpt rename to ext/mysqli/tests/functions/mysqli_get_host_info.phpt index 0bed5e03fc14..58bec8c34a13 100644 --- a/ext/mysqli/tests/033.phpt +++ b/ext/mysqli/tests/functions/mysqli_get_host_info.phpt @@ -4,14 +4,14 @@ function test: mysqli_get_host_info mysqli --SKIPIF-- --FILE-- --FILE-- +--FILE-- + +--EXPECT-- +bool(true) +done! diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/functions/mysqli_get_server_version.phpt similarity index 56% rename from ext/mysqli/tests/044.phpt rename to ext/mysqli/tests/functions/mysqli_get_server_version.phpt index ec3a1e87fcac..ca14a92a12f8 100644 --- a/ext/mysqli/tests/044.phpt +++ b/ext/mysqli/tests/functions/mysqli_get_server_version.phpt @@ -4,14 +4,14 @@ mysqli_get_server_version mysqli --SKIPIF-- --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECT-- +string(38) "Records: 3 Duplicates: 0 Warnings: 0" +done! diff --git a/ext/mysqli/tests/functions/mysqli_num_fields.phpt b/ext/mysqli/tests/functions/mysqli_num_fields.phpt new file mode 100644 index 000000000000..c5887088f319 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_num_fields.phpt @@ -0,0 +1,39 @@ +--TEST-- +function test: mysqli_num_fields() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(2) diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/functions/mysqli_num_fields_show_variables.phpt similarity index 68% rename from ext/mysqli/tests/039.phpt rename to ext/mysqli/tests/functions/mysqli_num_fields_show_variables.phpt index 26e0ac42ec27..05205e653e22 100644 --- a/ext/mysqli/tests/039.phpt +++ b/ext/mysqli/tests/functions/mysqli_num_fields_show_variables.phpt @@ -4,14 +4,14 @@ function test: mysqli_num_fields() 2 mysqli --SKIPIF-- --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(1) +done! diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/functions/mysqli_stat.phpt similarity index 55% rename from ext/mysqli/tests/027.phpt rename to ext/mysqli/tests/functions/mysqli_stat.phpt index 2b3a6f1426d8..cd972f356c25 100644 --- a/ext/mysqli/tests/027.phpt +++ b/ext/mysqli/tests/functions/mysqli_stat.phpt @@ -4,14 +4,14 @@ function test: mysqli_stat mysqli --SKIPIF-- --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(1) +done! diff --git a/ext/mysqli/tests/test_setup/test_helpers.inc b/ext/mysqli/tests/test_setup/test_helpers.inc new file mode 100644 index 000000000000..cc57a2d06d31 --- /dev/null +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -0,0 +1,164 @@ + --FILE-- --CLEAN-- --EXPECT-- Num_of_rows=1 diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/transactions/015.phpt similarity index 94% rename from ext/mysqli/tests/015.phpt rename to ext/mysqli/tests/transactions/015.phpt index 5fef3f9250b9..9f2478048772 100644 --- a/ext/mysqli/tests/015.phpt +++ b/ext/mysqli/tests/transactions/015.phpt @@ -2,9 +2,11 @@ mysqli autocommit/commit/rollback with innodb --EXTENSIONS-- mysqli +--CONFLICTS-- +mysqli_transactions --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(2) { From ebd5e07c835f90dcdd7b4c7fccd0c228d5c6ff88 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 29 Jul 2023 07:57:04 +0100 Subject: [PATCH 02/14] Some more tests of different type Add a way to set up a table with some data in the table helpers --- ext/mysqli/tests/fetch/mysqli_fetch_all.phpt | 174 +++++++ ...mysqli_fetch_all_data_types_variation.phpt | 234 +++++++++ .../tests/functions/mysqli_set_charset.phpt | 84 ++++ ext/mysqli/tests/mysqli_character_set.phpt | 93 ---- .../{ => mysqli_driver}/write_property.phpt | 2 +- .../write_property_strict.phpt | 2 +- ext/mysqli/tests/mysqli_fetch_all.phpt | 445 ------------------ ext/mysqli/tests/test_setup/test_helpers.inc | 8 + 8 files changed, 502 insertions(+), 540 deletions(-) create mode 100644 ext/mysqli/tests/fetch/mysqli_fetch_all.phpt create mode 100644 ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt create mode 100644 ext/mysqli/tests/functions/mysqli_set_charset.phpt delete mode 100644 ext/mysqli/tests/mysqli_character_set.phpt rename ext/mysqli/tests/{ => mysqli_driver}/write_property.phpt (93%) rename ext/mysqli/tests/{ => mysqli_driver}/write_property_strict.phpt (90%) delete mode 100644 ext/mysqli/tests/mysqli_fetch_all.phpt diff --git a/ext/mysqli/tests/fetch/mysqli_fetch_all.phpt b/ext/mysqli/tests/fetch/mysqli_fetch_all.phpt new file mode 100644 index 000000000000..8ee36c1a0b09 --- /dev/null +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all.phpt @@ -0,0 +1,174 @@ +--TEST-- +mysqli_fetch_all() +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- +getMessage() . \PHP_EOL; +} +mysqli_free_result($result); +try { + mysqli_fetch_array($result, MYSQLI_ASSOC); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} + +print "done!"; +?> +--CLEAN-- + +--EXPECT-- +Default mode +array(2) { + [0]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "a" + } + [1]=> + array(2) { + [0]=> + string(1) "2" + [1]=> + string(1) "b" + } +} +Mode: MYSQLI_NUM +array(2) { + [0]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "a" + } + [1]=> + array(2) { + [0]=> + string(1) "2" + [1]=> + string(1) "b" + } +} +Mode: MYSQLI_BOTH +array(2) { + [0]=> + array(4) { + [0]=> + string(1) "1" + ["id"]=> + string(1) "1" + [1]=> + string(1) "a" + ["label"]=> + string(1) "a" + } + [1]=> + array(4) { + [0]=> + string(1) "2" + ["id"]=> + string(1) "2" + [1]=> + string(1) "b" + ["label"]=> + string(1) "b" + } +} +Mode: MYSQLI_ASSOC +array(2) { + [0]=> + array(2) { + ["id"]=> + string(1) "1" + ["label"]=> + string(1) "a" + } + [1]=> + array(2) { + ["id"]=> + string(1) "2" + ["label"]=> + string(1) "b" + } +} +mysqli_fetch_all() after fetching +array(0) { +} +[017] +array(1) { + [0]=> + array(11) { + [0]=> + string(1) "1" + ["a"]=> + string(1) "2" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + ["c"]=> + string(1) "3" + [3]=> + string(1) "4" + ["C"]=> + string(1) "4" + [4]=> + NULL + ["d"]=> + NULL + [5]=> + string(1) "1" + ["e"]=> + string(1) "1" + } +} +mysqli_fetch_all(): Argument #2 ($mode) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH +mysqli_result object is already closed +done! diff --git a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt new file mode 100644 index 000000000000..1df8ec59d1d5 --- /dev/null +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt @@ -0,0 +1,234 @@ +--TEST-- +mysqli_fetch_all() data types variation +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- +getMessage(), PHP_EOL; + return; + } + + if (is_null($php_value)) { + mysqli_query($link, $sql = sprintf("INSERT INTO test_mysqli_fetch_all_data_types_variation(id, label) VALUES (1, NULL)")); + } else { + if (is_string($sql_value)) { + mysqli_query($link, $sql = "INSERT INTO test_mysqli_fetch_all_data_types_variation(id, label) VALUES (1, '" . $sql_value . "')"); + } else { + mysqli_query($link, $sql = sprintf("INSERT INTO test_mysqli_fetch_all_data_types_variation(id, label) VALUES (1, '%d')", $sql_value)); + } + } + + $result = mysqli_query($link, "SELECT id, label FROM test_mysqli_fetch_all_data_types_variation"); + $tmp = mysqli_fetch_all($result, MYSQLI_BOTH); + $row = $tmp[0]; + + $fields = mysqli_fetch_fields($result); + + // I have no idea what this condition does as this seem to be some PHP 6 stuff??? + // if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { + + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); + } + } + mysqli_query($link, 'DROP TABLE test_mysqli_fetch_all_data_types_variation'); +} + +// TODO Optimize this? +function func_mysqli_fetch_array_make_string(int $len): string { + $ret = ''; + for ($i = 0; $i < $len; $i++) { + $ret .= chr(mt_rand(65, 90)); + } + return $ret; +} + +$engine = get_default_db_engine(); +func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20); +func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30); +func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); +func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); + +func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60); +func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70); +func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80); +func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90); + +func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100); +func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110); +func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120); +func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); +func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); + +func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); +func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); +func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170); +func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); +func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); + +func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); +func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210); +func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220); +func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); +func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); + +func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); + +func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260); +func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); +func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); + +func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); +func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300); +func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu"); +func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); + +func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); +func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); +func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); +func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); + +func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); +func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); +func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); +func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); + +// don't care about date() strict TZ warnings... +func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410); +func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420); +func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430); + +func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440); +func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450); +func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460); + +func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470); + +func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480); +func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490); +func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500); + +func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); +func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); +func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530); + +$string255 = func_mysqli_fetch_array_make_string(255); +func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540); +func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550); +func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); +func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570); + +$string65k = func_mysqli_fetch_array_make_string(65400); +func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580); +func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590); +func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); +func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); +func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620); + +func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630); +func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); +func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); +func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660); + +func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670); +func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); +func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); +func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700); + +func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710); +func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); +func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); +func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740); + +func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750); +func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); +func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770); + +func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780); +func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); +func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790); + +func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800); +func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); +func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820); + +func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830); +func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); +func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); + +func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860); +func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); +func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); + +func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890); +func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); +func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910); + +func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920); +func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); + +func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940); +func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950); + +mysqli_close($link); + +// Split below into new test? +$link = default_mysqli_connect(); +mysqli_real_query($link, "SELECT 1 AS _one"); +$result = mysqli_use_result($link); + +/* on mysqlnd level this would not be allowed */ +if (!is_object($result)) { + printf("[018] Expecting object, got %s/%s. [%d] %s\n", + gettype($result), $result, mysqli_errno($link), mysqli_error($link)); + +} + +$rows = mysqli_fetch_all($result, MYSQLI_ASSOC); +if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) { + printf("[019] Results seem wrong, dumping\n"); + var_dump($rows); +} + +print "OK"; +?> +--CLEAN-- + +--EXPECT-- +OK diff --git a/ext/mysqli/tests/functions/mysqli_set_charset.phpt b/ext/mysqli/tests/functions/mysqli_set_charset.phpt new file mode 100644 index 000000000000..09a7a51c82da --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_set_charset.phpt @@ -0,0 +1,84 @@ +--TEST-- +Fetching results from tables of different charsets. +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +done! diff --git a/ext/mysqli/tests/mysqli_character_set.phpt b/ext/mysqli/tests/mysqli_character_set.phpt deleted file mode 100644 index 3c8b90afaf55..000000000000 --- a/ext/mysqli/tests/mysqli_character_set.phpt +++ /dev/null @@ -1,93 +0,0 @@ ---TEST-- -Fetching results from tables of different charsets. ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -done! diff --git a/ext/mysqli/tests/write_property.phpt b/ext/mysqli/tests/mysqli_driver/write_property.phpt similarity index 93% rename from ext/mysqli/tests/write_property.phpt rename to ext/mysqli/tests/mysqli_driver/write_property.phpt index 25b538f9aa17..456dd40c81df 100644 --- a/ext/mysqli/tests/write_property.phpt +++ b/ext/mysqli/tests/mysqli_driver/write_property.phpt @@ -1,5 +1,5 @@ --TEST-- -Writing to mysqli properties +Writing to mysqli_driver properties --EXTENSIONS-- mysqli --FILE-- diff --git a/ext/mysqli/tests/write_property_strict.phpt b/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt similarity index 90% rename from ext/mysqli/tests/write_property_strict.phpt rename to ext/mysqli/tests/mysqli_driver/write_property_strict.phpt index 841cc36b5560..41645ff61c28 100644 --- a/ext/mysqli/tests/write_property_strict.phpt +++ b/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt @@ -1,5 +1,5 @@ --TEST-- -Writing to mysqli properties (strict_types) +Writing to mysqli_driver properties (strict_types) --EXTENSIONS-- mysqli --FILE-- diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt deleted file mode 100644 index 75d26f617b45..000000000000 --- a/ext/mysqli/tests/mysqli_fetch_all.phpt +++ /dev/null @@ -1,445 +0,0 @@ ---TEST-- -mysqli_fetch_all() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- -getMessage() . \PHP_EOL; - } - mysqli_free_result($res); - - function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { - - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { - printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { - // don't bail, engine might not support the datatype - return false; - } - - if (is_null($php_value)) { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } else { - if (is_string($sql_value)) { - if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) { - printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql); - return false; - } - } else { - if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link)); - return false; - } - } - } - - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) { - printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link)); - return false; - } - - if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) { - printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link)); - return false; - } - $row = $tmp[0]; - - $fields = mysqli_fetch_fields($res); - - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - } - } - - return true; - } - - function func_mysqli_fetch_array_make_string($len) { - - $ret = ''; - for ($i = 0; $i < $len; $i++) - $ret .= chr(mt_rand(65, 90)); - - return $ret; - } - - func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20); - func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30); - func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40); - func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50); - - func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60); - func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70); - func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80); - func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90); - - func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100); - func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110); - func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120); - func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130); - func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140); - - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180); - func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190); - - func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200); - func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210); - func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220); - func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230); - func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240); - - func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250); - - func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260); - func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270); - func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280); - - func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu"); - func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300); - func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu"); - func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320); - - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350); - func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360); - - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390); - func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400); - - // don't care about date() strict TZ warnings... - func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410); - func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420); - func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430); - - func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440); - func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450); - func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460); - - func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470); - - func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480); - func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490); - func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500); - - func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510); - func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520); - func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530); - - $string255 = func_mysqli_fetch_array_make_string(255); - func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540); - func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550); - func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); - func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570); - - $string65k = func_mysqli_fetch_array_make_string(65400); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580); - func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590); - func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); - func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620); - - func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630); - func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640); - func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650); - func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660); - - func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670); - func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680); - func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690); - func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700); - - func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710); - func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720); - func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730); - func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740); - - func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750); - func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760); - func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770); - - func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780); - func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780); - func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790); - - func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800); - func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810); - func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820); - - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830); - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840); - func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850); - - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860); - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870); - func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880); - - func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890); - func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900); - func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910); - - func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920); - func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930); - - func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940); - func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950); - - mysqli_close($link); - - try { - mysqli_fetch_array($res, MYSQLI_ASSOC); - } catch (Error $exception) { - echo $exception->getMessage() . "\n"; - } - - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - } - - if (!$res = mysqli_real_query($link, "SELECT 1 AS _one")) - printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - /* on mysqlnd level this would not be allowed */ - if (!is_object($res = mysqli_use_result($link))) - printf("[018] Expecting object, got %s/%s. [%d] %s\n", - gettype($res), $res, mysqli_errno($link), mysqli_error($link)); - - $rows = mysqli_fetch_all($res, MYSQLI_ASSOC); - if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) { - printf("[019] Results seem wrong, dumping\n"); - var_dump($rows); - } - - print "done!"; -?> ---CLEAN-- - ---EXPECT-- -[005] -array(2) { - [0]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "a" - } - [1]=> - array(2) { - [0]=> - string(1) "2" - [1]=> - string(1) "b" - } -} -[007] -array(2) { - [0]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "a" - } - [1]=> - array(2) { - [0]=> - string(1) "2" - [1]=> - string(1) "b" - } -} -[008] -array(2) { - [0]=> - array(4) { - [0]=> - string(1) "1" - ["id"]=> - string(1) "1" - [1]=> - string(1) "a" - ["label"]=> - string(1) "a" - } - [1]=> - array(4) { - [0]=> - string(1) "2" - ["id"]=> - string(1) "2" - [1]=> - string(1) "b" - ["label"]=> - string(1) "b" - } -} -[010] -array(2) { - [0]=> - array(2) { - ["id"]=> - string(1) "1" - ["label"]=> - string(1) "a" - } - [1]=> - array(2) { - ["id"]=> - string(1) "2" - ["label"]=> - string(1) "b" - } -} -[011] -array(0) { -} -[013] -array(2) { - [0]=> - array(2) { - ["id"]=> - string(1) "1" - ["label"]=> - string(1) "a" - } - [1]=> - array(2) { - ["id"]=> - string(1) "2" - ["label"]=> - string(1) "b" - } -} -[016] -array(0) { -} -[017] -array(1) { - [0]=> - array(11) { - [0]=> - string(1) "1" - ["a"]=> - string(1) "2" - [1]=> - string(1) "2" - [2]=> - string(1) "3" - ["c"]=> - string(1) "3" - [3]=> - string(1) "4" - ["C"]=> - string(1) "4" - [4]=> - NULL - ["d"]=> - NULL - [5]=> - string(1) "1" - ["e"]=> - string(1) "1" - } -} -mysqli_fetch_all(): Argument #2 ($mode) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH -mysqli_result object is already closed -done! diff --git a/ext/mysqli/tests/test_setup/test_helpers.inc b/ext/mysqli/tests/test_setup/test_helpers.inc index cc57a2d06d31..b0b5dd92d1d4 100644 --- a/ext/mysqli/tests/test_setup/test_helpers.inc +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -159,6 +159,14 @@ function tear_down_table_on_default_connection(string $table) { } } +function setup_table_with_data_on_default_connection(string $table): mysqli { + $link = default_mysqli_connect(); + mysqli_query($link, 'SET SESSION sql_mode=\'\''); + mysqli_query($link, 'CREATE TABLE '. $table .'(id INT DEFAULT 0, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . get_default_db_engine()); + mysqli_query($link, 'INSERT INTO '. $table .'(id, label) VALUES (1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e"), (6, "f")'); + return $link; +} + /* Development setting: test experimental features and/or feature requests that never worked before? */ //$TEST_EXPERIMENTAL = 1 == getenv("MYSQL_TEST_EXPERIMENTAL"); //$engine = getenv("MYSQL_TEST_ENGINE") ?: "InnoDB"; From d1970da21b105cf5e16e4f88fed0b5c8aa5ed3db Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 29 Jul 2023 08:03:53 +0100 Subject: [PATCH 03/14] Debug mysqli_get_server_info() test --- ext/mysqli/tests/functions/mysqli_get_server_info.phpt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt b/ext/mysqli/tests/functions/mysqli_get_server_info.phpt index ce2f690c8492..b8ff888cac0f 100644 --- a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt +++ b/ext/mysqli/tests/functions/mysqli_get_server_info.phpt @@ -16,7 +16,11 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $sinfo = mysqli_get_server_info($link); /* Version is in format: X.Y.Z */ - var_dump(preg_match("#^\d+\.\d+\.\d+$#", $sinfo) === 1); + $status = preg_match("#^\d+\.\d+\.\d+$#", $sinfo) === 1; + var_dump($status); + if (!$status) { + var_dump($sinfo); + } mysqli_close($link); print "done!"; From e70ee5d9f117a4f7016a4febbbb68d806b5ff4aa Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 31 Jul 2023 16:01:52 +0100 Subject: [PATCH 04/14] Make transaction tests not conflict with the 'test' table --- ext/mysqli/tests/test_setup/test_helpers.inc | 47 +++++++++++- ext/mysqli/tests/transactions/014.phpt | 81 +++++++------------- ext/mysqli/tests/transactions/015.phpt | 76 ++++++------------ 3 files changed, 97 insertions(+), 107 deletions(-) diff --git a/ext/mysqli/tests/test_setup/test_helpers.inc b/ext/mysqli/tests/test_setup/test_helpers.inc index b0b5dd92d1d4..2c3f0e0e300b 100644 --- a/ext/mysqli/tests/test_setup/test_helpers.inc +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -145,11 +145,56 @@ function default_mysqli_real_connect(mysqli $link, int $flags = 0): bool { } function mysqli_check_skip_test(): void { - $link = @default_mysqli_connect_ex(); + /* Disable exceptions */ + mysqli_report(MYSQLI_REPORT_OFF); + $link = default_mysqli_connect_ex(); + // Re-enable exceptions + mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); + if (!is_object($link)) { + die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); + } + mysqli_close($link); +} + +function have_innodb(mysqli $link): bool { + if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) + && ($row = $res->fetch_row()) + && !empty($row) + ) { + return !($row[1] == 'DISABLED' || $row[1] == 'NO'); + } + // MySQL 5.6.1+ + if ($res = $link->query('SHOW ENGINES')) { + while ($row = $res->fetch_assoc()) { + if (!isset($row['Engine']) || !isset($row['Support'])) { + return false; + } + + if (($row['Engine'] == 'InnoDB') + && (($row['Support'] == 'YES') || ($row['Support'] == 'DEFAULT')) + ) { + return true; + } + } + } + return false; +} +function mysqli_check_innodb_support_skip_test(): void { + /* Disable exceptions */ + mysqli_report(MYSQLI_REPORT_OFF); + $link = default_mysqli_connect_ex(); if (!is_object($link)) { + // Re-enable exceptions + mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); } + $status = have_innodb($link); + // Re-enable exceptions + mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); mysqli_close($link); + if (!$status) { + die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error)); + } } function tear_down_table_on_default_connection(string $table) { diff --git a/ext/mysqli/tests/transactions/014.phpt b/ext/mysqli/tests/transactions/014.phpt index eb2bf232ba8a..9cd593ab9fc3 100644 --- a/ext/mysqli/tests/transactions/014.phpt +++ b/ext/mysqli/tests/transactions/014.phpt @@ -1,86 +1,59 @@ --TEST-- -mysqli autocommit/commit/rollback +mysqli autocommit/commit/rollback with innodb with CACHE --EXTENSIONS-- mysqli ---CONFLICTS-- -mysqli_transactions --SKIPIF-- errno, $link->error)); -} +require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; +mysqli_check_innodb_support_skip_test(); ?> --FILE-- --CLEAN-- --EXPECT-- Num_of_rows=1 diff --git a/ext/mysqli/tests/transactions/015.phpt b/ext/mysqli/tests/transactions/015.phpt index 9f2478048772..6fa26c0b715a 100644 --- a/ext/mysqli/tests/transactions/015.phpt +++ b/ext/mysqli/tests/transactions/015.phpt @@ -1,85 +1,57 @@ --TEST-- -mysqli autocommit/commit/rollback with innodb +mysqli autocommit/commit/rollback with innodb with SQL_NO_CACHE --EXTENSIONS-- mysqli ---CONFLICTS-- -mysqli_transactions --SKIPIF-- errno, $link->error)); -} +require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; +mysqli_check_innodb_support_skip_test(); ?> --FILE-- --CLEAN-- --EXPECT-- array(2) { From da5d4da5b8aaa2164463293d0a2b1123c16595a7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 31 Jul 2023 16:09:21 +0100 Subject: [PATCH 05/14] Drop useless calls to mysqli_select_db() --- ext/mysqli/tests/bind_fetch/char_text_types.phpt | 2 -- ext/mysqli/tests/bind_insert/char_text_big_types.phpt | 2 -- ext/mysqli/tests/bind_insert/char_text_types.phpt | 2 -- ext/mysqli/tests/bind_insert/datetime_types.phpt | 1 - ext/mysqli/tests/bind_insert/integer_types.phpt | 1 - ext/mysqli/tests/bind_insert/send_long_data.phpt | 1 - ext/mysqli/tests/bind_insert/smallint_types.phpt | 1 - ext/mysqli/tests/bind_insert/tinyint_types.phpt | 1 - ext/mysqli/tests/functions/mysqli_affected_rows.phpt | 2 -- ext/mysqli/tests/functions/mysqli_errno.phpt | 3 --- ext/mysqli/tests/functions/mysqli_error.phpt | 2 -- ext/mysqli/tests/functions/mysqli_field_count.phpt | 2 -- ext/mysqli/tests/functions/mysqli_info.phpt | 2 -- ext/mysqli/tests/functions/mysqli_num_fields.phpt | 2 -- ext/mysqli/tests/functions/mysqli_num_rows.phpt | 2 -- ext/mysqli/tests/functions/mysqli_warning_count.phpt | 2 -- 16 files changed, 28 deletions(-) diff --git a/ext/mysqli/tests/bind_fetch/char_text_types.phpt b/ext/mysqli/tests/bind_fetch/char_text_types.phpt index 1ca6758982d2..dc42b2e46d56 100644 --- a/ext/mysqli/tests/bind_fetch/char_text_types.phpt +++ b/ext/mysqli/tests/bind_fetch/char_text_types.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - if (!mysqli_query($link,"CREATE TABLE test_bind_fetch_char(c1 char(10), c2 text) ENGINE=" . get_default_db_engine())) printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/bind_insert/char_text_big_types.phpt b/ext/mysqli/tests/bind_insert/char_text_big_types.phpt index 9918ba503946..702ad1442aef 100644 --- a/ext/mysqli/tests/bind_insert/char_text_big_types.phpt +++ b/ext/mysqli/tests/bind_insert/char_text_big_types.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link,"CREATE TABLE insert_bind_char_text_long(c1 char(10), c2 text)"); diff --git a/ext/mysqli/tests/bind_insert/char_text_types.phpt b/ext/mysqli/tests/bind_insert/char_text_types.phpt index 17037aaf4e19..4119eb8c0b9c 100644 --- a/ext/mysqli/tests/bind_insert/char_text_types.phpt +++ b/ext/mysqli/tests/bind_insert/char_text_types.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link,"CREATE TABLE insert_bind_char_text(c1 char(10), c2 text)"); $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_char_text VALUES (?,?)"); diff --git a/ext/mysqli/tests/bind_insert/datetime_types.phpt b/ext/mysqli/tests/bind_insert/datetime_types.phpt index f87cad279c87..59bfd78fb0dd 100644 --- a/ext/mysqli/tests/bind_insert/datetime_types.phpt +++ b/ext/mysqli/tests/bind_insert/datetime_types.phpt @@ -13,7 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); mysqli_query($link, "SET sql_mode=''"); try { diff --git a/ext/mysqli/tests/bind_insert/integer_types.phpt b/ext/mysqli/tests/bind_insert/integer_types.phpt index 8055c247f618..eb3873b5bd2e 100644 --- a/ext/mysqli/tests/bind_insert/integer_types.phpt +++ b/ext/mysqli/tests/bind_insert/integer_types.phpt @@ -13,7 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_integers(c1 int unsigned, diff --git a/ext/mysqli/tests/bind_insert/send_long_data.phpt b/ext/mysqli/tests/bind_insert/send_long_data.phpt index 29fa1dc260b1..d09b66f5a790 100644 --- a/ext/mysqli/tests/bind_insert/send_long_data.phpt +++ b/ext/mysqli/tests/bind_insert/send_long_data.phpt @@ -13,7 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_send_long_data(c1 varchar(10), c2 text)"); diff --git a/ext/mysqli/tests/bind_insert/smallint_types.phpt b/ext/mysqli/tests/bind_insert/smallint_types.phpt index 91ade03bb99c..8319f59fba11 100644 --- a/ext/mysqli/tests/bind_insert/smallint_types.phpt +++ b/ext/mysqli/tests/bind_insert/smallint_types.phpt @@ -13,7 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_smallint(c1 smallint unsigned, diff --git a/ext/mysqli/tests/bind_insert/tinyint_types.phpt b/ext/mysqli/tests/bind_insert/tinyint_types.phpt index 4eeddcc372b0..083e0dcce5df 100644 --- a/ext/mysqli/tests/bind_insert/tinyint_types.phpt +++ b/ext/mysqli/tests/bind_insert/tinyint_types.phpt @@ -13,7 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_tinyint(c1 tinyint, diff --git a/ext/mysqli/tests/functions/mysqli_affected_rows.phpt b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt index 99756905b03c..71b82f8c0dea 100644 --- a/ext/mysqli/tests/functions/mysqli_affected_rows.phpt +++ b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "CREATE TABLE test_mysqli_affected_rows (a INT)"); mysqli_query($link, "INSERT INTO test_mysqli_affected_rows VALUES (1),(2),(3)"); diff --git a/ext/mysqli/tests/functions/mysqli_errno.phpt b/ext/mysqli/tests/functions/mysqli_errno.phpt index 49d22ebb6302..3470c3e30df8 100644 --- a/ext/mysqli/tests/functions/mysqli_errno.phpt +++ b/ext/mysqli/tests/functions/mysqli_errno.phpt @@ -14,13 +14,10 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; /* Disable exceptions */ mysqli_report(MYSQLI_REPORT_OFF); - $link = default_mysqli_connect(); $errno = mysqli_errno($link); var_dump($errno); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "SELECT * FROM non_existing_table"); $errno = mysqli_errno($link); diff --git a/ext/mysqli/tests/functions/mysqli_error.phpt b/ext/mysqli/tests/functions/mysqli_error.phpt index a5e9827673f4..8f4fba64d9ec 100644 --- a/ext/mysqli/tests/functions/mysqli_error.phpt +++ b/ext/mysqli/tests/functions/mysqli_error.phpt @@ -18,8 +18,6 @@ mysqli_report(MYSQLI_REPORT_OFF); $error = mysqli_error($link); var_dump($error); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "SELECT * FROM non_existing_table"); $error = mysqli_error($link); diff --git a/ext/mysqli/tests/functions/mysqli_field_count.phpt b/ext/mysqli/tests/functions/mysqli_field_count.phpt index 5702381605a8..46b20a416468 100644 --- a/ext/mysqli/tests/functions/mysqli_field_count.phpt +++ b/ext/mysqli/tests/functions/mysqli_field_count.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "CREATE TABLE test_mysqli_field_count (a int, b varchar(10)) ENGINE = " . get_default_db_engine()); mysqli_query($link, "INSERT INTO test_mysqli_field_count VALUES (1, 'foo')"); diff --git a/ext/mysqli/tests/functions/mysqli_info.phpt b/ext/mysqli/tests/functions/mysqli_info.phpt index f07624acc15e..eb59c670e04d 100644 --- a/ext/mysqli/tests/functions/mysqli_info.phpt +++ b/ext/mysqli/tests/functions/mysqli_info.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "CREATE TABLE test_mysqli_info (a INT)"); mysqli_query($link, "INSERT INTO test_mysqli_info VALUES (1),(2),(3)"); diff --git a/ext/mysqli/tests/functions/mysqli_num_fields.phpt b/ext/mysqli/tests/functions/mysqli_num_fields.phpt index c5887088f319..b548a2516da5 100644 --- a/ext/mysqli/tests/functions/mysqli_num_fields.phpt +++ b/ext/mysqli/tests/functions/mysqli_num_fields.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "CREATE TABLE test_mysqli_num_fields (a int, b varchar(10)) ENGINE = " . get_default_db_engine()); mysqli_query($link, "INSERT INTO test_mysqli_num_fields VALUES (1, 'foo')"); diff --git a/ext/mysqli/tests/functions/mysqli_num_rows.phpt b/ext/mysqli/tests/functions/mysqli_num_rows.phpt index 1e3c35146673..06ba5230094d 100644 --- a/ext/mysqli/tests/functions/mysqli_num_rows.phpt +++ b/ext/mysqli/tests/functions/mysqli_num_rows.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "CREATE TABLE test_mysqli_num_rows (a int, b varchar(10)) ENGINE=" . get_default_db_engine()); mysqli_query($link, "INSERT INTO test_mysqli_num_rows VALUES (1, 'foo')"); diff --git a/ext/mysqli/tests/functions/mysqli_warning_count.phpt b/ext/mysqli/tests/functions/mysqli_warning_count.phpt index 426eda48ba08..abfb5cd012bf 100644 --- a/ext/mysqli/tests/functions/mysqli_warning_count.phpt +++ b/ext/mysqli/tests/functions/mysqli_warning_count.phpt @@ -13,8 +13,6 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - mysqli_select_db($link, get_default_database()); - mysqli_query($link, "DROP TABLE IF EXISTS test_mysqli_warning_count"); mysqli_query($link, "DROP TABLE IF EXISTS test_mysqli_warning_count"); From 9d5f24143c372781b2a8f24492ef6be0da9f2c3a Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 31 Jul 2023 16:34:46 +0100 Subject: [PATCH 06/14] Remove outdated error checking Also reformat some querries and add comment for the SET sql_mode='' query --- ext/mysqli/tests/bind_fetch/bigint_types.phpt | 35 ++++++++-------- .../tests/bind_fetch/char_text_big_types.phpt | 3 +- .../tests/bind_fetch/char_text_types.phpt | 26 +++++------- .../tests/bind_fetch/datetime_types.phpt | 41 ++++++++++--------- ext/mysqli/tests/bind_fetch/float_types.phpt | 29 +++++++------ .../tests/bind_fetch/identical_fetch_row.phpt | 27 ++++++------ .../tests/bind_fetch/integer_types.phpt | 28 +++++++------ .../tests/bind_fetch/mysql_functions.phpt | 3 +- .../tests/bind_fetch/smallint_types.phpt | 28 +++++++------ .../tests/bind_fetch/system_variable.phpt | 6 +-- .../tests/bind_fetch/tinyint_types.phpt | 28 +++++++------ .../bind_fetch/unsigned_integer_types.phpt | 13 +++--- .../tests/bind_fetch/user_db_variable.phpt | 6 +-- .../tests/bind_fetch/varied_data_types.phpt | 26 ++++++------ .../tests/bind_fetch/varied_data_types2.phpt | 26 ++++++------ .../tests/bind_fetch/varied_data_types3.phpt | 23 ++++++----- .../tests/bind_insert/datetime_types.phpt | 41 +++++++++++-------- .../tests/bind_insert/integer_types.phpt | 1 + .../tests/bind_insert/send_long_data.phpt | 1 + .../tests/bind_insert/smallint_types.phpt | 20 +++++---- .../tests/bind_insert/tinyint_types.phpt | 19 +++++---- .../tests/bind_insert/varied_data_types.phpt | 24 ++++++----- ...mysqli_fetch_all_data_types_variation.phpt | 2 +- 23 files changed, 240 insertions(+), 216 deletions(-) diff --git a/ext/mysqli/tests/bind_fetch/bigint_types.phpt b/ext/mysqli/tests/bind_fetch/bigint_types.phpt index cd95d6c045ff..989b2634921e 100644 --- a/ext/mysqli/tests/bind_fetch/bigint_types.phpt +++ b/ext/mysqli/tests/bind_fetch/bigint_types.phpt @@ -17,29 +17,30 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch_integers_big(c1 bigint default 5, - c2 bigint, - c3 bigint not NULL, - c4 bigint unsigned, - c5 bigint unsigned, - c6 bigint unsigned, - c7 bigint unsigned, - c8 bigint unsigned) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_integers_big( + c1 bigint default 5, + c2 bigint, + c3 bigint not NULL, + c4 bigint unsigned, + c5 bigint unsigned, + c6 bigint unsigned, + c7 bigint unsigned, + c8 bigint unsigned + ) ENGINE=" . get_default_db_engine() + ); - $rc = mysqli_query($link, "INSERT INTO test_bind_fetch_integers_big (c2,c3,c4,c5,c6,c7,c8) ". - "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)"); - if (!$rc) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_integers_big (c2,c3,c4,c5,c6,c7,c8) + VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_integers_big"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); mysqli_stmt_execute($stmt); - $rc = mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); if (mysqli_get_server_version($link) < 50000) { // 4.1 is faulty and will return big number for $c6 diff --git a/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt b/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt index b055ba5a9f47..5c367764225b 100644 --- a/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt +++ b/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt @@ -13,8 +13,7 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "CREATE TABLE test_bind_fetch_char_long(c1 char(10), c2 text) ENGINE=" . get_default_db_engine())) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "CREATE TABLE test_bind_fetch_char_long(c1 char(10), c2 text) ENGINE=" . get_default_db_engine()); $a = str_repeat("A1", 32000); diff --git a/ext/mysqli/tests/bind_fetch/char_text_types.phpt b/ext/mysqli/tests/bind_fetch/char_text_types.phpt index dc42b2e46d56..047b4ca8c197 100644 --- a/ext/mysqli/tests/bind_fetch/char_text_types.phpt +++ b/ext/mysqli/tests/bind_fetch/char_text_types.phpt @@ -13,23 +13,19 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link,"CREATE TABLE test_bind_fetch_char(c1 char(10), c2 text) ENGINE=" . get_default_db_engine())) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link,"CREATE TABLE test_bind_fetch_char(c1 char(10), c2 text) ENGINE=" . get_default_db_engine()); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_char VALUES ('1234567890', 'this is a test0')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + /* Insert test data */ + mysqli_query( + $link, + "INSERT INTO test_bind_fetch_char VALUES + ('1234567890', 'this is a test0'), + ('1234567891', 'this is a test1'), + ('1234567892', 'this is a test2'), + ('1234567893', 'this is a test3')" + ); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_char VALUES ('1234567891', 'this is a test1')")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_char VALUES ('1234567892', 'this is a test2')")) - printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_char VALUES ('1234567893', 'this is a test3')")) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_char ORDER BY c1")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_char ORDER BY c1"); $c1 = $c2 = NULL; mysqli_stmt_bind_result($stmt, $c1, $c2); diff --git a/ext/mysqli/tests/bind_fetch/datetime_types.phpt b/ext/mysqli/tests/bind_fetch/datetime_types.phpt index 53ffe7618f4a..3ff4a0655136 100644 --- a/ext/mysqli/tests/bind_fetch/datetime_types.phpt +++ b/ext/mysqli/tests/bind_fetch/datetime_types.phpt @@ -13,18 +13,21 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); + // To get consistent result without depending on the DB version/setup mysqli_query($link, "SET sql_mode=''"); try { - $rc = mysqli_query($link, + mysqli_query( + $link, "CREATE TABLE test_bind_result_datetime( - c1 date, - c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6)) ENGINE=" . get_default_db_engine() + c1 date, + c2 time, + c3 timestamp(14), + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6) + ) ENGINE=" . get_default_db_engine() ); } catch (\mysqli_sql_exception) { /* 14 Too big precision for timestamp */ @@ -38,27 +41,27 @@ try { the display width is ignored. [...] */ - $rc = mysqli_query($link, + mysqli_query( + $link, "CREATE TABLE test_bind_result_datetime( - c1 date, - c2 time, - c3 timestamp, - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6)) ENGINE=" . get_default_db_engine() + c1 date, + c2 time, + c3 timestamp, + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6) + ) ENGINE=" . get_default_db_engine() ); } - $rc = mysqli_query($link, "INSERT INTO test_bind_result_datetime VALUES( + mysqli_query($link, "INSERT INTO test_bind_result_datetime VALUES( '2002-01-02', '12:49:00', '2002-01-02 17:46:59', 2010, '2010-07-10', '2020','1999-12-29')"); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result_datetime"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); diff --git a/ext/mysqli/tests/bind_fetch/float_types.phpt b/ext/mysqli/tests/bind_fetch/float_types.phpt index 07ba0efb8054..20d5bc700566 100644 --- a/ext/mysqli/tests/bind_fetch/float_types.phpt +++ b/ext/mysqli/tests/bind_fetch/float_types.phpt @@ -15,22 +15,25 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_float(c1 float(3), - c2 float, - c3 float unsigned, - c4 float, - c5 float, - c6 float, - c7 float(10) unsigned) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_float( + c1 float(3), + c2 float, + c3 float unsigned, + c4 float, + c5 float, + c6 float, + c7 float(10) unsigned + ) ENGINE=" . get_default_db_engine() + ); - mysqli_query($link, "INSERT INTO test_bind_fetch_float (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999, - sin(0.6), 1.00000000000001, 888888888888888)"); + mysqli_query($link, "INSERT INTO test_bind_fetch_float (c1,c2,c3,c4,c5,c6,c7) + VALUES (3.1415926535,-0.000001, -5, 999999999999, sin(0.6), 1.00000000000001, 888888888888888)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_float"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); diff --git a/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt index 1d88f597013a..bc4627f8f591 100644 --- a/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt +++ b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt @@ -13,23 +13,24 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_and_row_fetch(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 decimal(4,2), c6 double, - c7 varbinary(10), - c8 varchar(10)) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_and_row_fetch VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_and_row_fetch( + c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 decimal(4,2), c6 double, + c7 varbinary(10), + c8 varchar(10) + ) ENGINE=" . get_default_db_engine() + ); + + mysqli_query($link, "INSERT INTO test_bind_fetch_and_row_fetch + VALUES(120,2999,3999,54, 2.6,58.89, '206','6.7')"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_and_row_fetch"); $c = array(0,0,0,0,0,0,0,0); - $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); + mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); mysqli_stmt_execute($stmt); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); diff --git a/ext/mysqli/tests/bind_fetch/integer_types.phpt b/ext/mysqli/tests/bind_fetch/integer_types.phpt index 904095ba9f06..026a20af6fe7 100644 --- a/ext/mysqli/tests/bind_fetch/integer_types.phpt +++ b/ext/mysqli/tests/bind_fetch/integer_types.phpt @@ -13,21 +13,23 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch_integers(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_integers( + c1 int unsigned, + c2 int unsigned, + c3 int, + c4 int, + c5 int, + c6 int unsigned, + c7 int + ) ENGINE=" . get_default_db_engine() + ); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_integers VALUES (-23,35999,NULL,-500,-9999999,-0,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_integers VALUES (-23,35999,NULL,-500,-9999999,-0,0)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_integers"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); diff --git a/ext/mysqli/tests/bind_fetch/mysql_functions.phpt b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt index 9cebc6ce06c3..69b1c426c99b 100644 --- a/ext/mysqli/tests/bind_fetch/mysql_functions.phpt +++ b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt @@ -13,8 +13,7 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"); mysqli_stmt_bind_result($stmt, $c0, $c1, $c2); mysqli_stmt_execute($stmt); diff --git a/ext/mysqli/tests/bind_fetch/smallint_types.phpt b/ext/mysqli/tests/bind_fetch/smallint_types.phpt index 5a2aa65a1f1c..cf85c60eb6b3 100644 --- a/ext/mysqli/tests/bind_fetch/smallint_types.phpt +++ b/ext/mysqli/tests/bind_fetch/smallint_types.phpt @@ -13,21 +13,23 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_integers_small(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_integers_small( + c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint + ) ENGINE=" . get_default_db_engine() + ); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_integers_small VALUES (-23,35999,NULL,-500,-9999999,+30,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_integers_small VALUES (-23,35999,NULL,-500,-9999999,+30,0)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_integers_small"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); diff --git a/ext/mysqli/tests/bind_fetch/system_variable.phpt b/ext/mysqli/tests/bind_fetch/system_variable.phpt index 0304a3405c39..5fc5c42116af 100644 --- a/ext/mysqli/tests/bind_fetch/system_variable.phpt +++ b/ext/mysqli/tests/bind_fetch/system_variable.phpt @@ -13,11 +13,9 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET AUTOCOMMIT=0")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "SET AUTOCOMMIT=0"); - if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "SELECT @@autocommit"); mysqli_stmt_bind_result($stmt, $c0); mysqli_stmt_execute($stmt); diff --git a/ext/mysqli/tests/bind_fetch/tinyint_types.phpt b/ext/mysqli/tests/bind_fetch/tinyint_types.phpt index 637e836cc298..cf95f5ebcf27 100644 --- a/ext/mysqli/tests/bind_fetch/tinyint_types.phpt +++ b/ext/mysqli/tests/bind_fetch/tinyint_types.phpt @@ -13,21 +13,23 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_integers_tiny(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_integers_tiny( + c1 tinyint, + c2 tinyint unsigned, + c3 tinyint not NULL, + c4 tinyint, + c5 tinyint, + c6 tinyint unsigned, + c7 tinyint + ) ENGINE=" . get_default_db_engine() + ); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_integers_tiny VALUES (-23,300,0,-100,-127,+30,0)")) - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_integers_tiny VALUES (-23,300,0,-100,-127,+30,0)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_integers_tiny"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); diff --git a/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt index 97866fb05776..f0ffc92724a6 100644 --- a/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt +++ b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt @@ -13,20 +13,17 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET sql_mode=''")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + // To get consistent result without depending on the DB version/setup + mysqli_query($link, "SET sql_mode=''"); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . get_default_db_engine()); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)")) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint"); mysqli_stmt_bind_result($stmt, $c1, $c2); mysqli_stmt_execute($stmt); - $rc = mysqli_stmt_fetch($stmt); + mysqli_stmt_fetch($stmt); echo $c1, "\n", $c2, "\n"; diff --git a/ext/mysqli/tests/bind_fetch/user_db_variable.phpt b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt index 01c53b616f2c..e370b8c8d90b 100644 --- a/ext/mysqli/tests/bind_fetch/user_db_variable.phpt +++ b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt @@ -13,11 +13,9 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - if (!mysqli_query($link, "SET @dummy='foobar'")) - printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "SET @dummy='foobar'"); - if (!$stmt = mysqli_prepare($link, "SELECT @dummy")) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "SELECT @dummy"); mysqli_stmt_bind_result($stmt, $dummy); mysqli_stmt_execute($stmt); diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt index 9847c6108f03..b08ef98232bd 100644 --- a/ext/mysqli/tests/bind_fetch/varied_data_types.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt @@ -13,23 +13,21 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - $rc = mysqli_query( + mysqli_query( $link, - "CREATE TABLE test_bind_fetch_varied(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20)) ENGINE=" . get_default_db_engine() + "CREATE TABLE test_bind_fetch_varied( + col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20) + ) ENGINE=" . get_default_db_engine() ); - if (!$rc) - printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - $rc = mysqli_query($link, "INSERT INTO test_bind_fetch_varied(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); - if (!$rc) - printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_varied(col1,col10, col11) + VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_bind_fetch_varied ORDER BY col1"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt index 93d46ec4562a..0ff5caab3660 100644 --- a/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types2.phpt @@ -15,19 +15,19 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_varied2(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(50)) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_varied2( + c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(50) + ) ENGINE=" . get_default_db_engine() + ); - $rc = mysqli_query($link,"INSERT INTO test_bind_fetch_varied2 VALUES(19,2999,3999,4999999, - 2345.6,5678.89563, - 'foobar','mysql rulez')"); - if (!$rc) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link,"INSERT INTO test_bind_fetch_varied2 + VALUES(19,2999,3999,4999999,2345.6,5678.89563,'foobar','mysql rules')"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_varied2"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); @@ -64,6 +64,6 @@ array(8) { [6]=> string(6) "foobar" [7]=> - string(11) "mysql rulez" + string(11) "mysql rules" } done! diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt index e5527dde92fc..2e886a1f8ef7 100644 --- a/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt @@ -15,18 +15,19 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_varied3(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(10)) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE test_bind_fetch_varied3( + c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(10) + ) ENGINE=" . get_default_db_engine() + ); - if (!mysqli_query($link, "INSERT INTO test_bind_fetch_varied3 VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query($link, "INSERT INTO test_bind_fetch_varied3 + VALUES(120,2999,3999,54,2.6,58.89,'206','6.7')"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_varied3"); mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); diff --git a/ext/mysqli/tests/bind_insert/datetime_types.phpt b/ext/mysqli/tests/bind_insert/datetime_types.phpt index 59bfd78fb0dd..a4a1e68d28a4 100644 --- a/ext/mysqli/tests/bind_insert/datetime_types.phpt +++ b/ext/mysqli/tests/bind_insert/datetime_types.phpt @@ -13,27 +13,36 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); + // To get consistent result without depending on the DB version/setup mysqli_query($link, "SET sql_mode=''"); try { - $rc = mysqli_query($link,"CREATE TABLE insert_bind_datetime( - c1 date, - c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6))"); + mysqli_query( + $link, + "CREATE TABLE insert_bind_datetime( + c1 date, + c2 time, + c3 timestamp(14), + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6) + )" + ); } catch (\mysqli_sql_exception) { /* 14 Too big precision for timestamp */ - $rc = mysqli_query($link,"CREATE TABLE insert_bind_datetime( - c1 date, - c2 time, - c3 timestamp, - c4 year, - c5 datetime, - c6 timestamp, - c7 timestamp)"); + mysqli_query( + $link, + "CREATE TABLE insert_bind_datetime( + c1 date, + c2 time, + c3 timestamp, + c4 year, + c5 datetime, + c6 timestamp, + c7 timestamp + )" + ); } $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_datetime VALUES (?,?,?,?,?,?,?)"); diff --git a/ext/mysqli/tests/bind_insert/integer_types.phpt b/ext/mysqli/tests/bind_insert/integer_types.phpt index eb3873b5bd2e..3c4849fec1fb 100644 --- a/ext/mysqli/tests/bind_insert/integer_types.phpt +++ b/ext/mysqli/tests/bind_insert/integer_types.phpt @@ -13,6 +13,7 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); + // To get consistent result without depending on the DB version/setup mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_integers(c1 int unsigned, diff --git a/ext/mysqli/tests/bind_insert/send_long_data.phpt b/ext/mysqli/tests/bind_insert/send_long_data.phpt index d09b66f5a790..e5a6cc9e219b 100644 --- a/ext/mysqli/tests/bind_insert/send_long_data.phpt +++ b/ext/mysqli/tests/bind_insert/send_long_data.phpt @@ -13,6 +13,7 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); + // To get consistent result without depending on the DB version/setup mysqli_query($link, "SET sql_mode=''"); mysqli_query($link,"CREATE TABLE insert_bind_send_long_data(c1 varchar(10), c2 text)"); diff --git a/ext/mysqli/tests/bind_insert/smallint_types.phpt b/ext/mysqli/tests/bind_insert/smallint_types.phpt index 8319f59fba11..34c2d365fa61 100644 --- a/ext/mysqli/tests/bind_insert/smallint_types.phpt +++ b/ext/mysqli/tests/bind_insert/smallint_types.phpt @@ -13,15 +13,21 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); + // To get consistent result without depending on the DB version/setup mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"CREATE TABLE insert_bind_smallint(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); + mysqli_query( + $link, + "CREATE TABLE insert_bind_smallint( + c1 smallint unsigned, + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint + )" + ); $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_smallint VALUES (?,?,?,?,?,?,?)"); mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); diff --git a/ext/mysqli/tests/bind_insert/tinyint_types.phpt b/ext/mysqli/tests/bind_insert/tinyint_types.phpt index 083e0dcce5df..6fe1fb41993a 100644 --- a/ext/mysqli/tests/bind_insert/tinyint_types.phpt +++ b/ext/mysqli/tests/bind_insert/tinyint_types.phpt @@ -15,13 +15,18 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; mysqli_query($link, "SET sql_mode=''"); - mysqli_query($link,"CREATE TABLE insert_bind_tinyint(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint)"); + mysqli_query( + $link, + "CREATE TABLE insert_bind_tinyint( + c1 tinyint, + c2 tinyint unsigned, + c3 tinyint not NULL, + c4 tinyint, + c5 tinyint, + c6 tinyint unsigned, + c7 tinyint + )" + ); $stmt = mysqli_prepare ($link, "INSERT INTO insert_bind_tinyint VALUES(?,?,?,?,?,?,?)"); mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); diff --git a/ext/mysqli/tests/bind_insert/varied_data_types.phpt b/ext/mysqli/tests/bind_insert/varied_data_types.phpt index 761d3b311da8..8374b922b800 100644 --- a/ext/mysqli/tests/bind_insert/varied_data_types.phpt +++ b/ext/mysqli/tests/bind_insert/varied_data_types.phpt @@ -13,18 +13,20 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $link = default_mysqli_connect(); - $rc = mysqli_query($link,"CREATE TABLE insert_bind_varied1(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20)) ENGINE=" . get_default_db_engine()); - if (!$rc) - printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_query( + $link, + "CREATE TABLE insert_bind_varied1( + col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20) + ) ENGINE=" . get_default_db_engine() + ); - if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_bind_varied1(col1,col10, col11, col6) VALUES (?,?,?,?)")) - printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_varied1(col1,col10, col11, col6) VALUES (?,?,?,?)"); mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4); diff --git a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt index 1df8ec59d1d5..04bc6226dd9e 100644 --- a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt @@ -205,7 +205,7 @@ func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950); mysqli_close($link); -// Split below into new test? +// TODO Split below into new test? $link = default_mysqli_connect(); mysqli_real_query($link, "SELECT 1 AS _one"); $result = mysqli_use_result($link); From 80091f446b5281d5b83f587bad7e4d5a0353c624 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 31 Jul 2023 16:37:27 +0100 Subject: [PATCH 07/14] Fix mysqli_get_server_info() test with version suffixes Ubuntu does this but not Fedora --- ext/mysqli/tests/functions/mysqli_get_server_info.phpt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt b/ext/mysqli/tests/functions/mysqli_get_server_info.phpt index b8ff888cac0f..9b50b617230e 100644 --- a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt +++ b/ext/mysqli/tests/functions/mysqli_get_server_info.phpt @@ -15,8 +15,9 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; $sinfo = mysqli_get_server_info($link); - /* Version is in format: X.Y.Z */ - $status = preg_match("#^\d+\.\d+\.\d+$#", $sinfo) === 1; + /** Version is in format: X.Y.Z + * Some distrib will have a version suffix like "8.0.33-0ubuntu0.22.04.2" */ + $status = preg_match("#^\d+\.\d+\.\d+(\-.*)?$#", $sinfo) === 1; var_dump($status); if (!$status) { var_dump($sinfo); From d5c6a11435d6fe095c7e052cdc8657c6ced17745 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 18 Sep 2023 12:13:13 +0100 Subject: [PATCH 08/14] Unindent ext/mysqli/tests/bind_fetch/bigint_types.phpt Co-authored-by: Kamil Tekiela --- ext/mysqli/tests/bind_fetch/bigint_types.phpt | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/ext/mysqli/tests/bind_fetch/bigint_types.phpt b/ext/mysqli/tests/bind_fetch/bigint_types.phpt index 989b2634921e..4efe91b87fcb 100644 --- a/ext/mysqli/tests/bind_fetch/bigint_types.phpt +++ b/ext/mysqli/tests/bind_fetch/bigint_types.phpt @@ -15,47 +15,47 @@ mysqli_check_skip_test(); --CLEAN-- Date: Mon, 18 Sep 2023 12:16:50 +0100 Subject: [PATCH 09/14] Update ext/mysqli/tests/bind_fetch/varied_data_types.phpt Co-authored-by: Kamil Tekiela --- .../tests/bind_fetch/varied_data_types.phpt | 69 ++++++++++--------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt index b08ef98232bd..ce1f0c8417d2 100644 --- a/ext/mysqli/tests/bind_fetch/varied_data_types.phpt +++ b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt @@ -11,37 +11,38 @@ mysqli_check_skip_test(); --CLEAN-- --EXPECT-- -array(11) { +array(12) { [0]=> int(1) [1]=> - NULL + int(2) [2]=> - NULL + int(3) [3]=> - NULL + int(4) [4]=> - NULL + float(5.1) [5]=> - NULL + float(6.2) [6]=> - NULL + string(10) "2020-02-21" [7]=> - NULL + string(8) "11:04:00" [8]=> - NULL + string(3) "111" [9]=> string(4) "foo1" [10]=> string(4) "1000" + [11]=> + NULL } done! From bd26bef4204900d6fb74876820d513be5c496e94 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 18 Sep 2023 12:24:33 +0100 Subject: [PATCH 10/14] Address some review comments --- .../tests/bind_fetch/datetime_types.phpt | 88 +++++++------------ .../tests/bind_fetch/varied_data_types2.phpt | 69 --------------- .../tests/bind_fetch/varied_data_types3.phpt | 69 --------------- .../tests/bind_insert/datetime_types.phpt | 87 ++++++++---------- .../tests/bind_insert/integer_types.phpt | 19 ++-- 5 files changed, 79 insertions(+), 253 deletions(-) delete mode 100644 ext/mysqli/tests/bind_fetch/varied_data_types2.phpt delete mode 100644 ext/mysqli/tests/bind_fetch/varied_data_types3.phpt diff --git a/ext/mysqli/tests/bind_fetch/datetime_types.phpt b/ext/mysqli/tests/bind_fetch/datetime_types.phpt index 3ff4a0655136..16d8e3ae2ceb 100644 --- a/ext/mysqli/tests/bind_fetch/datetime_types.phpt +++ b/ext/mysqli/tests/bind_fetch/datetime_types.phpt @@ -11,70 +11,44 @@ mysqli_check_skip_test(); --CLEAN-- ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(8) { - [0]=> - int(19) - [1]=> - int(2999) - [2]=> - int(3999) - [3]=> - int(4999999) - [4]=> - float(2345.6) - [5]=> - float(5678.89563) - [6]=> - string(6) "foobar" - [7]=> - string(11) "mysql rules" -} -done! diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt deleted file mode 100644 index 2e886a1f8ef7..000000000000 --- a/ext/mysqli/tests/bind_fetch/varied_data_types3.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -mysqli fetch mixed values 2 ---INI-- -precision=12 ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(8) { - [0]=> - int(120) - [1]=> - int(2999) - [2]=> - int(3999) - [3]=> - int(54) - [4]=> - float(2.6) - [5]=> - float(58.89) - [6]=> - string(3) "206" - [7]=> - string(3) "6.7" -} -done! diff --git a/ext/mysqli/tests/bind_insert/datetime_types.phpt b/ext/mysqli/tests/bind_insert/datetime_types.phpt index a4a1e68d28a4..d7a12e515335 100644 --- a/ext/mysqli/tests/bind_insert/datetime_types.phpt +++ b/ext/mysqli/tests/bind_insert/datetime_types.phpt @@ -11,69 +11,54 @@ mysqli_check_skip_test(); --CLEAN-- Date: Wed, 20 Sep 2023 12:58:20 +0100 Subject: [PATCH 11/14] More review comments and move from updated tests --- ext/mysqli/tests/bind_fetch/bigint_types.phpt | 6 --- .../functions/mysqli_character_set_name.phpt | 28 +++++++++--- .../mysqli_character_set_name_oo.phpt | 41 +++++++++++++++++ ext/mysqli/tests/functions/mysqli_errno.phpt | 5 --- ext/mysqli/tests/functions/mysqli_error.phpt | 5 --- .../functions/mysqli_get_server_info.phpt | 31 ------------- .../tests/mysqli_character_set_name.phpt | 45 ------------------- .../tests/mysqli_character_set_name_oo.phpt | 45 ------------------- 8 files changed, 63 insertions(+), 143 deletions(-) create mode 100644 ext/mysqli/tests/functions/mysqli_character_set_name_oo.phpt delete mode 100644 ext/mysqli/tests/functions/mysqli_get_server_info.phpt delete mode 100644 ext/mysqli/tests/mysqli_character_set_name.phpt delete mode 100644 ext/mysqli/tests/mysqli_character_set_name_oo.phpt diff --git a/ext/mysqli/tests/bind_fetch/bigint_types.phpt b/ext/mysqli/tests/bind_fetch/bigint_types.phpt index 4efe91b87fcb..a7a6551c6780 100644 --- a/ext/mysqli/tests/bind_fetch/bigint_types.phpt +++ b/ext/mysqli/tests/bind_fetch/bigint_types.phpt @@ -42,12 +42,6 @@ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); mysqli_stmt_execute($stmt); mysqli_stmt_fetch($stmt); -if (mysqli_get_server_version($link) < 50000) { - // 4.1 is faulty and will return big number for $c6 - if ($c6 == "18446743740376218283") { - $c6 = 0; - } -} $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8); diff --git a/ext/mysqli/tests/functions/mysqli_character_set_name.phpt b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt index ce135be2f2ec..5fec6ea5cdba 100644 --- a/ext/mysqli/tests/functions/mysqli_character_set_name.phpt +++ b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt @@ -11,15 +11,31 @@ mysqli_check_skip_test(); getMessage() . "\n"; +} + +print "done!"; ?> --EXPECT-- -string(6) "utf8mb" +mysqli object is already closed done! diff --git a/ext/mysqli/tests/functions/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/functions/mysqli_character_set_name_oo.phpt new file mode 100644 index 000000000000..38d23fb4743b --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_character_set_name_oo.phpt @@ -0,0 +1,41 @@ +--TEST-- +function test: mysqli_character_set_name +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- +query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation'); +$tmp = $result->fetch_assoc(); +$result->free_result(); + +if (!$tmp['charset']) { + throw new Exception("Cannot determine current character set and collation"); +} + +$charset = $link->character_set_name(); +if ($tmp['charset'] !== $charset) { + printf("[001] Expecting character set %s/%s, got %s/%s\n", get_debug_type($tmp['charset']), $tmp['charset'], get_debug_type($charset), $charset); +} + +$link->close(); + +try { + $link->character_set_name(); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} + +print "done!"; +?> +--EXPECT-- +mysqli object is already closed +done! diff --git a/ext/mysqli/tests/functions/mysqli_errno.phpt b/ext/mysqli/tests/functions/mysqli_errno.phpt index 3470c3e30df8..3b42328fae00 100644 --- a/ext/mysqli/tests/functions/mysqli_errno.phpt +++ b/ext/mysqli/tests/functions/mysqli_errno.phpt @@ -26,11 +26,6 @@ mysqli_report(MYSQLI_REPORT_OFF); mysqli_close($link); print "done!"; ?> ---CLEAN-- - --EXPECT-- int(0) int(1146) diff --git a/ext/mysqli/tests/functions/mysqli_error.phpt b/ext/mysqli/tests/functions/mysqli_error.phpt index 8f4fba64d9ec..50c39ff79fed 100644 --- a/ext/mysqli/tests/functions/mysqli_error.phpt +++ b/ext/mysqli/tests/functions/mysqli_error.phpt @@ -26,11 +26,6 @@ mysqli_report(MYSQLI_REPORT_OFF); mysqli_close($link); print "done!"; ?> ---CLEAN-- - --EXPECTF-- string(0) "" string(%d) "%s" diff --git a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt b/ext/mysqli/tests/functions/mysqli_get_server_info.phpt deleted file mode 100644 index 9b50b617230e..000000000000 --- a/ext/mysqli/tests/functions/mysqli_get_server_info.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -function test: mysqli_get_server_info ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -bool(true) -done! diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt deleted file mode 100644 index 9efc0ebccfd7..000000000000 --- a/ext/mysqli/tests/mysqli_character_set_name.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -mysqli_character_set_name() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- -getMessage() . "\n"; -} - -print "done!"; -?> ---EXPECT-- -mysqli object is already closed -done! diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt deleted file mode 100644 index 4cc1e2d111f7..000000000000 --- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -mysqli_character_set_name() ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- -query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) - printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error); -$tmp = $res->fetch_assoc(); -$res->free_result(); -if (!$tmp['charset']) - printf("[002] Cannot determine current character set and collation\n"); - -$charset = $mysqli->character_set_name(); -if ($tmp['charset'] !== $charset) { - if ($tmp['collation'] === $charset) { - printf("[003] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n", - $tmp['collation'], $tmp['charset'], gettype($charset), $charset); - } else { - printf("[004] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset); - } -} - -$mysqli->close(); - -try { - $mysqli->character_set_name(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; -} - -print "done!"; -?> ---EXPECT-- -my_mysqli object is already closed -done! From 225a2f753a2f136369e1b29291a940c1210f30a7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Sep 2023 13:04:36 +0100 Subject: [PATCH 12/14] Update test helpers --- ext/mysqli/tests/test_setup/test_helpers.inc | 121 ++++--------------- 1 file changed, 24 insertions(+), 97 deletions(-) diff --git a/ext/mysqli/tests/test_setup/test_helpers.inc b/ext/mysqli/tests/test_setup/test_helpers.inc index 2c3f0e0e300b..73d782ef8df6 100644 --- a/ext/mysqli/tests/test_setup/test_helpers.inc +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -76,132 +76,59 @@ function my_mysqli_connect( int $port, ?string $socket = null, bool $enable_env_flags = true -): \mysqli|false { - - $flags = $enable_env_flags? get_environment_connection_flags():0; +): \mysqli { + // Because the tests are meant to test both error modes, they can set the report_mode to a different value, + // which we do not want to override. However, we want to make sure that if a connection cannot be made, + // the constuctor will throw an exception. We store current report_mode in variable and restore it later. + $driver = new mysqli_driver; + $report_mode = $driver->report_mode; + $driver->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT; + $flags = $enable_env_flags ? get_environment_connection_flags() : 0; if ($flags !== 0) { $link = mysqli_init(); - if (!mysqli_real_connect($link, $host, $user, $password, $db, $port, $socket, $flags)) { - $link = false; - } + mysqli_real_connect($link, $host, $user, $password, $db, $port, $socket, $flags); } else { $link = mysqli_connect($host, $user, $password, $db, $port, $socket); } - + // Restore error mode + $driver->report_mode = $report_mode; return $link; } - -/** - * Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible - * - * @param bool $enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS) - */ -function my_mysqli_real_connect( - mysqli $link, - string $host, - string $user, - string $password, - string $db, - int $port, - ?string $socket = null, - int $flags = 0, - bool $enable_env_flags = true -): \mysqli|false { - if ($enable_env_flags) { - $flags = $flags | get_environment_connection_flags(); - } - - return mysqli_real_connect($link, $host, $user, $password, $db, $port, $socket, $flags); -} - -function default_mysqli_connect_ex(): \mysqli|false { - return my_mysqli_connect( - get_default_host(), - get_default_user(), - get_default_password(), - get_default_database(), - get_default_port(), - null, - ); -} function default_mysqli_connect(): \mysqli{ - $link = default_mysqli_connect_ex(); - if (!$link) { - throw new Error("Cannot connect to default connection"); - } - return $link; -} -function default_mysqli_real_connect(mysqli $link, int $flags = 0): bool { - return my_mysqli_real_connect( - $link, + return my_mysqli_connect( get_default_host(), get_default_user(), get_default_password(), get_default_database(), get_default_port(), null, - $flags, ); } - function mysqli_check_skip_test(): void { - /* Disable exceptions */ - mysqli_report(MYSQLI_REPORT_OFF); - $link = default_mysqli_connect_ex(); - // Re-enable exceptions - mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); - if (!is_object($link)) { + try { + $link = default_mysqli_connect(); + } catch (\mysqli_sql_exception) { die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); } - mysqli_close($link); } - function have_innodb(mysqli $link): bool { - if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) - && ($row = $res->fetch_row()) - && !empty($row) - ) { - return !($row[1] == 'DISABLED' || $row[1] == 'NO'); - } - // MySQL 5.6.1+ - if ($res = $link->query('SHOW ENGINES')) { - while ($row = $res->fetch_assoc()) { - if (!isset($row['Engine']) || !isset($row['Support'])) { - return false; - } - - if (($row['Engine'] == 'InnoDB') - && (($row['Support'] == 'YES') || ($row['Support'] == 'DEFAULT')) - ) { - return true; - } - } - } - return false; + $res = $link->query("SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB'"); + $supported = $res->fetch_column(); + return $supported === 'YES' || $supported === 'DEFAULT'; } function mysqli_check_innodb_support_skip_test(): void { - /* Disable exceptions */ - mysqli_report(MYSQLI_REPORT_OFF); - $link = default_mysqli_connect_ex(); - if (!is_object($link)) { - // Re-enable exceptions - mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); + try { + $link = default_mysqli_connect(); + } catch (\mysqli_sql_exception) { die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); } - $status = have_innodb($link); - // Re-enable exceptions - mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); - mysqli_close($link); - if (!$status) { - die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error)); + if (! have_innodb($link)) { + die(sprintf("skip Needs InnoDB support")); } } - function tear_down_table_on_default_connection(string $table) { $link = default_mysqli_connect(); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS ' . $table)) { - printf("[clean] Failed to drop \"$table\" table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } + mysqli_query($link, 'DROP TABLE IF EXISTS ' . $table); } function setup_table_with_data_on_default_connection(string $table): mysqli { From cbdbab5dc8ff506df901ef931aaed3e1a8240a9e Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Sep 2023 22:01:48 +0100 Subject: [PATCH 13/14] Fix test with more recent version? --- .../tests/fetch/mysqli_fetch_all_data_types_variation.phpt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt index 04bc6226dd9e..a7383ec48dc1 100644 --- a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt @@ -46,9 +46,6 @@ function func_mysqli_fetch_all( $fields = mysqli_fetch_fields($result); - // I have no idea what this condition does as this seem to be some PHP 6 stuff??? - // if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - if ($regexp_comparison) { if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, @@ -151,10 +148,10 @@ func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550) func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560); func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570); -$string65k = func_mysqli_fetch_array_make_string(65400); +$string16k = func_mysqli_fetch_array_make_string(16000); func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580); func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590); -func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600); +func_mysqli_fetch_all($link, $engine, "VARCHAR(16000)", $string16k, $string16k, 600); func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610); func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620); From 514d8017869eb2344dfc55ceb005512b576345c9 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Sep 2023 23:18:46 +0100 Subject: [PATCH 14/14] Suppress warning --- ext/mysqli/tests/test_setup/test_helpers.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/mysqli/tests/test_setup/test_helpers.inc b/ext/mysqli/tests/test_setup/test_helpers.inc index 73d782ef8df6..42d3e7ad515b 100644 --- a/ext/mysqli/tests/test_setup/test_helpers.inc +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -88,7 +88,10 @@ function my_mysqli_connect( $link = mysqli_init(); mysqli_real_connect($link, $host, $user, $password, $db, $port, $socket, $flags); } else { - $link = mysqli_connect($host, $user, $password, $db, $port, $socket); + /* TODO Investigate why on LINUX_X64_RELEASE_NTS CI pipeline + * Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo for mysql failed: + * Temporary failure in name resolution in test_helpers.inc on line 91 */ + $link = @mysqli_connect($host, $user, $password, $db, $port, $socket); } // Restore error mode $driver->report_mode = $report_mode;