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/003.phpt b/ext/mysqli/tests/003.phpt deleted file mode 100644 index 6ec2632a074b..000000000000 --- a/ext/mysqli/tests/003.phpt +++ /dev/null @@ -1,104 +0,0 @@ ---TEST-- -mysqli connect ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(7) { - [0]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - [2]=> - string(19) "2002-01-02 17:46:59" - [3]=> - string(4) "2010" - [4]=> - string(19) "2010-07-10 00:00:00" - [5]=> - string(19) "0000-00-00 00:00:00" - [6]=> - string(19) "1999-12-29 00:00:00" -} -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/006.phpt b/ext/mysqli/tests/006.phpt deleted file mode 100644 index 42a3467ad492..000000000000 --- a/ext/mysqli/tests/006.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -mysqli 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/007.phpt b/ext/mysqli/tests/007.phpt deleted file mode 100644 index f057acadde21..000000000000 --- a/ext/mysqli/tests/007.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -mysqli fetch 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(30) - [6]=> - int(0) -} -done! diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt deleted file mode 100644 index 2563b0376e7c..000000000000 --- a/ext/mysqli/tests/008.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -mysqli fetch 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/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/010.phpt b/ext/mysqli/tests/010.phpt deleted file mode 100644 index 1a287360d8f8..000000000000 --- a/ext/mysqli/tests/010.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -mysqli fetch float values ---INI-- -precision=12 ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(7) { - [0]=> - float(3.14159) - [1]=> - float(-1.0E-6) - [2]=> - float(0) - [3]=> - float(1000000000000) - [4]=> - float(0.564642) - [5]=> - float(1) - [6]=> - float(888889000000000) -} -done! diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt deleted file mode 100644 index d962c8c473de..000000000000 --- a/ext/mysqli/tests/011.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -mysqli fetch mixed values ---INI-- -precision=12 ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---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 rulez" -} -done! diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt deleted file mode 100644 index cdb9446ba1d0..000000000000 --- a/ext/mysqli/tests/012.phpt +++ /dev/null @@ -1,78 +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/013.phpt b/ext/mysqli/tests/013.phpt deleted file mode 100644 index ff0ea29644b1..000000000000 --- a/ext/mysqli/tests/013.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x server) ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -ok -done! diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt deleted file mode 100644 index 2d1a07d2e7c5..000000000000 --- a/ext/mysqli/tests/014.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -mysqli autocommit/commit/rollback ---EXTENSIONS-- -mysqli ---SKIPIF-- -errno, $link->error)); -} -?> ---FILE-- - ---CLEAN-- - ---EXPECT-- -Num_of_rows=1 -array(2) { - [0]=> - string(1) "1" - [1]=> - string(6) "foobar" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(4) "egon" -} -done! diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt deleted file mode 100644 index 5fef3f9250b9..000000000000 --- a/ext/mysqli/tests/015.phpt +++ /dev/null @@ -1,95 +0,0 @@ ---TEST-- -mysqli autocommit/commit/rollback with innodb ---EXTENSIONS-- -mysqli ---SKIPIF-- -errno, $link->error)); -} -?> ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(2) { - [0]=> - string(1) "1" - [1]=> - string(6) "foobar" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(4) "egon" -} -done! diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt deleted file mode 100644 index 65414c34781e..000000000000 --- a/ext/mysqli/tests/016.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -mysqli fetch user variable ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -string(6) "foobar" -done! diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt deleted file mode 100644 index e452af7060c4..000000000000 --- a/ext/mysqli/tests/018.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -mysqli fetch system variables ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(0) -done! diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt deleted file mode 100644 index 03d18d4a0350..000000000000 --- a/ext/mysqli/tests/019.phpt +++ /dev/null @@ -1,95 +0,0 @@ ---TEST-- -mysqli fetch (bind_param + bind_result) ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -array(11) { - [0]=> - int(1) - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL - [5]=> - float(3.14) - [6]=> - NULL - [7]=> - NULL - [8]=> - NULL - [9]=> - string(3) "foo" - [10]=> - string(6) "foobar" -} -done! diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt deleted file mode 100644 index c009cab47975..000000000000 --- a/ext/mysqli/tests/020.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -mysqli bind_param/bind_result date ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -array(7) { - [0]=> - %s(10) "2002-01-02" - [1]=> - %s(8) "12:49:00" - [2]=> - %s(19) "2002-01-02 17:46:59" - [3]=> - string(4) "2010" - [4]=> - %s(19) "2010-07-10 00:00:00" - [5]=> - %s(19) "0000-00-00 00:00:00" - [6]=> - %s(19) "1999-12-29 00:00:00" -} -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/028.phpt b/ext/mysqli/tests/028.phpt deleted file mode 100644 index 19b03d07e8d3..000000000000 --- a/ext/mysqli/tests/028.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -function test: mysqli_character_set_name ---EXTENSIONS-- -mysqli ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(%d) "%s" -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..a7a6551c6780 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/bigint_types.phpt @@ -0,0 +1,78 @@ +--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..5c367764225b --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/char_text_big_types.phpt @@ -0,0 +1,50 @@ +--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..047b4ca8c197 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/char_text_types.phpt @@ -0,0 +1,74 @@ +--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/bind_fetch/datetime_types.phpt b/ext/mysqli/tests/bind_fetch/datetime_types.phpt new file mode 100644 index 000000000000..16d8e3ae2ceb --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/datetime_types.phpt @@ -0,0 +1,75 @@ +--TEST-- +mysqli bind_result datetimes +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + string(10) "2002-01-02" + [1]=> + string(8) "12:49:00" + [2]=> + string(19) "2002-01-02 17:46:59" + [3]=> + string(4) "2010" + [4]=> + string(19) "2010-07-10 00:00:00" + [5]=> + string(24) "0000-00-00 00:00:00.0000" + [6]=> + string(26) "1999-12-29 00:00:00.000000" +} +done! diff --git a/ext/mysqli/tests/bind_fetch/float_types.phpt b/ext/mysqli/tests/bind_fetch/float_types.phpt new file mode 100644 index 000000000000..20d5bc700566 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/float_types.phpt @@ -0,0 +1,73 @@ +--TEST-- +mysqli fetch float values +--INI-- +precision=12 +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + float(3.14159) + [1]=> + float(-1.0E-6) + [2]=> + float(0) + [3]=> + float(1000000000000) + [4]=> + float(0.564642) + [5]=> + float(1) + [6]=> + float(888889000000000) +} +done! diff --git a/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt new file mode 100644 index 000000000000..bc4627f8f591 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/identical_fetch_row.phpt @@ -0,0 +1,60 @@ +--TEST-- +mysqli binding resulting of a fetch and fetching a row directly produce same results +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +ok +done! diff --git a/ext/mysqli/tests/bind_fetch/integer_types.phpt b/ext/mysqli/tests/bind_fetch/integer_types.phpt new file mode 100644 index 000000000000..026a20af6fe7 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/integer_types.phpt @@ -0,0 +1,69 @@ +--TEST-- +mysqli fetch integer 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/017.phpt b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt similarity index 55% rename from ext/mysqli/tests/017.phpt rename to ext/mysqli/tests/bind_fetch/mysql_functions.phpt index f4520483574a..69b1c426c99b 100644 --- a/ext/mysqli/tests/017.phpt +++ b/ext/mysqli/tests/bind_fetch/mysql_functions.phpt @@ -1,20 +1,19 @@ --TEST-- -mysqli fetch functions +mysqli fetch MySQL functions --EXTENSIONS-- mysqli --SKIPIF-- --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(7) { + [0]=> + int(0) + [1]=> + int(35999) + [2]=> + NULL + [3]=> + int(-500) + [4]=> + int(-32768) + [5]=> + int(30) + [6]=> + int(0) +} +done! diff --git a/ext/mysqli/tests/bind_fetch/system_variable.phpt b/ext/mysqli/tests/bind_fetch/system_variable.phpt new file mode 100644 index 000000000000..5fc5c42116af --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/system_variable.phpt @@ -0,0 +1,32 @@ +--TEST-- +mysqli fetch system variables +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(0) +done! diff --git a/ext/mysqli/tests/bind_fetch/tinyint_types.phpt b/ext/mysqli/tests/bind_fetch/tinyint_types.phpt new file mode 100644 index 000000000000..cf95f5ebcf27 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/tinyint_types.phpt @@ -0,0 +1,69 @@ +--TEST-- +mysqli fetch 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/bind_fetch/unsigned_integer_types.phpt b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt new file mode 100644 index 000000000000..f0ffc92724a6 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/unsigned_integer_types.phpt @@ -0,0 +1,42 @@ +--TEST-- +mysqli fetch unsigned integer values +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +20123456 +3123456789 +done! diff --git a/ext/mysqli/tests/bind_fetch/user_db_variable.phpt b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt new file mode 100644 index 000000000000..e370b8c8d90b --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/user_db_variable.phpt @@ -0,0 +1,32 @@ +--TEST-- +mysqli fetch user variable +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(6) "foobar" +done! diff --git a/ext/mysqli/tests/bind_fetch/varied_data_types.phpt b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt new file mode 100644 index 000000000000..ce1f0c8417d2 --- /dev/null +++ b/ext/mysqli/tests/bind_fetch/varied_data_types.phpt @@ -0,0 +1,79 @@ +--TEST-- +mysqli bind_result 1 +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(12) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + float(5.1) + [5]=> + float(6.2) + [6]=> + string(10) "2020-02-21" + [7]=> + string(8) "11:04:00" + [8]=> + string(3) "111" + [9]=> + string(4) "foo1" + [10]=> + string(4) "1000" + [11]=> + NULL +} +done! 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..702ad1442aef --- /dev/null +++ b/ext/mysqli/tests/bind_insert/char_text_big_types.phpt @@ -0,0 +1,55 @@ +--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..4119eb8c0b9c --- /dev/null +++ b/ext/mysqli/tests/bind_insert/char_text_types.phpt @@ -0,0 +1,50 @@ +--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/bind_insert/datetime_types.phpt b/ext/mysqli/tests/bind_insert/datetime_types.phpt new file mode 100644 index 000000000000..d7a12e515335 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/datetime_types.phpt @@ -0,0 +1,85 @@ +--TEST-- +mysqli insert (bind_param + bind_result) datetime types +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +array(7) { + [0]=> + %s(10) "2002-01-02" + [1]=> + %s(8) "12:49:00" + [2]=> + %s(19) "2002-01-02 17:46:59" + [3]=> + string(4) "2010" + [4]=> + %s(19) "2010-07-10 00:00:00" + [5]=> + %s(19) "0000-00-00 00:00:00" + [6]=> + %s(19) "1999-12-29 00:00:00" +} +done! 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..36d1ec3d5f3f --- /dev/null +++ b/ext/mysqli/tests/bind_insert/integer_types.phpt @@ -0,0 +1,81 @@ +--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..e5a6cc9e219b --- /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..34c2d365fa61 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/smallint_types.phpt @@ -0,0 +1,81 @@ +--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..6fe1fb41993a --- /dev/null +++ b/ext/mysqli/tests/bind_insert/tinyint_types.phpt @@ -0,0 +1,83 @@ +--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/bind_insert/varied_data_types.phpt b/ext/mysqli/tests/bind_insert/varied_data_types.phpt new file mode 100644 index 000000000000..8374b922b800 --- /dev/null +++ b/ext/mysqli/tests/bind_insert/varied_data_types.phpt @@ -0,0 +1,86 @@ +--TEST-- +mysqli insert (bind_param + bind_result) +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(11) { + [0]=> + int(1) + [1]=> + NULL + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL + [5]=> + float(3.14) + [6]=> + NULL + [7]=> + NULL + [8]=> + NULL + [9]=> + string(3) "foo" + [10]=> + string(6) "foobar" +} +done! 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/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..a7383ec48dc1 --- /dev/null +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt @@ -0,0 +1,231 @@ +--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); + + 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); + +$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(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); + +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); + +// TODO 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_affected_rows.phpt b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt new file mode 100644 index 000000000000..71b82f8c0dea --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_affected_rows.phpt @@ -0,0 +1,33 @@ +--TEST-- +function test: mysqli_affected_rows +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +int(3) +done! diff --git a/ext/mysqli/tests/functions/mysqli_character_set_name.phpt b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt new file mode 100644 index 000000000000..5fec6ea5cdba --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_character_set_name.phpt @@ -0,0 +1,41 @@ +--TEST-- +function 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/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 new file mode 100644 index 000000000000..3b42328fae00 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_errno.phpt @@ -0,0 +1,32 @@ +--TEST-- +function test: mysqli_errno +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--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..50c39ff79fed --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_error.phpt @@ -0,0 +1,32 @@ +--TEST-- +function test: mysqli_error +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--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..46b20a416468 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_field_count.phpt @@ -0,0 +1,42 @@ +--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-- +--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..b548a2516da5 --- /dev/null +++ b/ext/mysqli/tests/functions/mysqli_num_fields.phpt @@ -0,0 +1,37 @@ +--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/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/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/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/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! 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 new file mode 100644 index 000000000000..42d3e7ad515b --- /dev/null +++ b/ext/mysqli/tests/test_setup/test_helpers.inc @@ -0,0 +1,147 @@ +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(); + mysqli_real_connect($link, $host, $user, $password, $db, $port, $socket, $flags); + } else { + /* 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; + return $link; +} +function default_mysqli_connect(): \mysqli{ + return my_mysqli_connect( + get_default_host(), + get_default_user(), + get_default_password(), + get_default_database(), + get_default_port(), + null, + ); +} +function mysqli_check_skip_test(): void { + 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())); + } +} +function have_innodb(mysqli $link): bool { + $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 { + 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())); + } + if (! have_innodb($link)) { + die(sprintf("skip Needs InnoDB support")); + } +} +function tear_down_table_on_default_connection(string $table) { + $link = default_mysqli_connect(); + mysqli_query($link, 'DROP TABLE IF EXISTS ' . $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"; diff --git a/ext/mysqli/tests/transactions/014.phpt b/ext/mysqli/tests/transactions/014.phpt new file mode 100644 index 000000000000..9cd593ab9fc3 --- /dev/null +++ b/ext/mysqli/tests/transactions/014.phpt @@ -0,0 +1,72 @@ +--TEST-- +mysqli autocommit/commit/rollback with innodb with CACHE +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +Num_of_rows=1 +array(2) { + [0]=> + string(1) "1" + [1]=> + string(6) "foobar" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(4) "egon" +} +done! diff --git a/ext/mysqli/tests/transactions/015.phpt b/ext/mysqli/tests/transactions/015.phpt new file mode 100644 index 000000000000..6fa26c0b715a --- /dev/null +++ b/ext/mysqli/tests/transactions/015.phpt @@ -0,0 +1,69 @@ +--TEST-- +mysqli autocommit/commit/rollback with innodb with SQL_NO_CACHE +--EXTENSIONS-- +mysqli +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [0]=> + string(1) "1" + [1]=> + string(6) "foobar" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(4) "egon" +} +done!