From 61b57050a40b03148a5891a3c317dcd426dc6d5c Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Mon, 22 Apr 2013 18:35:02 -0700 Subject: [PATCH] import zend mysql tests --- hphp/test/zend/bad/ext-mysql/001.php | 22 ++ hphp/test/zend/bad/ext-mysql/001.php.expectf | 2 + hphp/test/zend/bad/ext-mysql/002.php | 28 ++ hphp/test/zend/bad/ext-mysql/002.php.expectf | 22 ++ hphp/test/zend/bad/ext-mysql/003.php | 48 ++++ hphp/test/zend/bad/ext-mysql/003.php.expectf | 30 ++ hphp/test/zend/bad/ext-mysql/bug47438.php | 38 +++ .../zend/bad/ext-mysql/bug47438.php.expectf | 3 + hphp/test/zend/bad/ext-mysql/bug48754.php | 60 ++++ .../zend/bad/ext-mysql/bug48754.php.expectf | 21 ++ hphp/test/zend/bad/ext-mysql/bug53649.php | 44 +++ .../zend/bad/ext-mysql/bug53649.php.expectf | 1 + .../bad/ext-mysql/mysql_affected_rows.php | 113 ++++++++ .../ext-mysql/mysql_affected_rows.php.expectf | 1 + .../bad/ext-mysql/mysql_client_encoding.php | 60 ++++ .../mysql_client_encoding.php.expectf | 1 + hphp/test/zend/bad/ext-mysql/mysql_close.php | 29 ++ .../bad/ext-mysql/mysql_close.php.expectf | 1 + .../test/zend/bad/ext-mysql/mysql_connect.php | 97 +++++++ .../bad/ext-mysql/mysql_connect.php.expectf | 2 + .../zend/bad/ext-mysql/mysql_constants.php | 55 ++++ .../bad/ext-mysql/mysql_constants.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_create_db.php | 43 +++ .../bad/ext-mysql/mysql_create_db.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_data_seek.php | 58 ++++ .../bad/ext-mysql/mysql_data_seek.php.expectf | 5 + .../test/zend/bad/ext-mysql/mysql_db_name.php | 51 ++++ .../bad/ext-mysql/mysql_db_name.php.expectf | 4 + .../zend/bad/ext-mysql/mysql_db_query.php | 53 ++++ .../bad/ext-mysql/mysql_db_query.php.expectf | 1 + .../test/zend/bad/ext-mysql/mysql_drop_db.php | 42 +++ .../bad/ext-mysql/mysql_drop_db.php.expectf | 1 + hphp/test/zend/bad/ext-mysql/mysql_errno.php | 46 +++ .../bad/ext-mysql/mysql_errno.php.expectf | 5 + hphp/test/zend/bad/ext-mysql/mysql_error.php | 53 ++++ .../bad/ext-mysql/mysql_error.php.expectf | 3 + .../zend/bad/ext-mysql/mysql_fetch_array.php | 272 ++++++++++++++++++ .../ext-mysql/mysql_fetch_array.php.expectf | 75 +++++ .../zend/bad/ext-mysql/mysql_fetch_assoc.php | 54 ++++ .../ext-mysql/mysql_fetch_assoc.php.expectf | 37 +++ .../zend/bad/ext-mysql/mysql_fetch_field.php | 147 ++++++++++ .../ext-mysql/mysql_fetch_field.php.expectf | 117 ++++++++ .../bad/ext-mysql/mysql_fetch_lengths.php | 30 ++ .../ext-mysql/mysql_fetch_lengths.php.expectf | 10 + .../zend/bad/ext-mysql/mysql_fetch_object.php | 73 +++++ .../ext-mysql/mysql_fetch_object.php.expectf | 60 ++++ .../zend/bad/ext-mysql/mysql_fetch_row.php | 32 +++ .../bad/ext-mysql/mysql_fetch_row.php.expectf | 12 + .../zend/bad/ext-mysql/mysql_field_flags.php | 135 +++++++++ .../ext-mysql/mysql_field_flags.php.expectf | 6 + .../zend/bad/ext-mysql/mysql_field_len.php | 38 +++ .../bad/ext-mysql/mysql_field_len.php.expectf | 6 + .../zend/bad/ext-mysql/mysql_field_name.php | 37 +++ .../ext-mysql/mysql_field_name.php.expectf | 7 + .../zend/bad/ext-mysql/mysql_field_seek.php | 35 +++ .../ext-mysql/mysql_field_seek.php.expectf | 94 ++++++ .../zend/bad/ext-mysql/mysql_field_table.php | 37 +++ .../ext-mysql/mysql_field_table.php.expectf | 7 + .../zend/bad/ext-mysql/mysql_field_type.php | 37 +++ .../ext-mysql/mysql_field_type.php.expectf | 7 + .../zend/bad/ext-mysql/mysql_free_result.php | 35 +++ .../ext-mysql/mysql_free_result.php.expectf | 4 + .../bad/ext-mysql/mysql_get_host_info.php | 32 +++ .../ext-mysql/mysql_get_host_info.php.expectf | 1 + .../bad/ext-mysql/mysql_get_proto_info.php | 22 ++ .../mysql_get_proto_info.php.expectf | 1 + .../bad/ext-mysql/mysql_get_server_info.php | 29 ++ .../mysql_get_server_info.php.expectf | 1 + hphp/test/zend/bad/ext-mysql/mysql_info.php | 61 ++++ .../zend/bad/ext-mysql/mysql_info.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_insert_id.php | 57 ++++ .../bad/ext-mysql/mysql_insert_id.php.expectf | 3 + .../zend/bad/ext-mysql/mysql_list_dbs.php | 42 +++ .../bad/ext-mysql/mysql_list_dbs.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_list_fields.php | 55 ++++ .../ext-mysql/mysql_list_fields.php.expectf | 13 + .../bad/ext-mysql/mysql_list_processes.php | 42 +++ .../mysql_list_processes.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_list_tables.php | 73 +++++ .../ext-mysql/mysql_list_tables.php.expectf | 1 + .../zend/bad/ext-mysql/mysql_num_fields.php | 43 +++ .../ext-mysql/mysql_num_fields.php.expectf | 2 + .../zend/bad/ext-mysql/mysql_num_rows.php | 70 +++++ .../bad/ext-mysql/mysql_num_rows.php.expectf | 4 + .../test/zend/bad/ext-mysql/mysql_phpinfo.php | 65 +++++ .../bad/ext-mysql/mysql_phpinfo.php.expectf | 1 + hphp/test/zend/bad/ext-mysql/mysql_ping.php | 33 +++ .../zend/bad/ext-mysql/mysql_ping.php.expectf | 5 + hphp/test/zend/bad/ext-mysql/mysql_query.php | 104 +++++++ .../bad/ext-mysql/mysql_query.php.expectf | 11 + .../mysql_query_load_data_openbasedir.php | 84 ++++++ ...ql_query_load_data_openbasedir.php.expectf | 5 + .../ext-mysql/mysql_real_escape_string.php | 26 ++ .../mysql_real_escape_string.php.expectf | 8 + hphp/test/zend/bad/ext-mysql/mysql_result.php | 56 ++++ .../bad/ext-mysql/mysql_result.php.expectf | 37 +++ .../zend/bad/ext-mysql/mysql_select_db.php | 59 ++++ .../bad/ext-mysql/mysql_select_db.php.expectf | 4 + .../zend/bad/ext-mysql/mysql_set_charset.php | 44 +++ .../ext-mysql/mysql_set_charset.php.expectf | 1 + hphp/test/zend/bad/ext-mysql/mysql_stat.php | 37 +++ .../zend/bad/ext-mysql/mysql_stat.php.expectf | 2 + .../zend/bad/ext-mysql/mysql_tablename.php | 35 +++ .../bad/ext-mysql/mysql_tablename.php.expectf | 7 + .../zend/bad/ext-mysql/mysql_thread_id.php | 28 ++ .../bad/ext-mysql/mysql_thread_id.php.expectf | 2 + .../bad/ext-mysql/mysql_unbuffered_query.php | 98 +++++++ .../mysql_unbuffered_query.php.expectf | 10 + hphp/test/zend/good/ext-mysql/connect.inc | 82 ++++++ .../good/ext-mysql/mysql_escape_string.php | 19 ++ .../ext-mysql/mysql_escape_string.php.expectf | 8 + .../good/ext-mysql/mysql_get_client_info.php | 16 ++ .../mysql_get_client_info.php.expectf | 1 + hphp/tools/import_zend_test.py | 2 +- 114 files changed, 3893 insertions(+), 1 deletion(-) create mode 100644 hphp/test/zend/bad/ext-mysql/001.php create mode 100644 hphp/test/zend/bad/ext-mysql/001.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/002.php create mode 100644 hphp/test/zend/bad/ext-mysql/002.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/003.php create mode 100644 hphp/test/zend/bad/ext-mysql/003.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/bug47438.php create mode 100644 hphp/test/zend/bad/ext-mysql/bug47438.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/bug48754.php create mode 100644 hphp/test/zend/bad/ext-mysql/bug48754.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/bug53649.php create mode 100644 hphp/test/zend/bad/ext-mysql/bug53649.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_close.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_close.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_connect.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_connect.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_constants.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_constants.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_create_db.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_create_db.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_data_seek.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_data_seek.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_db_name.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_db_name.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_db_query.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_db_query.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_drop_db.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_drop_db.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_errno.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_errno.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_error.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_error.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_flags.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_flags.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_len.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_len.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_name.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_name.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_seek.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_seek.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_table.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_table.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_type.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_field_type.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_free_result.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_free_result.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_info.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_info.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_insert_id.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_insert_id.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_fields.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_fields.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_processes.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_processes.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_tables.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_list_tables.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_num_fields.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_num_fields.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_num_rows.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_num_rows.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_ping.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_ping.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_query.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_query.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_result.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_result.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_select_db.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_select_db.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_set_charset.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_set_charset.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_stat.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_stat.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_tablename.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_tablename.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_thread_id.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_thread_id.php.expectf create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php create mode 100644 hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php.expectf create mode 100644 hphp/test/zend/good/ext-mysql/connect.inc create mode 100644 hphp/test/zend/good/ext-mysql/mysql_escape_string.php create mode 100644 hphp/test/zend/good/ext-mysql/mysql_escape_string.php.expectf create mode 100644 hphp/test/zend/good/ext-mysql/mysql_get_client_info.php create mode 100644 hphp/test/zend/good/ext-mysql/mysql_get_client_info.php.expectf diff --git a/hphp/test/zend/bad/ext-mysql/001.php b/hphp/test/zend/bad/ext-mysql/001.php new file mode 100644 index 000000000..1dfad4ee5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/001.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/001.php.expectf b/hphp/test/zend/bad/ext-mysql/001.php.expectf new file mode 100644 index 000000000..fa11f7593 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/001.php.expectf @@ -0,0 +1,2 @@ +%unicode|string%(2) "11" +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/002.php b/hphp/test/zend/bad/ext-mysql/002.php new file mode 100644 index 000000000..e8f2a7c5a --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/002.php @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/002.php.expectf b/hphp/test/zend/bad/ext-mysql/002.php.expectf new file mode 100644 index 000000000..7e7e6fe04 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/002.php.expectf @@ -0,0 +1,22 @@ +resource(%d) of type (mysql link) +bool(true) +bool(true) +bool(true) +resource(%d) of type (mysql result) +array(3) { + [%u|b%"col1"]=> + %unicode|string%(1) "1" + [%u|b%"col2"]=> + %unicode|string%(3) "foo" + [%u|b%"col3"]=> + %unicode|string%(3) "bar" +} +array(3) { + [%u|b%"col1"]=> + %unicode|string%(1) "2" + [%u|b%"col2"]=> + %unicode|string%(3) "foo" + [%u|b%"col3"]=> + %unicode|string%(3) "bar" +} +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/003.php b/hphp/test/zend/bad/ext-mysql/003.php new file mode 100644 index 000000000..30948d07d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/003.php @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/003.php.expectf b/hphp/test/zend/bad/ext-mysql/003.php.expectf new file mode 100644 index 000000000..dcf82a7af --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/003.php.expectf @@ -0,0 +1,30 @@ +==stdClass== +object(stdClass)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(3) "one" +} +object(stdClass)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(3) "two" +} +object(stdClass)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(5) "three" +} +==class24== +class24::__construct +object(class24)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(3) "one" +} +class24::__construct +object(class24)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(3) "two" +} +class24::__construct +object(class24)#%d (1) { + [%u|b%"a"]=> + %unicode|string%(5) "three" +} +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug47438.php b/hphp/test/zend/bad/ext-mysql/bug47438.php new file mode 100644 index 000000000..90baa02ee --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug47438.php @@ -0,0 +1,38 @@ +name . "\n"; + $i++; +} + +mysql_query("DROP TABLE IF EXISTS test_47438", $link); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug47438.php.expectf b/hphp/test/zend/bad/ext-mysql/bug47438.php.expectf new file mode 100644 index 000000000..78cf68bc0 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug47438.php.expectf @@ -0,0 +1,3 @@ +0.a +1.b +2.c \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug48754.php b/hphp/test/zend/bad/ext-mysql/bug48754.php new file mode 100644 index 000000000..a6ec1ad8b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug48754.php @@ -0,0 +1,60 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug48754.php.expectf b/hphp/test/zend/bad/ext-mysql/bug48754.php.expectf new file mode 100644 index 000000000..76055c716 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug48754.php.expectf @@ -0,0 +1,21 @@ +Explicit connection on close +Expect same thread id for $link and default conn: bool(true) +resource(%d) of type (mysql link) +resource(%d) of type (Unknown) +HipHop Warning: %a + +Closing default link +Expect same thread id for $link and default conn but not the previous: bool(true) +resource(%d) of type (mysql link) +resource(%d) of type (mysql link) +resource(%d) of type (Unknown) + +Explicit resource and pconnect +resource(%d) of type (mysql link persistent) +resource(%d) of type (Unknown) +HipHop Warning: %a + +Default link and pconnect +resource(%d) of type (mysql link persistent) +resource(%d) of type (mysql link persistent) +resource(%d) of type (Unknown) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug53649.php b/hphp/test/zend/bad/ext-mysql/bug53649.php new file mode 100644 index 000000000..daf60a8a5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug53649.php @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/bug53649.php.expectf b/hphp/test/zend/bad/ext-mysql/bug53649.php.expectf new file mode 100644 index 000000000..348ebd949 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/bug53649.php.expectf @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php b/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php new file mode 100644 index 000000000..dddb2be67 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php @@ -0,0 +1,113 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_affected_rows.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php b/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php new file mode 100644 index 000000000..d1499b702 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php @@ -0,0 +1,60 @@ +') == 1) && function_exists('is_unicode')) { +// unicode mode + if (!is_unicode($default_link_enc) || !is_unicode($link_enc)) { + printf("[010] No unicode returned!\n"); + var_dump($default_link_enc); + var_dump($link_enc); + } +} + +mysql_close($link); + +if (false !== ($tmp = @mysql_client_encoding($link))) + printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_client_encoding.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_close.php b/hphp/test/zend/bad/ext-mysql/mysql_close.php new file mode 100644 index 000000000..557004930 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_close.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_close.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_close.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_close.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_connect.php b/hphp/test/zend/bad/ext-mysql/mysql_connect.php new file mode 100644 index 000000000..9a263eb4c --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_connect.php @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_connect.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_connect.php.expectf new file mode 100644 index 000000000..6305362dc --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_connect.php.expectf @@ -0,0 +1,2 @@ +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_constants.php b/hphp/test/zend/bad/ext-mysql/mysql_constants.php new file mode 100644 index 000000000..da9a1e824 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_constants.php @@ -0,0 +1,55 @@ + true, + 'MYSQL_NUM' => true, + 'MYSQL_BOTH' => true, + 'MYSQL_CLIENT_COMPRESS' => true, + 'MYSQL_CLIENT_INTERACTIVE' => true, + 'MYSQL_CLIENT_IGNORE_SPACE' => true, +); + +$version = mysql_get_server_info($link); +if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches)) + printf("[001] Cannot get server version\n"); +$version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3]; + +if ($version > 400) { + $expected_constants = array_merge($expected_constants, array( + "MYSQL_CLIENT_SSL" => true, + )); +} + + +$unexpected_constants = array(); + +foreach ($constants as $group => $consts) { + foreach ($consts as $name => $value) { + if (stristr($name, 'mysql') && !preg_match("/^mysql([^_]+)_/iu", $name)) { + $name = strtoupper($name); + if (isset($expected_constants[$name])) { + unset($expected_constants[$name]); + } else { + $unexpected_constants[$name] = $name; + } + } + } +} + +if (!empty($unexpected_constants)) { + printf("Dumping list of unexpected constants\n"); + var_dump($unexpected_constants); +} + +if (!empty($expected_constants)) { + printf("Dumping list of missing constants\n"); + var_dump($expected_constants); +} + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_constants.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_constants.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_constants.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_create_db.php b/hphp/test/zend/bad/ext-mysql/mysql_create_db.php new file mode 100644 index 000000000..c0dfc3f8d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_create_db.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_create_db.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_create_db.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_create_db.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php b/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php new file mode 100644 index 000000000..355482eac --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php @@ -0,0 +1,58 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php.expectf new file mode 100644 index 000000000..3ecd7c4e4 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_data_seek.php.expectf @@ -0,0 +1,5 @@ +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_db_name.php b/hphp/test/zend/bad/ext-mysql/mysql_db_name.php new file mode 100644 index 000000000..2702f314e --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_db_name.php @@ -0,0 +1,51 @@ +') == 1); +for ($i = 0; $i < $num; $i++) { + if ('' === ($dbname = mysql_db_name($res, $i))) + printf("[%03d] Got empty database name! [%d] %s\n", + (($i * 2) + 1) + 6, mysql_errno($link), mysql_error($link)); + + if ($unicode && !is_unicode($dbname)) { + printf("[%03d] Expecting unicode string! [%d] %s\n", + (($i * 2) + 2) + 6, mysql_errno($link), mysql_error($link)); + var_inspect($dbname); + } +} + +mysql_free_result($res); + +if (false !== ($tmp = mysql_db_name($res, $num))) + printf("[999] Expecting boolean/false, got %s/%s. [%d] %s\n", + gettype($tmp), $tmp, mysql_errno($link), mysql_error($link)); + +mysql_close($link); + +print "done!\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_db_name.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_db_name.php.expectf new file mode 100644 index 000000000..bbb6a90e5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_db_name.php.expectf @@ -0,0 +1,4 @@ +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_db_query.php b/hphp/test/zend/bad/ext-mysql/mysql_db_query.php new file mode 100644 index 000000000..a8f5f7d8d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_db_query.php @@ -0,0 +1,53 @@ +') == 1) && !is_unicode($row['label'])) { + printf("[006] No unicode returned! [%d] %s\n", mysql_errno($link), mysql_error($link)); + var_inspect($row); +} + +mysql_free_result($res); + + +if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1')) + printf("[007] [%d] %s\n", mysql_errno(), mysql_error()); + +$row = mysql_fetch_assoc($res); +if (1 != $row['id']) + printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); + +if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row['label'])) { + printf("[009] No unicode returned! [%d] %s\n", mysql_errno(), mysql_error()); + var_inspect($row); +} + +mysql_free_result($res); +mysql_close($link); + +print "done!\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_db_query.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_db_query.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_db_query.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php b/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php new file mode 100644 index 000000000..46e4e9249 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php @@ -0,0 +1,42 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_drop_db.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_errno.php b/hphp/test/zend/bad/ext-mysql/mysql_errno.php new file mode 100644 index 000000000..1a64d3430 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_errno.php @@ -0,0 +1,46 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_errno.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_errno.php.expectf new file mode 100644 index 000000000..8bef15d2c --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_errno.php.expectf @@ -0,0 +1,5 @@ +int(0) +int(%d) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_error.php b/hphp/test/zend/bad/ext-mysql/mysql_error.php new file mode 100644 index 000000000..9071f37ea --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_error.php @@ -0,0 +1,53 @@ +') == 1) && !is_unicode($tmp)) { + printf("[007] Expecting Unicode error message!\n"); + var_inspect($tmp); +} + +mysql_close($link); + +var_dump(mysql_error($link)); + +if ($link = @mysql_connect($host . '_unknown', $user . '_unknown', $passwd, true)) { + printf("[008] Can connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host . '_unknown', $user . '_unknown', $db, $port, $socket); +} +if ('' == mysql_error()) + printf("[009] Connect error should have been set\n"); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_error.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_error.php.expectf new file mode 100644 index 000000000..f2f386ad8 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_error.php.expectf @@ -0,0 +1,3 @@ +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php new file mode 100644 index 000000000..c49cbe295 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php @@ -0,0 +1,272 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php.expectf new file mode 100644 index 000000000..d6c28a050 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_array.php.expectf @@ -0,0 +1,75 @@ +[005] +array(4) { + [0]=> + %unicode|string%(1) "1" + [%u|b%"id"]=> + %unicode|string%(1) "1" + [1]=> + %unicode|string%(1) "a" + [%u|b%"label"]=> + %unicode|string%(1) "a" +} +[006] +array(2) { + [0]=> + %unicode|string%(1) "2" + [1]=> + %unicode|string%(1) "b" +} +[007] +array(4) { + [0]=> + %unicode|string%(1) "3" + [%u|b%"id"]=> + %unicode|string%(1) "3" + [1]=> + %unicode|string%(1) "c" + [%u|b%"label"]=> + %unicode|string%(1) "c" +} +[008] +array(2) { + [%u|b%"id"]=> + %unicode|string%(1) "4" + [%u|b%"label"]=> + %unicode|string%(1) "d" +} +[009] +array(4) { + [0]=> + %unicode|string%(1) "5" + [%u|b%"id"]=> + %unicode|string%(1) "5" + [1]=> + %unicode|string%(1) "e" + [%u|b%"label"]=> + %unicode|string%(1) "e" +} +[011] +array(11) { + [0]=> + %unicode|string%(1) "1" + [%u|b%"a"]=> + %unicode|string%(1) "2" + [1]=> + %unicode|string%(1) "2" + [2]=> + %unicode|string%(1) "3" + [%u|b%"c"]=> + %unicode|string%(1) "3" + [3]=> + %unicode|string%(1) "4" + [%u|b%"C"]=> + %unicode|string%(1) "4" + [4]=> + NULL + [%u|b%"d"]=> + NULL + [5]=> + %unicode|string%(1) "1" + [%u|b%"e"]=> + %unicode|string%(1) "1" +} +HipHop Warning: %a +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php new file mode 100644 index 000000000..a45c53711 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php @@ -0,0 +1,54 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php.expectf new file mode 100644 index 000000000..cf4880dcd --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_assoc.php.expectf @@ -0,0 +1,37 @@ +[005] +array(2) { + [%u|b%"id"]=> + %unicode|string%(1) "1" + [%u|b%"label"]=> + %unicode|string%(1) "a" +} +[006] +bool(false) +[008] +array(5) { + [%u|b%"a"]=> + %unicode|string%(1) "2" + [%u|b%"c"]=> + %unicode|string%(1) "3" + [%u|b%"C"]=> + %unicode|string%(1) "4" + [%u|b%"d"]=> + NULL + [%u|b%"e"]=> + %unicode|string%(1) "1" +} +HipHop Warning: %a +[010] +array(5) { + [%u|b%"id"]=> + %unicode|string%(1) "1" + [%u|b%"label"]=> + %unicode|string%(1) "a" + [%u|b%"_id"]=> + %unicode|string%(1) "1" + [%u|b%"_label"]=> + %unicode|string%(2) "aa" + [%u|b%"_foo"]=> + NULL +} +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php new file mode 100644 index 000000000..bc943663f --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php @@ -0,0 +1,147 @@ + array(1, 'int'), + 'TINYINT' => array(1, 'int'), + 'BOOL' => array('true', 'int'), + 'BOOL' => array(1, 'int'), + 'SMALLINT' => array(32767, 'int'), + 'MEDIUMINT' => array(8388607, 'int'), + 'INT' => array(100, 'int'), + 'BIGINT' => array(100, 'int'), + 'FLOAT' => array(100, 'real'), + 'DOUBLE' => array(100, 'real'), + 'DECIMAL' => array(100, 'real'), + 'DATE' => array(@date('Y-m-d'), 'date'), + 'DATETIME' => array(@date('Y-m-d H:i:s'), 'datetime'), + 'TIMESTAMP' => array(@date('Y-m-d H:i:s'), 'timestamp'), + 'TIME' => array(@date('H:i:s'), 'time'), + 'YEAR' => array(@date('Y'), 'year'), + 'CHAR(1)' => array('a', 'string'), + 'VARCHAR(1)' => array('a', 'string'), + 'BINARY(1)' => array('a', 'string'), + 'VARBINARY(1)' => array('a', 'string'), + 'TINYBLOB' => array('a', 'blob'), + 'TINYTEXT' => array('a', 'blob'), + 'BLOB' => array('a', 'blob'), + 'TEXT' => array('a', 'blob'), + 'MEDIUMBLOB' => array('a', 'blob'), + 'MEDIUMTEXT' => array('a', 'blob'), + 'LONGBLOB' => array('a', 'blob'), + 'LONGTEXT' => array('a', 'blob'), + 'ENUM("a", "b")' => array('a', 'string'), /* !!! */ + 'SET("a", "b")' => array('a', 'string'), /* !!! */ + ); + + foreach ($types as $type_name => $type_desc) { + if (!mysql_query("DROP TABLE IF EXISTS test", $link)) + printf("[008/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); + if (!mysql_query(sprintf("CREATE TABLE test(id INT, label %s) ENGINE = %s", $type_name, $engine), $link)) { + // server and/or engine might not support the data type + continue; + } + + if (is_string($type_desc[0])) + $insert = sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $type_desc[0]); + else + $insert = sprintf("INSERT INTO test(id, label) VALUES (1, %s)", $type_desc[0]); + + if (!mysql_query($insert, $link)) { + if (1366 == mysql_errno($link)) { + /* Strict SQL mode - 1366, Incorrect integer value: 'true' for column 'label' at row 1 */ + continue; + } + printf("[009/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); + continue; + } + if (!$res = mysql_query("SELECT id, label FROM test", $link)) { + printf("[010/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); + continue; + } + if (!$tmp = mysql_fetch_field($res, 1)) { + printf("[011/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); + } + + if ($type_desc[1] != $tmp->type) { + printf("[012/%s] Expecting type '%s' got '%s'\n", $type_name, $type_desc[1], $tmp->type); + } + mysql_free_result($res); + } + + if (!mysql_query("DROP TABLE IF EXISTS test", $link)) + printf("[013] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!mysql_query("CREATE TABLE test(id INT DEFAULT 1)")) + printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!mysql_query("INSERT INTO test(id) VALUES (2)")) + printf("[015] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!$res = mysql_query("SELECT id FROM test", $link)) { + printf("[016] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + + var_dump(mysql_fetch_field($res)); + mysql_free_result($res); + + if (!$res = mysql_query("SELECT id FROM test", $link)) { + printf("[017] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + $res = mysql_list_fields($db, 'test'); + $found = false; + while ($tmp = mysql_fetch_field($res)) { + if ($tmp->name == 'id') { + printf("Fetch field from mysql_list_fields result set.\n"); + $found = true; + var_dump($tmp); + } + } + if (!$found) + printf("[018] mysqli_list_fields result set processing has failed.\n"); + + mysql_free_result($res); + + mysql_close($link); + print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php.expectf new file mode 100644 index 000000000..adbecee87 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_field.php.expectf @@ -0,0 +1,117 @@ +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(2) "ID" + [%u|b%"table"]=> + %unicode|string%(4) "TEST" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(1) + [%u|b%"primary_key"]=> + int(1) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(1) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(3) "int" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(5) "label" + [%u|b%"table"]=> + %unicode|string%(4) "TEST" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(0) + [%u|b%"primary_key"]=> + int(0) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(0) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(6) "string" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +bool(false) +HipHop Warning: %a +HipHop Warning: %a +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(2) "id" + [%u|b%"table"]=> + %unicode|string%(4) "test" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(0) + [%u|b%"primary_key"]=> + int(0) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(1) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(3) "int" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +Fetch field from mysql_list_fields result set. +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(2) "id" + [%u|b%"table"]=> + %unicode|string%(4) "test" + [%u|b%"def"]=> + %unicode|string%(1) "1" + [%u|b%"max_length"]=> + int(0) + [%u|b%"not_null"]=> + int(0) + [%u|b%"primary_key"]=> + int(0) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(1) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(3) "int" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php new file mode 100644 index 000000000..4665bfbe4 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php.expectf new file mode 100644 index 000000000..e75812829 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_lengths.php.expectf @@ -0,0 +1,10 @@ +array(2) { + [0]=> + int(1) + [1]=> + int(1) +} +bool(false) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php new file mode 100644 index 000000000..fe91e2630 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php @@ -0,0 +1,73 @@ +a = $a; + $this->b = $b; + } + +} + +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', null)); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a'))); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b', 'c'))); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', "no array and not null")); +var_dump(mysql_fetch_object($res)); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); + +class mysql_fetch_object_private_construct { + private function __construct($a, $b) { + var_dump($a); + } +} +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_private_construct', array('a', 'b'))); + +mysql_free_result($res); + +if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST", $link)) { + printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); +} + +mysql_free_result($res); + +var_dump(mysql_fetch_object($res)); + +// Fatal error, script execution will end +var_dump(mysql_fetch_object($res, 'this_class_does_not_exist')); + +mysql_close($link); +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php.expectf new file mode 100644 index 000000000..a3a5f5b80 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_object.php.expectf @@ -0,0 +1,60 @@ +object(stdClass)#%d (2) { + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"label"]=> + %unicode|string%(1) "a" +} +object(mysql_fetch_object_test)#%d (4) { + [%u|b%"a"]=> + NULL + [%u|b%"b"]=> + NULL + [%u|b%"ID"]=> + %unicode|string%(1) "2" + [%u|b%"label"]=> + %unicode|string%(1) "b" +} +HipHop Warning: %a +HipHop Warning: %a +HipHop Notice: %a +HipHop Notice: %a +object(mysql_fetch_object_construct)#%d (4) { + [%u|b%"a"]=> + NULL + [%u|b%"b"]=> + NULL + [%u|b%"ID"]=> + %unicode|string%(1) "3" + [%u|b%"label"]=> + %unicode|string%(1) "c" +} +HipHop Warning: %a +HipHop Notice: %a +object(mysql_fetch_object_construct)#%d (4) { + [%u|b%"a"]=> + %unicode|string%(1) "a" + [%u|b%"b"]=> + NULL + [%u|b%"ID"]=> + %unicode|string%(1) "4" + [%u|b%"label"]=> + %unicode|string%(1) "d" +} +object(mysql_fetch_object_construct)#%d (4) { + [%u|b%"a"]=> + %unicode|string%(1) "a" + [%u|b%"b"]=> + %unicode|string%(1) "b" + [%u|b%"ID"]=> + %unicode|string%(1) "5" + [%u|b%"label"]=> + %unicode|string%(1) "e" +} +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +HipHop Warning: %a +bool(false) +HipHop Fatal error: %a \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php b/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php new file mode 100644 index 000000000..a9a3b9c5e --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php.expectf new file mode 100644 index 000000000..95afff965 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_fetch_row.php.expectf @@ -0,0 +1,12 @@ +[004] +array(2) { + [0]=> + %unicode|string%(1) "1" + [1]=> + %unicode|string%(1) "a" +} +[005] +bool(false) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php b/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php new file mode 100644 index 000000000..409c38fc0 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php @@ -0,0 +1,135 @@ +') == 1) && !is_unicode($tmp)) { + printf("[007] Check the unicode support!\n"); + var_inspect($tmp); +} + +if (false !== ($tmp = mysql_field_flags($res, 2))) + printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + +mysql_free_result($res); + +$version = mysql_get_server_info($link); +if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches)) + printf("[009] Cannot get server version\n"); +$version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3]; + +$tables = array( + 'label INT, UNIQUE KEY (label)' => array( + array('label', '1'), + 'label' => array(($version < 500) ? 'multiple_key' : 'unique_key') + ), + 'labela INT, label2 CHAR(1), KEY keyname (labela, label2)' => array( + array('labela, label2', "1, 'a'"), + 'labela' => array('multiple_key'), + ), + 'label1 BLOB' => array( + array('label1', "'blob'"), + 'label1' => array('blob', 'binary'), + ), + 'label1 INT UNSIGNED' => array( + array('label1', '100'), + 'label1' => array('unsigned'), + ), + 'label1 INT UNSIGNED NOT NULL AUTO INCREMENT' => array( + array('label1', '100'), + 'label1' => array('auto_increment', + 'unsigned'), + ), + 'label1 ENUM("a", "b")' => array( + array('label1', "'a'"), + 'label1' => array('enum'), + ), + 'label1 SET("a", "b")' => array( + array('label1', "'a'"), + 'label1' => array('set'), + ), + 'label1 TIMESTAMP' => array( + array('label1', sprintf("'%s'", @date("Y-m-d H:i:s"))), + 'label1' => array( + 'timestamp', + 'binary', + 'not_null'), + ), +); + +if ($version < 560) { + $tables['label1 TIMESTAMP']['label1'][] = 'zerofill'; + $tables['label1 TIMESTAMP']['label1'][] = 'unsigned'; +} + + +foreach ($tables as $columns => $expected) { + if (!mysql_query("DROP TABLE IF EXISTS test", $link)) { + printf("[010/%s] [%d] %s\n", $columns, mysql_errno($link), mysql_error($link)); + continue; + } + $sql = sprintf("CREATE TABLE test(id INT, %s) ENGINE = %s", $columns, $engine); + if (!@mysql_query($sql, $link)) { + // server or engine might not support this + continue; + } + + reset($expected); + list($k, $values) = each($expected); + $sql = sprintf("INSERT INTO test(id, %s) VALUES (1, %s)", $values[0], $values[1]); + if (!mysql_query($sql, $link)) { + printf("[011/%s] '%s', [%d] %s\n", $columns, $sql, mysql_errno($link), mysql_error($link)); + continue; + } + + if (!$res = mysql_query(sprintf("SELECT id, %s FROM test", $values[0]), $link)) { + printf("[012/%s] [%d] %s\n", $columns, mysql_errno($link), mysql_error($link)); + continue; + } + + $i = 1; + while (list($field, $flags) = each($expected)) { + $tmp = mysql_field_flags($res, $i++); + + foreach ($flags as $k => $flag) { + if (!preg_match(sprintf('@\s*%s\s*@ismU', $flag), $tmp)) { + printf("[013/%s] Field '%s', flag '%s' not found, [%d] %s\n", $columns, $field, $flag, mysql_errno($link), mysql_error($link)); + } + } + foreach ($flags as $k => $flag) { + $tmp = preg_replace(sprintf('@\s*%s\s*@ismU', $flag), '', $tmp); + } + if ('' != $tmp) + printf("[014/%s] Field '%s', unexpected flags '%s' found, [%d] %s\n", $columns, $field, $tmp, mysql_errno($link), mysql_error($link)); + } + mysql_free_result($res); +} + +var_dump(mysql_field_flags($res, 0)); + +mysql_close($link); +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php.expectf new file mode 100644 index 000000000..bd8b7405b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_flags.php.expectf @@ -0,0 +1,6 @@ +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_len.php b/hphp/test/zend/bad/ext-mysql/mysql_field_len.php new file mode 100644 index 000000000..187746282 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_len.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_len.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_len.php.expectf new file mode 100644 index 000000000..bd8b7405b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_len.php.expectf @@ -0,0 +1,6 @@ +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_name.php b/hphp/test/zend/bad/ext-mysql/mysql_field_name.php new file mode 100644 index 000000000..f1766a118 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_name.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_name.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_name.php.expectf new file mode 100644 index 000000000..38a80cc64 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_name.php.expectf @@ -0,0 +1,7 @@ +HipHop Warning: %a +HipHop Warning: %a +%unicode|string%(2) "id" +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php b/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php new file mode 100644 index 000000000..3f02f02c8 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php.expectf new file mode 100644 index 000000000..2d166617d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_seek.php.expectf @@ -0,0 +1,94 @@ +HipHop Warning: %a +bool(false) +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(2) "id" + [%u|b%"table"]=> + %unicode|string%(4) "test" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(1) + [%u|b%"primary_key"]=> + int(1) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(1) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(3) "int" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(2) "id" + [%u|b%"table"]=> + %unicode|string%(4) "test" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(1) + [%u|b%"primary_key"]=> + int(1) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(1) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(3) "int" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + [%u|b%"name"]=> + %unicode|string%(5) "label" + [%u|b%"table"]=> + %unicode|string%(4) "test" + [%u|b%"def"]=> + %unicode|string%(0) "" + [%u|b%"max_length"]=> + int(1) + [%u|b%"not_null"]=> + int(0) + [%u|b%"primary_key"]=> + int(0) + [%u|b%"multiple_key"]=> + int(0) + [%u|b%"unique_key"]=> + int(0) + [%u|b%"numeric"]=> + int(0) + [%u|b%"blob"]=> + int(0) + [%u|b%"type"]=> + %unicode|string%(6) "string" + [%u|b%"unsigned"]=> + int(0) + [%u|b%"zerofill"]=> + int(0) +} +HipHop Warning: %a +bool(false) +bool(false) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_table.php b/hphp/test/zend/bad/ext-mysql/mysql_field_table.php new file mode 100644 index 000000000..af724dcbe --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_table.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_table.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_table.php.expectf new file mode 100644 index 000000000..b2f11176e --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_table.php.expectf @@ -0,0 +1,7 @@ +HipHop Warning: %a +HipHop Warning: %a +%unicode|string%(4) "test" +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_type.php b/hphp/test/zend/bad/ext-mysql/mysql_field_type.php new file mode 100644 index 000000000..d27e50213 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_type.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_field_type.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_field_type.php.expectf new file mode 100644 index 000000000..452c3c171 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_field_type.php.expectf @@ -0,0 +1,7 @@ +HipHop Warning: %a +HipHop Warning: %a +%unicode|string%(3) "int" +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_free_result.php b/hphp/test/zend/bad/ext-mysql/mysql_free_result.php new file mode 100644 index 000000000..c0e1c22cf --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_free_result.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_free_result.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_free_result.php.expectf new file mode 100644 index 000000000..69d1f7d6d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_free_result.php.expectf @@ -0,0 +1,4 @@ +bool(true) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php b/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php new file mode 100644 index 000000000..fd751fbc6 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php @@ -0,0 +1,32 @@ +') == 1) && !is_unicode($info)) { + printf("[005] Expecting Unicode error message!\n"); + var_inspect($info); +} + +if (!is_null($tmp = @mysql_get_host_info($link, "too many arguments"))) { + printf("[006] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp)); +} + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_host_info.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php b/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php new file mode 100644 index 000000000..f2cb22856 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_proto_info.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php b/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php new file mode 100644 index 000000000..d520920f8 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php @@ -0,0 +1,29 @@ +') == 1) && !is_unicode($info)) { + printf("[005] Expecting Unicode error message!\n"); + var_inspect($info); +} + +if (NULL !== ($tmp = @mysql_get_server_info('too many', 'just too many'))) + printf("[006] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_get_server_info.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_info.php b/hphp/test/zend/bad/ext-mysql/mysql_info.php new file mode 100644 index 000000000..af80a3ef9 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_info.php @@ -0,0 +1,61 @@ += 100", $link)) + printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); + +if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) + printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + +if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($tmp)) { + printf("[013] Expecting Unicode!\n"); + var_inspect($info); +} + +if (!is_string($def_tmp = mysql_info()) || ('' == $def_tmp)) + printf("[014] Expecting string/any_non_empty, got %s/%s\n", gettype($def_tmp), $def_tmp); + +if ($def_tmp !== $tmp) { + printf("[015] Results differ for default link and specified link, [%d] %s\n", + mysql_errno(), mysql_error()); + var_inspect($tmp); + var_inspect($def_tmp); +} + +// NOTE: no LOAD DATA INFILE test + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_info.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_info.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_info.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php b/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php new file mode 100644 index 000000000..c949c2f5e --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php @@ -0,0 +1,57 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php.expectf new file mode 100644 index 000000000..f2f386ad8 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_insert_id.php.expectf @@ -0,0 +1,3 @@ +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php b/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php new file mode 100644 index 000000000..f9848fad4 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php @@ -0,0 +1,42 @@ +') == 1) && !is_unicode($row[0])) { + printf("[005] Check for unicode support\n"); + var_inspect($row); +} + +mysql_free_result($res); + +if (!$res2 = @mysql_list_dbs()) + printf("[006] [%d] %s\n", mysql_errno(), mysql_error()); + +$row2 = mysql_fetch_array($res2, MYSQL_NUM); +mysql_free_result($res2); + +assert($row === $row2); + +mysql_close($link); + +print "done!\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_dbs.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php b/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php new file mode 100644 index 000000000..03ed6bd7f --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php @@ -0,0 +1,55 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php.expectf new file mode 100644 index 000000000..5c309fd1d --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_fields.php.expectf @@ -0,0 +1,13 @@ +[006] [%d] %s +bool(false) +Field Offset 0 +mysql_field_flags()%s +mysql_field_len(): 11 +mysql_field_name(): id +mysql_field_type(): int +Field Offset 1 +mysql_field_flags()%s +mysql_field_len(): 1 +mysql_field_name(): label +mysql_field_type(): string +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php b/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php new file mode 100644 index 000000000..2e7490624 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php @@ -0,0 +1,42 @@ +') == 1) && !is_unicode($row[0])) { + printf("[004] Check for unicode support\n"); + var_inspect($row); +} + +mysql_free_result($res); + +if (!$res = mysql_list_processes()) + printf("[005] [%d] %s\n", mysql_errno(), mysql_error()); + +if (!$num = mysql_num_rows($res)) + printf("[006] Empty process list? [%d] %s\n", mysql_errno(), mysql_error()); + +$row = mysql_fetch_array($res, MYSQL_NUM); +if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row[0])) { + printf("[007] Check for unicode support\n"); + var_inspect($row); +} + +mysql_free_result($res); +mysql_close($link); + +print "done!\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_processes.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php b/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php new file mode 100644 index 000000000..380551020 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php @@ -0,0 +1,73 @@ + $tlist) + foreach ($tlist as $k => $table) + $list1[] = $table; + +foreach ($tables_query as $k => $tlist) + foreach ($tlist as $k => $table) + $list2[] = $table; + +if ($list1 !== $list2) { + printf("[009] Got different results for mysql_list_tables() and SHOW TABLES\n"); + var_dump($list1); + var_dump($list2); +} + +if (!in_array('test', $list1)) + printf("[010] Table lists seem to be wrong. Check manually.\n"); + +mysql_close($link); + +print "done!\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_list_tables.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php b/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php new file mode 100644 index 000000000..842e7de2b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php.expectf new file mode 100644 index 000000000..6305362dc --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_num_fields.php.expectf @@ -0,0 +1,2 @@ +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php b/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php new file mode 100644 index 000000000..a7e25c1d9 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php @@ -0,0 +1,70 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php.expectf new file mode 100644 index 000000000..bbb6a90e5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_num_rows.php.expectf @@ -0,0 +1,4 @@ +HipHop Warning: %a +HipHop Warning: %a +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php b/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php new file mode 100644 index 000000000..a67563460 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php @@ -0,0 +1,65 @@ + $entry) + if (!stristr($phpinfo, $entry)) + printf("[012] Could not find entry for '%s'\n", $entry); +} + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_phpinfo.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_ping.php b/hphp/test/zend/bad/ext-mysql/mysql_ping.php new file mode 100644 index 000000000..2120d516b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_ping.php @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_ping.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_ping.php.expectf new file mode 100644 index 000000000..7dcae4d15 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_ping.php.expectf @@ -0,0 +1,5 @@ +bool(true) +bool(true) +bool(true) +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_query.php b/hphp/test/zend/bad/ext-mysql/mysql_query.php new file mode 100644 index 000000000..6fc441940 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_query.php @@ -0,0 +1,104 @@ +') == 1) && !is_unicode($tmp['p_version'])) { + printf("[010] Expecting unicode string, dumping\n"); + var_dump($tmp); + } + mysql_free_result($res); + } else { + printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + + mysql_query('DROP FUNCTION IF EXISTS f', $link); + if (mysql_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { + $res = mysql_query('SELECT f(VERSION()) AS f_version', $link); + $tmp = mysql_fetch_assoc($res); + if (!isset($tmp['f_version']) || ('' == $tmp['f_version'])) { + printf("[012] Result seems wrong, dumping\n"); + var_dump($tmp); + } + if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($tmp['f_version'])) { + printf("[013] Expecting unicode string, dumping\n"); + var_dump($tmp); + } + mysql_free_result($res); + } else { + printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } +} + +mysql_close($link); + +if (false !== ($tmp = mysql_query("SELECT id FROM test", $link))) + printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_query.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_query.php.expectf new file mode 100644 index 000000000..b5c652981 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_query.php.expectf @@ -0,0 +1,11 @@ +array(1) { + [%u|b%"valid"]=> + %unicode|string%(30) "this is sql but with semicolon" +} +array(1) { + [%u|b%""]=> + %unicode|string%(1) "a" +} +%unicode|string%(1) "a" +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php b/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php new file mode 100644 index 000000000..76fda9f99 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php @@ -0,0 +1,84 @@ +') >= 0) { + if (!fwrite($fp, (binary)"'97';'x';\n") || + !fwrite($fp, (binary)"'98';'y';\n") || + !fwrite($fp, (binary)"99;'z';\n")) { + printf("[004] Cannot write CVS file '%s'\n", $file); + } +} else { + if (!fwrite($fp, "97;'x';\n") || + !fwrite($fp, "98;'y';\n") || + !fwrite($fp, "99;'z';\n")) { + printf("[005] Cannot write CVS file '%s'\n", $file); + } +} +fclose($fp); + +$sql = sprintf("LOAD DATA LOCAL INFILE '%s' + INTO TABLE test + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'", + mysql_real_escape_string(realpath('./simple.csv'), $link)); + +if (!mysql_query($sql, $link)) + printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); + +if (!($res = mysql_query('SELECT label FROM test WHERE id = 97', $link)) || + !($row = mysql_fetch_assoc($res)) || + !mysql_free_result($res)) + printf("[007] [%d] '%s'\n", mysql_errno($link), mysql_error($link)); + +if ($row['label'] != "x") + printf("[008] LOAD DATA not run?\n"); + +if (!mysql_query('DELETE FROM test', $link)) + printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); + +$sql = "LOAD DATA LOCAL INFILE '/tmp/idonotexist' + INTO TABLE test + FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' + LINES TERMINATED BY '\n'"; + +if (!mysql_query($sql, $link)) + printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link)); + +mysql_close($link); +unlink("./simple.csv"); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php.expectf new file mode 100644 index 000000000..dc835dbda --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_query_load_data_openbasedir.php.expectf @@ -0,0 +1,5 @@ +[006] [1148] %s +[007] [0] '' +[008] LOAD DATA not run? +[010] [1148] %s +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php b/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php new file mode 100644 index 000000000..a5f231d8c --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php.expectf new file mode 100644 index 000000000..74500f8a5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_real_escape_string.php.expectf @@ -0,0 +1,8 @@ +%unicode|string%(31) "Am I a unicode string in PHP 6?" +%unicode|string%(2) "\\" +%unicode|string%(2) "\"" +%unicode|string%(2) "\'" +%unicode|string%(2) "\n" +%unicode|string%(2) "\r" +%unicode|string%(8) "foo\0bar" +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_result.php b/hphp/test/zend/bad/ext-mysql/mysql_result.php new file mode 100644 index 000000000..ccc3bac69 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_result.php @@ -0,0 +1,56 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_result.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_result.php.expectf new file mode 100644 index 000000000..bb22d1601 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_result.php.expectf @@ -0,0 +1,37 @@ +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +valid fields +%unicode|string%(1) "1" +%unicode|string%(1) "a" +%unicode|string%(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "a" +%unicode|string%(1) "a" +some invalid fields +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +_id +%unicode|string%(1) "1" +_label +string(2) "aa" +_foo +NULL +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_select_db.php b/hphp/test/zend/bad/ext-mysql/mysql_select_db.php new file mode 100644 index 000000000..d713657d5 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_select_db.php @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_select_db.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_select_db.php.expectf new file mode 100644 index 000000000..34c09c10c --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_select_db.php.expectf @@ -0,0 +1,4 @@ +%unicode|string%(%d) "%s" +bool(false) +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php b/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php new file mode 100644 index 000000000..160490197 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php @@ -0,0 +1,44 @@ +') == 1)) + $expect = false; +else + $expect = true; + +$charsets = array('latin1', 'latin2'); +foreach ($charsets as $k => $charset) { + if (!($res = mysql_query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset), $link))) + continue; + mysql_free_result($res); + if ($expect !== ($tmp = @mysql_set_charset($charset, $link))) + printf("[006] Expecting %s/%s got %s/%s\n", + gettype($expect), $expect, + gettype($tmp), $tmp); +} + +mysql_close($link); +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_set_charset.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_stat.php b/hphp/test/zend/bad/ext-mysql/mysql_stat.php new file mode 100644 index 000000000..ce9222ae3 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_stat.php @@ -0,0 +1,37 @@ +') == 1) && !is_unicode($stat)) { + printf("[004] Expecting Unicode error message!\n"); + var_inspect($stat); +} + +if ((!is_string($stat_def = mysql_stat())) || ('' === $stat_def)) + printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", + gettype($stat_def), $stat_def, mysql_errno(), mysql_error()); + +assert(soundex($stat) === soundex($stat_def)); + +mysql_close($link); + +if (false !== ($tmp = mysql_stat($link))) + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_stat.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_stat.php.expectf new file mode 100644 index 000000000..6305362dc --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_stat.php.expectf @@ -0,0 +1,2 @@ +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_tablename.php b/hphp/test/zend/bad/ext-mysql/mysql_tablename.php new file mode 100644 index 000000000..3a575b16e --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_tablename.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_tablename.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_tablename.php.expectf new file mode 100644 index 000000000..3ff00b182 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_tablename.php.expectf @@ -0,0 +1,7 @@ +HipHop Warning: %a +HipHop Warning: %a +%unicode|string%(1) "1" +HipHop Warning: %a +HipHop Warning: %a +bool(false) +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php b/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php new file mode 100644 index 000000000..3b1925e2c --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php.expectf new file mode 100644 index 000000000..6305362dc --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_thread_id.php.expectf @@ -0,0 +1,2 @@ +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php b/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php new file mode 100644 index 000000000..8714e228b --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php @@ -0,0 +1,98 @@ +') == 1) && !is_unicode($tmp['p_version'])) { + printf("[009] Expecting unicode string, dumping\n"); + var_dump($tmp); + } + mysql_free_result($res); + } else { + printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + + mysql_unbuffered_query('DROP FUNCTION IF EXISTS f', $link); + if (mysql_unbuffered_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { + $res = mysql_unbuffered_query('SELECT f(VERSION()) AS f_version', $link); + $tmp = mysql_fetch_assoc($res); + if (!isset($tmp['f_version']) || ('' == $tmp['f_version'])) { + printf("[011] Result seems wrong, dumping\n"); + var_dump($tmp); + } + if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($tmp['f_version'])) { + printf("[012] Expecting unicode string, dumping\n"); + var_dump($tmp); + } + mysql_free_result($res); + } else { + printf("[012] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } +} + +var_dump(mysql_unbuffered_query('INSERT INTO test(id) VALUES (100)', $link)); +var_dump($res = mysql_unbuffered_query('SELECT id FROM test', $link)); +var_dump(mysql_num_rows($res)); + +mysql_close($link); + +if (false !== ($tmp = mysql_unbuffered_query("SELECT id FROM test", $link))) + printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php.expectf b/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php.expectf new file mode 100644 index 000000000..6b8e7ddb9 --- /dev/null +++ b/hphp/test/zend/bad/ext-mysql/mysql_unbuffered_query.php.expectf @@ -0,0 +1,10 @@ +array(1) { + [%u|b%"valid"]=> + %unicode|string%(30) "this is sql but with semicolon" +} +bool(true) +resource(%d) of type (mysql result) +int(0) +HipHop Notice: %a +HipHop Warning: %a +done! \ No newline at end of file diff --git a/hphp/test/zend/good/ext-mysql/connect.inc b/hphp/test/zend/good/ext-mysql/connect.inc new file mode 100644 index 000000000..0df5bc3aa --- /dev/null +++ b/hphp/test/zend/good/ext-mysql/connect.inc @@ -0,0 +1,82 @@ + diff --git a/hphp/test/zend/good/ext-mysql/mysql_escape_string.php b/hphp/test/zend/good/ext-mysql/mysql_escape_string.php new file mode 100644 index 000000000..7580e9eb8 --- /dev/null +++ b/hphp/test/zend/good/ext-mysql/mysql_escape_string.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-mysql/mysql_escape_string.php.expectf b/hphp/test/zend/good/ext-mysql/mysql_escape_string.php.expectf new file mode 100644 index 000000000..74500f8a5 --- /dev/null +++ b/hphp/test/zend/good/ext-mysql/mysql_escape_string.php.expectf @@ -0,0 +1,8 @@ +%unicode|string%(31) "Am I a unicode string in PHP 6?" +%unicode|string%(2) "\\" +%unicode|string%(2) "\"" +%unicode|string%(2) "\'" +%unicode|string%(2) "\n" +%unicode|string%(2) "\r" +%unicode|string%(8) "foo\0bar" +done! \ No newline at end of file diff --git a/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php b/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php new file mode 100644 index 000000000..21ba526a0 --- /dev/null +++ b/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php @@ -0,0 +1,16 @@ +') == 1) && !is_unicode($info)) { + printf("[002] Expecting Unicode!\n"); + var_inspect($info); +} + +if (!is_null($tmp = @mysql_get_client_info("too many arguments"))) { + printf("[003] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp)); +} + +print "done!"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php.expectf b/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php.expectf new file mode 100644 index 000000000..dd55c26f1 --- /dev/null +++ b/hphp/test/zend/good/ext-mysql/mysql_get_client_info.php.expectf @@ -0,0 +1 @@ +done! \ No newline at end of file diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py index 23ab06d91..808172814 100755 --- a/hphp/tools/import_zend_test.py +++ b/hphp/tools/import_zend_test.py @@ -78,7 +78,6 @@ no_import = ( '/ext/xmlwriter/examples/', # not imported yet, but will be - '/ext/mysql', '/ext/pdo_mysql', '/ext/pdo_sqlite', '/ext/spl', @@ -202,6 +201,7 @@ other_files = ( '/ext-ldap/connect.inc', '/ext-mbstring/common.inc', '/ext-mcrypt/vectors.txt', + '/ext-mysql/connect.inc', '/ext-openssl/005_crt.txt', '/ext-openssl/bug37820cert.pem', '/ext-openssl/bug37820key.pem',