summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-25 16:07:16 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-25 16:07:16 +0100
commite3e67b721f1ae3f7b8c624ea0e3e3e18dd0e9417 (patch)
tree1d7b134bb54048cbdc3889d7e223404ad73026e3
parent97d192b444543b12097cd4b9da9d5470ffcd14bd (diff)
downloadphp-git-e3e67b721f1ae3f7b8c624ea0e3e3e18dd0e9417.tar.gz
Reindent more mysqli tests
Due to a bug in the tidy script, most tests did not actually get reindented...
-rw-r--r--ext/mysqli/tests/001.phpt94
-rw-r--r--ext/mysqli/tests/002.phpt56
-rw-r--r--ext/mysqli/tests/003.phpt106
-rw-r--r--ext/mysqli/tests/004.phpt62
-rw-r--r--ext/mysqli/tests/005.phpt44
-rw-r--r--ext/mysqli/tests/006.phpt56
-rw-r--r--ext/mysqli/tests/007.phpt56
-rw-r--r--ext/mysqli/tests/008.phpt56
-rw-r--r--ext/mysqli/tests/009.phpt132
-rw-r--r--ext/mysqli/tests/010.phpt56
-rw-r--r--ext/mysqli/tests/011.phpt54
-rw-r--r--ext/mysqli/tests/012.phpt52
-rw-r--r--ext/mysqli/tests/013.phpt78
-rw-r--r--ext/mysqli/tests/014.phpt80
-rw-r--r--ext/mysqli/tests/015.phpt90
-rw-r--r--ext/mysqli/tests/016.phpt28
-rw-r--r--ext/mysqli/tests/017.phpt32
-rw-r--r--ext/mysqli/tests/018.phpt26
-rw-r--r--ext/mysqli/tests/019.phpt68
-rw-r--r--ext/mysqli/tests/020.phpt88
-rw-r--r--ext/mysqli/tests/021.phpt44
-rw-r--r--ext/mysqli/tests/022.phpt46
-rw-r--r--ext/mysqli/tests/023.phpt68
-rw-r--r--ext/mysqli/tests/024.phpt68
-rw-r--r--ext/mysqli/tests/025.phpt72
-rw-r--r--ext/mysqli/tests/026.phpt50
-rw-r--r--ext/mysqli/tests/027.phpt14
-rw-r--r--ext/mysqli/tests/028.phpt14
-rw-r--r--ext/mysqli/tests/029.phpt24
-rw-r--r--ext/mysqli/tests/030.phpt22
-rw-r--r--ext/mysqli/tests/031.phpt22
-rw-r--r--ext/mysqli/tests/032.phpt24
-rw-r--r--ext/mysqli/tests/033.phpt14
-rw-r--r--ext/mysqli/tests/034.phpt14
-rw-r--r--ext/mysqli/tests/035.phpt14
-rw-r--r--ext/mysqli/tests/036.phpt44
-rw-r--r--ext/mysqli/tests/037.phpt28
-rw-r--r--ext/mysqli/tests/038.phpt32
-rw-r--r--ext/mysqli/tests/039.phpt24
-rw-r--r--ext/mysqli/tests/040.phpt34
-rw-r--r--ext/mysqli/tests/041.phpt18
-rw-r--r--ext/mysqli/tests/042.phpt62
-rw-r--r--ext/mysqli/tests/043.phpt44
-rw-r--r--ext/mysqli/tests/044.phpt16
-rw-r--r--ext/mysqli/tests/045.phpt24
-rw-r--r--ext/mysqli/tests/046.phpt34
-rw-r--r--ext/mysqli/tests/047.phpt50
-rw-r--r--ext/mysqli/tests/048.phpt46
-rw-r--r--ext/mysqli/tests/049.phpt24
-rw-r--r--ext/mysqli/tests/050.phpt18
-rw-r--r--ext/mysqli/tests/051.phpt20
-rw-r--r--ext/mysqli/tests/052.phpt20
-rw-r--r--ext/mysqli/tests/053.phpt16
-rw-r--r--ext/mysqli/tests/054.phpt18
-rw-r--r--ext/mysqli/tests/055.phpt16
-rw-r--r--ext/mysqli/tests/056.phpt20
-rw-r--r--ext/mysqli/tests/057.phpt80
-rw-r--r--ext/mysqli/tests/058.phpt50
-rw-r--r--ext/mysqli/tests/059.phpt40
-rw-r--r--ext/mysqli/tests/060.phpt50
-rw-r--r--ext/mysqli/tests/061.phpt2
-rw-r--r--ext/mysqli/tests/062.phpt18
-rw-r--r--ext/mysqli/tests/063.phpt18
-rw-r--r--ext/mysqli/tests/064.phpt18
-rw-r--r--ext/mysqli/tests/065.phpt54
-rw-r--r--ext/mysqli/tests/066.phpt30
-rw-r--r--ext/mysqli/tests/067.phpt70
-rw-r--r--ext/mysqli/tests/068.phpt4
-rw-r--r--ext/mysqli/tests/069.phpt34
-rw-r--r--ext/mysqli/tests/070.phpt10
-rw-r--r--ext/mysqli/tests/071.phpt94
-rw-r--r--ext/mysqli/tests/072.phpt20
-rw-r--r--ext/mysqli/tests/073.phpt16
-rw-r--r--ext/mysqli/tests/074.phpt16
-rw-r--r--ext/mysqli/tests/bug28817.phpt30
-rw-r--r--ext/mysqli/tests/bug29311.phpt78
-rw-r--r--ext/mysqli/tests/bug30967.phpt18
-rw-r--r--ext/mysqli/tests/bug31141.phpt12
-rw-r--r--ext/mysqli/tests/bug31668.phpt52
-rw-r--r--ext/mysqli/tests/bug32405.phpt36
-rw-r--r--ext/mysqli/tests/bug33090.phpt18
-rw-r--r--ext/mysqli/tests/bug33263.phpt38
-rw-r--r--ext/mysqli/tests/bug34785.phpt56
-rw-r--r--ext/mysqli/tests/bug34810.phpt48
-rw-r--r--ext/mysqli/tests/bug35103.phpt62
-rw-r--r--ext/mysqli/tests/bug35517.phpt46
-rw-r--r--ext/mysqli/tests/bug35759.phpt86
-rw-r--r--ext/mysqli/tests/bug36745.phpt2
-rw-r--r--ext/mysqli/tests/bug36802.phpt38
-rw-r--r--ext/mysqli/tests/bug36949.phpt52
-rw-r--r--ext/mysqli/tests/bug37090.phpt22
-rw-r--r--ext/mysqli/tests/bug38710.phpt2
-rw-r--r--ext/mysqli/tests/bug39457.phpt12
-rw-r--r--ext/mysqli/tests/bug42378.phpt2
-rw-r--r--ext/mysqli/tests/bug42548.phpt34
-rw-r--r--ext/mysqli/tests/bug44897.phpt68
-rw-r--r--ext/mysqli/tests/bug45019.phpt70
-rw-r--r--ext/mysqli/tests/bug45289.phpt38
-rw-r--r--ext/mysqli/tests/bug46109.phpt10
-rw-r--r--ext/mysqli/tests/bug46614.phpt12
-rw-r--r--ext/mysqli/tests/bug47050.phpt24
-rw-r--r--ext/mysqli/tests/bug48909.phpt46
-rw-r--r--ext/mysqli/tests/bug49027.phpt54
-rw-r--r--ext/mysqli/tests/bug49442.phpt2
-rw-r--r--ext/mysqli/tests/bug50772.phpt38
-rw-r--r--ext/mysqli/tests/bug51647.phpt126
-rw-r--r--ext/mysqli/tests/bug52082.phpt24
-rw-r--r--ext/mysqli/tests/bug52891.phpt122
-rw-r--r--ext/mysqli/tests/bug53503.phpt6
-rw-r--r--ext/mysqli/tests/bug55283.phpt34
-rw-r--r--ext/mysqli/tests/bug55582.phpt26
-rw-r--r--ext/mysqli/tests/bug55653.phpt34
-rw-r--r--ext/mysqli/tests/bug62046.phpt52
-rw-r--r--ext/mysqli/tests/bug66043.phpt2
-rw-r--r--ext/mysqli/tests/bug66124.phpt26
-rw-r--r--ext/mysqli/tests/bug66762.phpt16
-rw-r--r--ext/mysqli/tests/bug67839.phpt2
-rw-r--r--ext/mysqli/tests/bug68077.phpt6
-rw-r--r--ext/mysqli/tests/bug69899.phpt6
-rw-r--r--ext/mysqli/tests/bug70384.phpt62
-rw-r--r--ext/mysqli/tests/bug70949.phpt30
-rw-r--r--ext/mysqli/tests/bug72701.phpt2
-rw-r--r--ext/mysqli/tests/bug73462.phpt44
-rw-r--r--ext/mysqli/tests/bug74547.phpt14
-rw-r--r--ext/mysqli/tests/bug74968.phpt12
-rw-r--r--ext/mysqli/tests/bug75018.phpt2
-rw-r--r--ext/mysqli/tests/bug77956.phpt6
-rw-r--r--ext/mysqli/tests/bug_bits.phpt14
-rw-r--r--ext/mysqli/tests/bug_mysql_49406.phpt138
-rw-r--r--ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_affected_rows.phpt166
-rw-r--r--ext/mysqli/tests/mysqli_affected_rows_oo.phpt134
-rw-r--r--ext/mysqli/tests/mysqli_auth_pam.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_autocommit.phpt174
-rw-r--r--ext/mysqli/tests/mysqli_autocommit_oo.phpt158
-rw-r--r--ext/mysqli/tests/mysqli_begin_transaction.phpt196
-rw-r--r--ext/mysqli/tests/mysqli_change_user.phpt198
-rw-r--r--ext/mysqli/tests/mysqli_change_user_get_lock.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_change_user_insert_id.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt126
-rw-r--r--ext/mysqli/tests/mysqli_change_user_new.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_change_user_old.phpt136
-rw-r--r--ext/mysqli/tests/mysqli_change_user_oo.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_change_user_rollback.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_change_user_set_names.phpt258
-rw-r--r--ext/mysqli/tests/mysqli_character_set.phpt172
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name.phpt96
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name_oo.phpt90
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt148
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_interface.phpt502
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt258
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt290
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt140
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_warning.phpt152
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_close.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_close_oo.phpt32
-rw-r--r--ext/mysqli/tests/mysqli_commit.phpt74
-rw-r--r--ext/mysqli/tests/mysqli_commit_oo.phpt160
-rw-r--r--ext/mysqli/tests/mysqli_connect.phpt278
-rw-r--r--ext/mysqli/tests/mysqli_connect_attr.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_connect_errno.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_connect_error.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo.phpt274
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo_defaults.phpt294
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo_warnings.phpt56
-rw-r--r--ext/mysqli/tests/mysqli_connect_twice.phpt86
-rw-r--r--ext/mysqli/tests/mysqli_constants_categories.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_data_seek.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_data_seek_oo.phpt84
-rw-r--r--ext/mysqli/tests/mysqli_debug.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_debug_append.phpt128
-rw-r--r--ext/mysqli/tests/mysqli_debug_control_string.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt400
-rw-r--r--ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_disable_reads_from_master.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_driver.phpt200
-rw-r--r--ext/mysqli/tests/mysqli_driver_unclonable.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_embedded_connect.phpt26
-rw-r--r--ext/mysqli/tests/mysqli_enable_reads_from_master.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_errno.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_errno_oo.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_error.phpt48
-rw-r--r--ext/mysqli/tests/mysqli_error_oo.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_error_unicode.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_expire_password.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_explain_metadata.phpt254
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all.phpt608
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all_oo.phpt582
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array.phpt566
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_assoc.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_large.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt196
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_oo.phpt534
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc.phpt90
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt156
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt128
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt64
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt100
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field.phpt110
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt56
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_flags.phpt394
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_oo.phpt86
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_types.phpt190
-rw-r--r--ext/mysqli/tests/mysqli_fetch_fields.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_fetch_lengths.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object.phpt256
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_no_object.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_oo.phpt230
-rw-r--r--ext/mysqli/tests/mysqli_fetch_row.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_field_count.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_field_seek.phpt156
-rw-r--r--ext/mysqli/tests/mysqli_field_tell.phpt58
-rw-r--r--ext/mysqli/tests/mysqli_fork.phpt400
-rw-r--r--ext/mysqli/tests/mysqli_free_result.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_get_charset.phpt190
-rw-r--r--ext/mysqli/tests/mysqli_get_client_info.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_off.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_ps.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt46
-rw-r--r--ext/mysqli/tests/mysqli_get_client_version.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_get_connection_stats.phpt100
-rw-r--r--ext/mysqli/tests/mysqli_get_connection_stats_off.phpt58
-rw-r--r--ext/mysqli/tests/mysqli_get_host_info.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_get_proto_info.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_get_server_info.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_get_server_version.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_get_warnings.phpt184
-rw-r--r--ext/mysqli/tests/mysqli_info.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_init.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_insert_id.phpt242
-rw-r--r--ext/mysqli/tests/mysqli_insert_packet_overflow.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_kill.phpt114
-rw-r--r--ext/mysqli/tests/mysqli_last_insert_id.phpt332
-rw-r--r--ext/mysqli/tests/mysqli_max_links.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_more_results.phpt84
-rw-r--r--ext/mysqli/tests/mysqli_multi_query.phpt156
-rw-r--r--ext/mysqli/tests/mysqli_next_result.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_num_fields.phpt54
-rw-r--r--ext/mysqli/tests/mysqli_num_rows.phpt86
-rw-r--r--ext/mysqli/tests/mysqli_open_bug74432.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_options.phpt202
-rw-r--r--ext/mysqli/tests/mysqli_options_init_command.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_options_int_and_float_native.phpt176
-rw-r--r--ext/mysqli/tests/mysqli_options_openbasedir.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt148
-rw-r--r--ext/mysqli/tests/mysqli_pconn_kill.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_pconn_limits.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_pconn_max_links.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_pconnect.phpt102
-rw-r--r--ext/mysqli/tests/mysqli_phpinfo.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_ping.phpt40
-rw-r--r--ext/mysqli/tests/mysqli_poll.phpt240
-rw-r--r--ext/mysqli/tests/mysqli_poll_kill.phpt338
-rw-r--r--ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt264
-rw-r--r--ext/mysqli/tests/mysqli_poll_reference.phpt358
-rw-r--r--ext/mysqli/tests/mysqli_prepare.phpt150
-rw-r--r--ext/mysqli/tests/mysqli_prepare_no_object.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_ps_select_union.phpt484
-rw-r--r--ext/mysqli/tests/mysqli_query.phpt142
-rw-r--r--ext/mysqli/tests/mysqli_query_iterators.phpt96
-rw-r--r--ext/mysqli/tests/mysqli_query_stored_proc.phpt264
-rw-r--r--ext/mysqli/tests/mysqli_query_unicode.phpt112
-rw-r--r--ext/mysqli/tests/mysqli_real_connect.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_real_connect_pconn.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string.phpt58
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_big5.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt96
-rw-r--r--ext/mysqli/tests/mysqli_real_query.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_reap_async_query.phpt148
-rw-r--r--ext/mysqli/tests/mysqli_release_savepoint.phpt78
-rw-r--r--ext/mysqli/tests/mysqli_report_new.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_report_wo_ps.phpt118
-rw-r--r--ext/mysqli/tests/mysqli_result_invalid_mode.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_result_references.phpt108
-rw-r--r--ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt64
-rw-r--r--ext/mysqli/tests/mysqli_result_unclonable.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_rollback.phpt70
-rw-r--r--ext/mysqli/tests/mysqli_savepoint.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_select_db.phpt138
-rw-r--r--ext/mysqli/tests/mysqli_send_query.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_set_charset.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_set_opt.phpt60
-rw-r--r--ext/mysqli/tests/mysqli_sqlstate.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_ssl_set.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_stat.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_stmt_affected_rows.phpt334
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_get.phpt78
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_set.phpt520
-rw-r--r--ext/mysqli/tests/mysqli_stmt_big_prepare.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_limits.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param.phpt744
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt630
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt92
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt380
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result.phpt596
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt284
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt454
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_stmt_close.phpt94
-rw-r--r--ext/mysqli/tests/mysqli_stmt_data_seek.phpt92
-rw-r--r--ext/mysqli/tests/mysqli_stmt_datatype_change.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_stmt_errno.phpt68
-rw-r--r--ext/mysqli/tests/mysqli_stmt_error.phpt68
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute.phpt166
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt240
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt144
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch.phpt108
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt80
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt68
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt244
-rw-r--r--ext/mysqli/tests/mysqli_stmt_field_count.phpt108
-rw-r--r--ext/mysqli/tests/mysqli_stmt_free_result.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result.phpt176
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result2.phpt280
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt208
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt242
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt382
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt84
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt202
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_types.phpt474
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_warnings.phpt96
-rw-r--r--ext/mysqli/tests/mysqli_stmt_init.phpt48
-rw-r--r--ext/mysqli/tests/mysqli_stmt_insert_id.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_stmt_multires.phpt160
-rw-r--r--ext/mysqli/tests/mysqli_stmt_num_rows.phpt196
-rw-r--r--ext/mysqli/tests/mysqli_stmt_param_count.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_stmt_prepare.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_stmt_reset.phpt126
-rw-r--r--ext/mysqli/tests/mysqli_stmt_result_metadata.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt426
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data.phpt172
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt118
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt114
-rw-r--r--ext/mysqli/tests/mysqli_stmt_sqlstate.phpt56
-rw-r--r--ext/mysqli/tests/mysqli_stmt_store_result.phpt108
-rw-r--r--ext/mysqli/tests/mysqli_stmt_unclonable.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_store_result.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_store_result_buffered_c.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_store_result_copy.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_thread_id.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_thread_safe.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_unclonable.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_use_result.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_warning_count.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_warning_unclonable.phpt30
374 files changed, 17809 insertions, 17809 deletions
diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt
index f7a72aea05..f8ddc8a38d 100644
--- a/ext/mysqli/tests/001.phpt
+++ b/ext/mysqli/tests/001.phpt
@@ -8,55 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $test = "";
-
- /*** test mysqli_connect localhost:port ***/
- $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
- $test .= ($link) ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect ***/
- $link = mysqli_init();
- $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with db ***/
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with port ***/
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- ? "1":"0";
- mysqli_close($link);
-
- /* temporary addition for Kent's setup, Win32 box */
- for ($i = 0; $i < 10; $i++) {
- if (!$link = mysqli_init())
- printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
-
- mysqli_close($link);
- }
-
- /*** test mysqli_real_connect compressed ***/
- /*
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
- ? "1" : "0";
- mysqli_close($link);
+ require_once("connect.inc");
+
+ $test = "";
+
+ /*** test mysqli_connect localhost:port ***/
+ $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
+ $test .= ($link) ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect ***/
+ $link = mysqli_init();
+ $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
+ ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect with db ***/
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect with port ***/
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ ? "1":"0";
+ mysqli_close($link);
+
+ /* temporary addition for Kent's setup, Win32 box */
+ for ($i = 0; $i < 10; $i++) {
+ if (!$link = mysqli_init())
+ printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
+
+ mysqli_close($link);
+ }
+
+ /*** test mysqli_real_connect compressed ***/
+ /*
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
+ ? "1" : "0";
+ mysqli_close($link);
*/
- /* todo ssl connections */
+ /* todo ssl connections */
- var_dump($test);
- print "done!";
+ var_dump($test);
+ print "done!";
?>
--EXPECTF--
%s(4) "1111"
diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt
index 0a40da8589..322cbb2ee3 100644
--- a/ext/mysqli/tests/002.phpt
+++ b/ext/mysqli/tests/002.phpt
@@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ /*** test mysqli_connect 127.0.0.1 ***/
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
- printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
+ printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
+ $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$rc)
+ printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
- if (!$rc)
- printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+ if (!$rc)
+ printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt
index 426fb42114..56a26602df 100644
--- a/ext/mysqli/tests/003.phpt
+++ b/ext/mysqli/tests/003.phpt
@@ -7,70 +7,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_query($link, "SET sql_mode=''");
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6)) ENGINE=" . $engine);
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp(14),
+ c4 year,
+ c5 datetime,
+ c6 timestamp(4),
+ c7 timestamp(6)) ENGINE=" . $engine);
- /*
- Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
- From the manual:
- From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
- [...]
- Display widths (used as described in the preceding section) are no longer supported.
- In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
- the display width is ignored.
- [...]
- */
- if (!$rc)
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp,
- c4 year,
- c5 datetime,
- c6 timestamp,
- c7 timestamp) ENGINE=" . $engine);
+ /*
+ Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
+ From the manual:
+ From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
+ [...]
+ Display widths (used as described in the preceding section) are no longer supported.
+ In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
+ the display width is ignored.
+ [...]
+ */
+ if (!$rc)
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp,
+ c4 year,
+ c5 datetime,
+ c6 timestamp,
+ c7 timestamp) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
- '2002-01-02',
- '12:49:00',
- '2002-01-02 17:46:59',
- 2010,
- '2010-07-10',
- '2020','1999-12-29')");
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
+ '2002-01-02',
+ '12:49:00',
+ '2002-01-02 17:46:59',
+ 2010,
+ '2010-07-10',
+ '2020','1999-12-29')");
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt
index 13572babfd..22a7712dba 100644
--- a/ext/mysqli/tests/004.phpt
+++ b/ext/mysqli/tests/004.phpt
@@ -7,48 +7,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $c1 = $c2 = NULL;
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- $i = 4;
- while ($i--) {
- mysqli_stmt_fetch($stmt);
- $test = array($c1, $c2);
- var_dump($test);
- }
+ $c1 = $c2 = NULL;
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ $i = 4;
+ while ($i--) {
+ mysqli_stmt_fetch($stmt);
+ $test = array($c1, $c2);
+ var_dump($test);
+ }
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt
index ff569211f7..ce0a9a8860 100644
--- a/ext/mysqli/tests/005.phpt
+++ b/ext/mysqli/tests/005.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $a = str_repeat("A1", 32000);
+ $a = str_repeat("A1", 32000);
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
+ mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test[] = $c1;
- $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
+ $test[] = $c1;
+ $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
- var_dump($test);
+ var_dump($test);
- /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
- mysqli_stmt_fetch($stmt);
+ /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
+ mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt
index f5dd368b0c..534ef4261f 100644
--- a/ext/mysqli/tests/006.phpt
+++ b/ext/mysqli/tests/006.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+ c2 int unsigned,
+ c3 int,
+ c4 int,
+ c5 int,
+ c6 int unsigned,
+ c7 int) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt
index a2081264e5..7e71476a3a 100644
--- a/ext/mysqli/tests/007.phpt
+++ b/ext/mysqli/tests/007.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt
index 6dfeaa5058..37b75bb5b9 100644
--- a/ext/mysqli/tests/008.phpt
+++ b/ext/mysqli/tests/008.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
+ c2 tinyint unsigned,
+ c3 tinyint not NULL,
+ c4 tinyint,
+ c5 tinyint,
+ c6 tinyint unsigned,
+ c7 tinyint) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt
index 2e24713f89..f245c71f5d 100644
--- a/ext/mysqli/tests/009.phpt
+++ b/ext/mysqli/tests/009.phpt
@@ -11,72 +11,72 @@ mysqli fetch bigint values (ok to fail with 4.1.x)
?>
--FILE--
<?php
- require_once("connect.inc");
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
- c2 bigint,
- c3 bigint not NULL,
- c4 bigint unsigned,
- c5 bigint unsigned,
- c6 bigint unsigned,
- c7 bigint unsigned,
- c8 bigint unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
- "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
- if (!$rc)
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- $rc = mysqli_stmt_fetch($stmt);
-
- if (mysqli_get_server_version($link) < 50000) {
- // 4.1 is faulty and will return big number for $c6
- if ($c6 == "18446743740376218283") {
- $c6 = 0;
- }
- }
- $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- $rc = mysqli_stmt_fetch($stmt);
-
- echo $c1, "\n", $c2, "\n";
-
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
+ c2 bigint,
+ c3 bigint not NULL,
+ c4 bigint unsigned,
+ c5 bigint unsigned,
+ c6 bigint unsigned,
+ c7 bigint unsigned,
+ c8 bigint unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
+ "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
+ if (!$rc)
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ $rc = mysqli_stmt_fetch($stmt);
+
+ if (mysqli_get_server_version($link) < 50000) {
+ // 4.1 is faulty and will return big number for $c6
+ if ($c6 == "18446743740376218283") {
+ $c6 = 0;
+ }
+ }
+ $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+
+ var_dump($test);
+
+ mysqli_stmt_close($stmt);
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ $rc = mysqli_stmt_fetch($stmt);
+
+ echo $c1, "\n", $c2, "\n";
+
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt
index 49d68df90d..0570abcc1c 100644
--- a/ext/mysqli/tests/010.phpt
+++ b/ext/mysqli/tests/010.phpt
@@ -9,44 +9,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
- c2 float,
- c3 float unsigned,
- c4 float,
- c5 float,
- c6 float,
- c7 float(10) unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
+ c2 float,
+ c3 float unsigned,
+ c4 float,
+ c5 float,
+ c6 float,
+ c7 float(10) unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
- sin(0.6), 1.00000000000001, 888888888888888)");
+ mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
+ sin(0.6), 1.00000000000001, 888888888888888)");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt
index 878c5dea62..db327e2d32 100644
--- a/ext/mysqli/tests/011.phpt
+++ b/ext/mysqli/tests/011.phpt
@@ -9,41 +9,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(50)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 float, c6 double,
+ c7 varbinary(10),
+ c8 varchar(50)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
- 2345.6,5678.89563,
- 'foobar','mysql rulez')");
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
+ 2345.6,5678.89563,
+ 'foobar','mysql rulez')");
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt
index d627e55263..89303e5789 100644
--- a/ext/mysqli/tests/012.phpt
+++ b/ext/mysqli/tests/012.phpt
@@ -9,40 +9,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(10)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 float, c6 double,
+ c7 varbinary(10),
+ c8 varchar(10)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+ 2.6,58.89,
+ '206','6.7')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt
index d21d890b1d..9a3738bd45 100644
--- a/ext/mysqli/tests/013.phpt
+++ b/ext/mysqli/tests/013.phpt
@@ -7,54 +7,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 decimal(4,2), c6 double,
- c7 varbinary(10),
- c8 varchar(10)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 decimal(4,2), c6 double,
+ c7 varbinary(10),
+ c8 varchar(10)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+ 2.6,58.89,
+ '206','6.7')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- $c = array(0,0,0,0,0,0,0,0);
- $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
+ $c = array(0,0,0,0,0,0,0,0);
+ $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "select * from test_bind_result");
- $d = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "select * from test_bind_result");
+ $d = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- $test = "";
- for ($i=0; $i < count($c); $i++)
- $test .= ($c[$i] == $d[$i]) ? "1" : "0";
- if ($test == "11111111")
- echo "ok\n";
- else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
- mysqli_get_server_version($link) > 50000)
- echo "error (4.1 library with 5.x server)";
- else
- echo "error";
+ $test = "";
+ for ($i=0; $i < count($c); $i++)
+ $test .= ($c[$i] == $d[$i]) ? "1" : "0";
+ if ($test == "11111111")
+ echo "ok\n";
+ else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
+ mysqli_get_server_version($link) > 50000)
+ echo "error (4.1 library with 5.x server)";
+ else
+ echo "error";
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt
index 335fb6eba7..bc5d906d93 100644
--- a/ext/mysqli/tests/014.phpt
+++ b/ext/mysqli/tests/014.phpt
@@ -15,66 +15,66 @@ mysqli autocommit/commit/rollback
?>
--FILE--
<?php
- require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ require_once("connect.inc");
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_autocommit($link, TRUE))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, TRUE))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, FALSE))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, FALSE))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_rollback($link))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_rollback($link))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$result = mysqli_query($link, "SELECT * FROM test"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$result = mysqli_query($link, "SELECT * FROM test"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- printf("Num_of_rows=%d\n", mysqli_num_rows($result));
- if (!$row = mysqli_fetch_row($result))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("Num_of_rows=%d\n", mysqli_num_rows($result));
+ if (!$row = mysqli_fetch_row($result))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_commit($link))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_commit($link))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$result = mysqli_query($link, "SELECT * FROM test"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$result = mysqli_query($link, "SELECT * FROM test"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_row($result))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_row($result))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- mysqli_query($link, "DROP TABLE IF EXISTS test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt
index 8901d1f175..a179e8ec5a 100644
--- a/ext/mysqli/tests/015.phpt
+++ b/ext/mysqli/tests/015.phpt
@@ -14,65 +14,65 @@ mysqli autocommit/commit/rollback with innodb
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!$link)
- printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ if (!$link)
+ printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_select_db($link, $db))
- printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_select_db($link, $db))
+ printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, TRUE))
- printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, TRUE))
+ printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
- !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
- !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
- printf("[004] Cannot create test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
+ printf("[004] Cannot create test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, FALSE))
- printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, FALSE))
+ printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test") ||
- !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[006] Cannot modify test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[006] Cannot modify test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_rollback($link))
- printf("[007] Cannot call rollback, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_rollback($link))
+ printf("[007] Cannot call rollback, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
- if (!$result)
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
+ if (!$result)
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- if (!mysqli_query($link, "DELETE FROM test") ||
- !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[009] Cannot modify test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[009] Cannot modify test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- mysqli_commit($link);
+ mysqli_commit($link);
- $result = mysqli_query($link, "SELECT * FROM test");
- if (!$result)
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test");
+ if (!$result)
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- mysqli_query($link, "DROP TABLE IF EXISTS test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt
index b534f7d455..14fa02df73 100644
--- a/ext/mysqli/tests/016.phpt
+++ b/ext/mysqli/tests/016.phpt
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET @dummy='foobar'"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET @dummy='foobar'"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $dummy);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $dummy);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- var_dump($dummy);
+ var_dump($dummy);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
string(6) "foobar"
diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt
index 7196ad48c6..0a1903abf8 100644
--- a/ext/mysqli/tests/017.phpt
+++ b/ext/mysqli/tests/017.phpt
@@ -8,28 +8,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
- $test = array($c0, $c1, $c2);
- if ($c1 !== $db) {
- echo "Different data\n";
- }
+ $test = array($c0, $c1, $c2);
+ if ($c1 !== $db) {
+ echo "Different data\n";
+ }
- var_dump($test);
- mysqli_close($link);
- print "done!";
+ var_dump($test);
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
array(3) {
diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt
index 8b3c960924..87a9746949 100644
--- a/ext/mysqli/tests/018.phpt
+++ b/ext/mysqli/tests/018.phpt
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c0);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c0);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- var_dump($c0);
+ var_dump($c0);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(0)
diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt
index 2f6276bdb6..6d64a17601 100644
--- a/ext/mysqli/tests/019.phpt
+++ b/ext/mysqli/tests/019.phpt
@@ -7,53 +7,53 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
+ mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
- $c1 = 1;
- $c2 = "foo";
- $c3 = "foobar";
- $c4 = 3.14;
+ $c1 = 1;
+ $c2 = "foo";
+ $c3 = "foobar";
+ $c4 = 3.14;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt
index daa5708ab8..a2a8782f0f 100644
--- a/ext/mysqli/tests/020.phpt
+++ b/ext/mysqli/tests/020.phpt
@@ -7,65 +7,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6))");
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp(14),
+ c4 year,
+ c5 datetime,
+ c6 timestamp(4),
+ c7 timestamp(6))");
- if (!$rc)
- $rc = mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp,
- c4 year,
- c5 datetime,
- c6 timestamp,
- c7 timestamp)");
+ if (!$rc)
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp,
+ c4 year,
+ c5 datetime,
+ c6 timestamp,
+ c7 timestamp)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
- $d1 = "2002-01-02";
- $d2 = "12:49:00";
- $d3 = "2002-01-02 17:46:59";
- $d4 = "2010";
- $d5 = "2010-07-10";
- $d6 = "2020";
- $d7 = "1999-12-29";
+ $d1 = "2002-01-02";
+ $d2 = "12:49:00";
+ $d3 = "2002-01-02 17:46:59";
+ $d4 = "2010";
+ $d5 = "2010-07-10";
+ $d6 = "2020";
+ $d7 = "1999-12-29";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
+ $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
- mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt
index d350907d93..fd2d4f0e2b 100644
--- a/ext/mysqli/tests/021.phpt
+++ b/ext/mysqli/tests/021.phpt
@@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
- $q1 = "1234567890";
- $q2 = "this is a test";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
+ $q1 = "1234567890";
+ $q2 = "this is a test";
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2);
+ $test = array($c1,$c2);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt
index dbd2905105..d591e5bae1 100644
--- a/ext/mysqli/tests/022.phpt
+++ b/ext/mysqli/tests/022.phpt
@@ -7,41 +7,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
- $a1 = "1234567890";
- $a2 = str_repeat("A1", 32000);
+ $a1 = "1234567890";
+ $a2 = str_repeat("A1", 32000);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test[] = $c1;
- $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
+ $test[] = $c1;
+ $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt
index b918aaeb67..a23e6e15ec 100644
--- a/ext/mysqli/tests/023.phpt
+++ b/ext/mysqli/tests/023.phpt
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+ c2 int unsigned,
+ c3 int,
+ c4 int,
+ c5 int,
+ c6 int unsigned,
+ c7 int)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt
index d801324738..dec1e284be 100644
--- a/ext/mysqli/tests/024.phpt
+++ b/ext/mysqli/tests/024.phpt
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt
index f0d3cd5b79..62b1590d29 100644
--- a/ext/mysqli/tests/025.phpt
+++ b/ext/mysqli/tests/025.phpt
@@ -7,55 +7,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
+ c2 tinyint unsigned,
+ c3 tinyint not NULL,
+ c4 tinyint,
+ c5 tinyint,
+ c6 tinyint unsigned,
+ c7 tinyint)");
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 300;
- $c3 = 0;
- $c4 = -100;
- $c5 = -127;
- $c6 = 30;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 300;
+ $c3 = 0;
+ $c4 = -100;
+ $c5 = -127;
+ $c6 = 30;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
+ mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
- $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
+ $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt
index 8d9d9140a6..7f9a9bd4b8 100644
--- a/ext/mysqli/tests/026.phpt
+++ b/ext/mysqli/tests/026.phpt
@@ -7,42 +7,42 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
+ $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
- $c1 = "Hello World";
+ $c1 = "Hello World";
- mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
- mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
- mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $d1, $d2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $d1, $d2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($d1,$d2);
+ $test = array($d1,$d2);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt
index f4d985a744..918a6c4483 100644
--- a/ext/mysqli/tests/027.phpt
+++ b/ext/mysqli/tests/027.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $status = mysqli_stat($link);
+ $status = mysqli_stat($link);
- var_dump(strlen($status) > 0);
+ var_dump(strlen($status) > 0);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt
index e8d3835374..9b71d4d3da 100644
--- a/ext/mysqli/tests/028.phpt
+++ b/ext/mysqli/tests/028.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $cset = substr(mysqli_character_set_name($link),0,6);
+ $cset = substr(mysqli_character_set_name($link),0,6);
- var_dump($cset);
+ var_dump($cset);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(%d) "%s"
diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt
index b2409e976b..769f3753f4 100644
--- a/ext/mysqli/tests/029.phpt
+++ b/ext/mysqli/tests/029.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_query($link, "CREATE TABLE general_test (a INT)");
- mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_query($link, "CREATE TABLE general_test (a INT)");
+ mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
- $afc = mysqli_affected_rows($link);
+ $afc = mysqli_affected_rows($link);
- var_dump($afc);
+ var_dump($afc);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt
index e51aec3734..5705a90f91 100644
--- a/ext/mysqli/tests/030.phpt
+++ b/ext/mysqli/tests/030.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $errno = mysqli_errno($link);
- var_dump($errno);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $errno = mysqli_errno($link);
+ var_dump($errno);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SELECT * FROM non_exisiting_table");
- $errno = mysqli_errno($link);
+ mysqli_query($link, "SELECT * FROM non_exisiting_table");
+ $errno = mysqli_errno($link);
- var_dump($errno);
+ var_dump($errno);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(0)
diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt
index 8518b45a3e..e230e7974c 100644
--- a/ext/mysqli/tests/031.phpt
+++ b/ext/mysqli/tests/031.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $error = mysqli_error($link);
- var_dump($error);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $error = mysqli_error($link);
+ var_dump($error);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SELECT * FROM non_exisiting_table");
- $error = mysqli_error($link);
+ mysqli_query($link, "SELECT * FROM non_exisiting_table");
+ $error = mysqli_error($link);
- var_dump($error);
+ var_dump($error);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(0) ""
diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt
index 5347a33f68..ea7d13bc9b 100644
--- a/ext/mysqli/tests/032.phpt
+++ b/ext/mysqli/tests/032.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_query($link, "CREATE TABLE general_test (a INT)");
- mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_query($link, "CREATE TABLE general_test (a INT)");
+ mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
- $afc = mysqli_info($link);
+ $afc = mysqli_info($link);
- var_dump($afc);
+ var_dump($afc);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt
index 2ac4896432..b5c4e3046b 100644
--- a/ext/mysqli/tests/033.phpt
+++ b/ext/mysqli/tests/033.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $hinfo = mysqli_get_host_info($link);
+ $hinfo = mysqli_get_host_info($link);
- var_dump(str_replace('/','', $hinfo));
+ var_dump(str_replace('/','', $hinfo));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(%d) "%s via %s"
diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt
index 1eae37e1a5..f6e19ce551 100644
--- a/ext/mysqli/tests/034.phpt
+++ b/ext/mysqli/tests/034.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $pinfo = mysqli_get_proto_info($link);
+ $pinfo = mysqli_get_proto_info($link);
- var_dump($pinfo);
+ var_dump($pinfo);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(10)
diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt
index 8e755b9846..0f2421f629 100644
--- a/ext/mysqli/tests/035.phpt
+++ b/ext/mysqli/tests/035.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $sinfo = substr(mysqli_get_server_info($link),0,1);
+ $sinfo = substr(mysqli_get_server_info($link),0,1);
- var_dump(strlen($sinfo));
+ var_dump(strlen($sinfo));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(1)
diff --git a/ext/mysqli/tests/036.phpt b/ext/mysqli/tests/036.phpt
index e0b5375ff7..04fa7023be 100644
--- a/ext/mysqli/tests/036.phpt
+++ b/ext/mysqli/tests/036.phpt
@@ -11,36 +11,36 @@ function test: mysqli_insert_id()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS t036");
- mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS t036");
+ mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
- $test[] = mysqli_insert_id($link);
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
+ $test[] = mysqli_insert_id($link);
- /* we have to insert more values, cause lexer sets auto_increment to max_int
- see mysql bug #54. So we don't check for the value, only for type (which must
- be type string)
- */
+ /* we have to insert more values, cause lexer sets auto_increment to max_int
+ see mysql bug #54. So we don't check for the value, only for type (which must
+ be type string)
+ */
- mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
- $x = mysqli_insert_id($link);
- $test[] = is_string($x);
+ mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
+ $x = mysqli_insert_id($link);
+ $test[] = is_string($x);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS t036");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS t036");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt
index dece211f0f..93b2ceace6 100644
--- a/ext/mysqli/tests/037.phpt
+++ b/ext/mysqli/tests/037.phpt
@@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- $ir[] = mysqli_field_count($link);
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ $ir[] = mysqli_field_count($link);
- mysqli_real_query($link, "SELECT * FROM test_result");
- $ir[] = mysqli_field_count($link);
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ $ir[] = mysqli_field_count($link);
- var_dump($ir);
+ var_dump($ir);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt
index f2fcbf69ee..9719d93049 100644
--- a/ext/mysqli/tests/038.phpt
+++ b/ext/mysqli/tests/038.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_fields($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/039.phpt
index bde6460d97..186811660d 100644
--- a/ext/mysqli/tests/039.phpt
+++ b/ext/mysqli/tests/039.phpt
@@ -7,23 +7,23 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_real_query($link, "SHOW VARIABLES");
+ mysqli_real_query($link, "SHOW VARIABLES");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_fields($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(2)
diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt
index 1e9ec7c22b..04d839408e 100644
--- a/ext/mysqli/tests/040.phpt
+++ b/ext/mysqli/tests/040.phpt
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_rows($result);
- mysqli_free_result($result);
- }
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_rows($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt
index 903277d8c8..d64739d79e 100644
--- a/ext/mysqli/tests/041.phpt
+++ b/ext/mysqli/tests/041.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
- mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
- var_dump(mysqli_warning_count($link));
+ var_dump(mysqli_warning_count($link));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/042.phpt b/ext/mysqli/tests/042.phpt
index 9fa55ce300..3545ed06c1 100644
--- a/ext/mysqli/tests/042.phpt
+++ b/ext/mysqli/tests/042.phpt
@@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint) ENGINE=" . $engine);
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint) ENGINE=" . $engine);
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "SELECT * FROM test_bind_fetch");
- $test = mysqli_fetch_object($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test_bind_fetch");
+ $test = mysqli_fetch_object($result);
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!"
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!"
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/043.phpt b/ext/mysqli/tests/043.phpt
index d13d552341..adcf502dc7 100644
--- a/ext/mysqli/tests/043.phpt
+++ b/ext/mysqli/tests/043.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_update");
- mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
- b int) ENGINE=" . $engine);
+ mysqli_query($link,"DROP TABLE IF EXISTS test_update");
+ mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
+ b int) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
+ mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
- $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
- mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3);
+ $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
+ mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3);
- $c1 = "Rasmus";
- $c2 = 1;
- $c3 = 2;
+ $c1 = "Rasmus";
+ $c2 = 1;
+ $c3 = 2;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
- $test = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
+ $test = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS test_update");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_update");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/044.phpt
index 7dbbbb20a2..91d93d7482 100644
--- a/ext/mysqli/tests/044.phpt
+++ b/ext/mysqli/tests/044.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $i = mysqli_get_server_version($link);
+ $i = mysqli_get_server_version($link);
- $test = $i / $i;
+ $test = $i / $i;
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(1)
diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt
index 7c357a54af..c69d6833e6 100644
--- a/ext/mysqli/tests/045.phpt
+++ b/ext/mysqli/tests/045.phpt
@@ -20,23 +20,23 @@ mysqli_stmt_bind_result (SHOW)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- $test = array ($c1,$c2);
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
+ $test = array ($c1,$c2);
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/046.phpt b/ext/mysqli/tests/046.phpt
index 3a7c2d9340..998136dee1 100644
--- a/ext/mysqli/tests/046.phpt
+++ b/ext/mysqli/tests/046.phpt
@@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
+ mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
- $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
- mysqli_stmt_bind_param($stmt, "i", $c1);
+ $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
+ mysqli_stmt_bind_param($stmt, "i", $c1);
- $c1 = 2;
+ $c1 = 2;
- mysqli_stmt_execute($stmt);
- $x = mysqli_stmt_affected_rows($stmt);
+ mysqli_stmt_execute($stmt);
+ $x = mysqli_stmt_affected_rows($stmt);
- mysqli_stmt_close($stmt);
- var_dump($x==1);
+ mysqli_stmt_close($stmt);
+ var_dump($x==1);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt
index 14b0612d78..376bcb59c5 100644
--- a/ext/mysqli/tests/047.phpt
+++ b/ext/mysqli/tests/047.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
+ mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
- mysqli_stmt_execute($stmt);
- $result = mysqli_stmt_result_metadata($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
+ mysqli_stmt_execute($stmt);
+ $result = mysqli_stmt_result_metadata($stmt);
- echo "\n=== fetch_fields ===\n";
- var_dump(mysqli_fetch_fields($result));
+ echo "\n=== fetch_fields ===\n";
+ var_dump(mysqli_fetch_fields($result));
- echo "\n=== fetch_field_direct ===\n";
- var_dump(mysqli_fetch_field_direct($result, 0));
- var_dump(mysqli_fetch_field_direct($result, 1));
+ echo "\n=== fetch_field_direct ===\n";
+ var_dump(mysqli_fetch_field_direct($result, 0));
+ var_dump(mysqli_fetch_field_direct($result, 1));
- echo "\n=== fetch_field ===\n";
- while ($field = mysqli_fetch_field($result)) {
- var_dump($field);
- }
+ echo "\n=== fetch_field ===\n";
+ while ($field = mysqli_fetch_field($result)) {
+ var_dump($field);
+ }
- print_r(mysqli_fetch_lengths($result));
+ print_r(mysqli_fetch_lengths($result));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt
index 9df8005b38..be5f5a79f1 100644
--- a/ext/mysqli/tests/048.phpt
+++ b/ext/mysqli/tests/048.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db($db);
- $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
+ $mysql->select_db($db);
+ $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
- $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
+ $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
- $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+ $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
- $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
- $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- $stmt->execute();
+ $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
+ $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ $stmt->execute();
- $stmt->fetch();
+ $stmt->fetch();
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- $stmt->close();
- $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
- $mysql->close();
- print "done!";
+ $stmt->close();
+ $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt
index 7128de8d38..733518609f 100644
--- a/ext/mysqli/tests/049.phpt
+++ b/ext/mysqli/tests/049.phpt
@@ -8,22 +8,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db($db);
- $result = $mysql->query("SELECT DATABASE()");
- $row = $result->fetch_row();
- $result->close();
+ $mysql->select_db($db);
+ $result = $mysql->query("SELECT DATABASE()");
+ $row = $result->fetch_row();
+ $result->close();
- var_dump($row);
- if ($row[0] != $db)
- printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]);
+ var_dump($row);
+ if ($row[0] != $db)
+ printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]);
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECTF--
array(1) {
diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt
index 448f164be1..c51c7bc1d2 100644
--- a/ext/mysqli/tests/050.phpt
+++ b/ext/mysqli/tests/050.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * non freed stamement
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * non freed stamement
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ mysqli_stmt_execute($stmt);
- mysqli_close($link);
- printf("Ok\n");
+ mysqli_close($link);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt
index 4a766fb34d..239f8cbcf0 100644
--- a/ext/mysqli/tests/051.phpt
+++ b/ext/mysqli/tests/051.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * free statement after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * free statement after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_stmt_execute($stmt1);
+ $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ mysqli_stmt_execute($stmt1);
- mysqli_close($link);
- @mysqli_stmt_close($stmt1);
- printf("Ok\n");
+ mysqli_close($link);
+ @mysqli_stmt_close($stmt1);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt
index 1d131f1428..e079bc508b 100644
--- a/ext/mysqli/tests/052.phpt
+++ b/ext/mysqli/tests/052.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * statement call after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * statement call after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- @mysqli_stmt_execute($stmt2);
- @mysqli_stmt_close($stmt2);
- printf("Ok\n");
+ mysqli_close($link);
+ @mysqli_stmt_execute($stmt2);
+ @mysqli_stmt_close($stmt2);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt
index a1840c9726..4aac61514a 100644
--- a/ext/mysqli/tests/053.phpt
+++ b/ext/mysqli/tests/053.phpt
@@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * non freed resultset
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * non freed resultset
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- printf("Ok\n");
+ $result = mysqli_query($link, "SELECT CURRENT_USER()");
+ mysqli_close($link);
+ printf("Ok\n");
?>
--EXPECT--
diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt
index 6bd45a7c4b..b06d5edc3a 100644
--- a/ext/mysqli/tests/054.phpt
+++ b/ext/mysqli/tests/054.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * free resultset after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * free resultset after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- mysqli_free_result($result1);
- printf("Ok\n");
+ $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
+ mysqli_close($link);
+ mysqli_free_result($result1);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt
index c73266e748..7b6339afaf 100644
--- a/ext/mysqli/tests/055.phpt
+++ b/ext/mysqli/tests/055.phpt
@@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * don't free anything
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * don't free anything
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- printf("Ok\n");
+ $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
+ $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt
index 413e678987..9bb3a0eba9 100644
--- a/ext/mysqli/tests/056.phpt
+++ b/ext/mysqli/tests/056.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class foobar extends mysqli {
- function test () {
- return ("I do not like MySQL 4.1");
- }
- }
+ class foobar extends mysqli {
+ function test () {
+ return ("I do not like MySQL 4.1");
+ }
+ }
- $foo = new foobar();
- $foo->connect($host, $user, $passwd, $db, $port, $socket);
- $foo->close();
- printf("%s\n", $foo->test());
+ $foo = new foobar();
+ $foo->connect($host, $user, $passwd, $db, $port, $socket);
+ $foo->close();
+ printf("%s\n", $foo->test());
?>
--EXPECT--
I do not like MySQL 4.1
diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt
index 92f7e767d1..09dcf9cfde 100644
--- a/ext/mysqli/tests/057.phpt
+++ b/ext/mysqli/tests/057.phpt
@@ -7,60 +7,60 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
- mysqli_query($link,"CREATE TABLE test_store_result (a int)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
+ mysqli_query($link,"CREATE TABLE test_store_result (a int)");
- mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
+ mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ mysqli_stmt_execute($stmt);
- /* this should produce an out of sync error */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- mysqli_free_result($result);
- printf ("Query ok\n");
- }
- mysqli_stmt_close($stmt);
+ /* this should produce an out of sync error */
+ if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
+ mysqli_free_result($result);
+ printf ("Query ok\n");
+ }
+ mysqli_stmt_close($stmt);
- /* now we should try mysqli_stmt_reset() */
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- var_dump(mysqli_stmt_execute($stmt));
- var_dump(mysqli_stmt_reset($stmt));
+ /* now we should try mysqli_stmt_reset() */
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump(mysqli_stmt_reset($stmt));
- var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
- if ($stmt->affected_rows !== 0)
- printf("[001] Expecting 0, got %d\n", $stmt->affected_rows);
+ var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
+ if ($stmt->affected_rows !== 0)
+ printf("[001] Expecting 0, got %d\n", $stmt->affected_rows);
- var_dump(mysqli_stmt_execute($stmt));
- var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
- var_dump(mysqli_stmt_reset($stmt));
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
+ var_dump(mysqli_stmt_reset($stmt));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_stmt_execute($stmt);
- $result1 = mysqli_stmt_result_metadata($stmt);
- mysqli_stmt_store_result($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ mysqli_stmt_execute($stmt);
+ $result1 = mysqli_stmt_result_metadata($stmt);
+ mysqli_stmt_store_result($stmt);
- printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt));
+ printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt));
- /* this should show an error, cause results are not buffered */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
- }
+ /* this should show an error, cause results are not buffered */
+ if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
+ }
- var_dump($row);
+ var_dump($row);
- mysqli_free_result($result1);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- echo "done!";
+ mysqli_free_result($result1);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ echo "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/058.phpt b/ext/mysqli/tests/058.phpt
index d56ea50722..541be1ede4 100644
--- a/ext/mysqli/tests/058.phpt
+++ b/ext/mysqli/tests/058.phpt
@@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS mbind");
- mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
+ mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+ mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
- $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)");
+ $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "is", $a, $b);
+ mysqli_stmt_bind_param($stmt, "is", $a, $b);
- $a = 1;
- $b = "foo";
+ $a = 1;
+ $b = "foo";
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_param($stmt, "is", $c, $d);
+ mysqli_stmt_bind_param($stmt, "is", $c, $d);
- $c = 2;
- $d = "bar";
+ $c = 2;
+ $d = "bar";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $e, $f);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $e, $f);
+ mysqli_stmt_fetch($stmt);
- mysqli_stmt_bind_result($stmt, $g, $h);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $g, $h);
+ mysqli_stmt_fetch($stmt);
- var_dump((array($e,$f,$g,$h)));
+ var_dump((array($e,$f,$g,$h)));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/059.phpt b/ext/mysqli/tests/059.phpt
index 3faf5b9332..7168f6f8fa 100644
--- a/ext/mysqli/tests/059.phpt
+++ b/ext/mysqli/tests/059.phpt
@@ -7,39 +7,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
+ mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
- mysqli_query($link,"DROP TABLE IF EXISTS mbind");
- mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
+ mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+ mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
- $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
+ $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
- mysqli_stmt_bind_param($stmt, "ss", $a, $b);
+ mysqli_stmt_bind_param($stmt, "ss", $a, $b);
- $a = "foo";
- $b = "bar";
+ $a = "foo";
+ $b = "bar";
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $e);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $e);
+ mysqli_stmt_fetch($stmt);
- var_dump($e);
+ var_dump($e);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/060.phpt b/ext/mysqli/tests/060.phpt
index 0268339b3d..c5a77ec16d 100644
--- a/ext/mysqli/tests/060.phpt
+++ b/ext/mysqli/tests/060.phpt
@@ -7,40 +7,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class test_class {
- function __construct($arg1, $arg2) {
- echo __METHOD__ . "($arg1,$arg2)\n";
- }
- }
+ class test_class {
+ function __construct($arg1, $arg2) {
+ echo __METHOD__ . "($arg1,$arg2)\n";
+ }
+ }
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_fetch");
- mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_fetch");
+ mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint)");
- mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)");
+ mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)");
- $result = mysqli_query($link, "SELECT * FROM test_fetch");
- $test = mysqli_fetch_object($result, 'test_class', array(1, 2));
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test_fetch");
+ $test = mysqli_fetch_object($result, 'test_class', array(1, 2));
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
+ mysqli_close($link);
- echo "Done\n";
+ echo "Done\n";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/061.phpt b/ext/mysqli/tests/061.phpt
index 76a40c704e..151d312493 100644
--- a/ext/mysqli/tests/061.phpt
+++ b/ext/mysqli/tests/061.phpt
@@ -68,7 +68,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS t_061"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
diff --git a/ext/mysqli/tests/062.phpt b/ext/mysqli/tests/062.phpt
index b10485d5a2..60472eb16e 100644
--- a/ext/mysqli/tests/062.phpt
+++ b/ext/mysqli/tests/062.phpt
@@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->real_query("SELECT 'foo' FROM DUAL");
+ $mysql->real_query("SELECT 'foo' FROM DUAL");
- $myresult = new mysqli_result($mysql);
+ $myresult = new mysqli_result($mysql);
- $row = $myresult->fetch_row();
- $myresult->close();
- $mysql->close();
+ $row = $myresult->fetch_row();
+ $myresult->close();
+ $mysql->close();
- var_dump($row);
- print "done!";
+ var_dump($row);
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/063.phpt b/ext/mysqli/tests/063.phpt
index b1d5314278..26bfe48ee5 100644
--- a/ext/mysqli/tests/063.phpt
+++ b/ext/mysqli/tests/063.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($foo);
- $stmt->fetch();
- $stmt->close();
- $mysql->close();
+ $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
+ $stmt->execute();
+ $stmt->bind_result($foo);
+ $stmt->fetch();
+ $stmt->close();
+ $mysql->close();
- var_dump($foo);
+ var_dump($foo);
?>
--EXPECT--
string(3) "foo"
diff --git a/ext/mysqli/tests/064.phpt b/ext/mysqli/tests/064.phpt
index 46af7a6628..b2280ff426 100644
--- a/ext/mysqli/tests/064.phpt
+++ b/ext/mysqli/tests/064.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($foo);
- $stmt->fetch();
- $stmt->close();
- $mysql->close();
+ $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL");
+ $stmt->execute();
+ $stmt->bind_result($foo);
+ $stmt->fetch();
+ $stmt->close();
+ $mysql->close();
- var_dump($foo);
+ var_dump($foo);
?>
--EXPECT--
NULL
diff --git a/ext/mysqli/tests/065.phpt b/ext/mysqli/tests/065.phpt
index 8c11846a8f..9b18d33459 100644
--- a/ext/mysqli/tests/065.phpt
+++ b/ext/mysqli/tests/065.phpt
@@ -11,42 +11,42 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($mysql, "SET sql_mode=''"))
- printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
+ if (!mysqli_query($mysql, "SET sql_mode=''"))
+ printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
- $esc_str = chr(0xbf) . chr(0x5c);
- $len = $charset = array();
- $tmp = null;
+ $esc_str = chr(0xbf) . chr(0x5c);
+ $len = $charset = array();
+ $tmp = null;
- if ($mysql->set_charset("latin1")) {
- /* 5C should be escaped */
- if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
- printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp);
+ if ($mysql->set_charset("latin1")) {
+ /* 5C should be escaped */
+ if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
+ printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp);
- if ('latin1' !== ($tmp = $mysql->character_set_name()))
- printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp);
- }
+ if ('latin1' !== ($tmp = $mysql->character_set_name()))
+ printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp);
+ }
- if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) {
- $res->free_result();
- if ($mysql->set_charset("gbk")) {
- /* nothing should be escaped, it's a valid gbk character */
+ if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) {
+ $res->free_result();
+ if ($mysql->set_charset("gbk")) {
+ /* nothing should be escaped, it's a valid gbk character */
- if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
- printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
+ printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp);
- if ('gbk' !== ($tmp = $mysql->character_set_name()))
- printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);
- }
- }
- $mysql->close();
+ if ('gbk' !== ($tmp = $mysql->character_set_name()))
+ printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);
+ }
+ }
+ $mysql->close();
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/066.phpt b/ext/mysqli/tests/066.phpt
index 0089210718..535d01d224 100644
--- a/ext/mysqli/tests/066.phpt
+++ b/ext/mysqli/tests/066.phpt
@@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($mysql, "SET sql_mode=''"))
- printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
+ if (!mysqli_query($mysql, "SET sql_mode=''"))
+ printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
- $mysql->query("DROP TABLE IF EXISTS test_warnings");
+ $mysql->query("DROP TABLE IF EXISTS test_warnings");
- $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
+ $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
- $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
+ $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
- if (($warning = $mysql->get_warnings())) {
- do {
- printf("Warning\n");
- } while ($warning->next());
- }
+ if (($warning = $mysql->get_warnings())) {
+ do {
+ printf("Warning\n");
+ } while ($warning->next());
+ }
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/067.phpt b/ext/mysqli/tests/067.phpt
index 1ab9ed5320..71ea9c5e5d 100644
--- a/ext/mysqli/tests/067.phpt
+++ b/ext/mysqli/tests/067.phpt
@@ -19,50 +19,50 @@ function test: nested selects (cursors)
?>
--FILE--
<?php
- function open_cursor($mysql, $query) {
- if (!is_object($stmt = $mysql->prepare($query))) {
- printf("[001] Cannot create statement object for '%s', [%d] %s\n",
- $query, $mysql->errno, $mysql->error);
- }
+ function open_cursor($mysql, $query) {
+ if (!is_object($stmt = $mysql->prepare($query))) {
+ printf("[001] Cannot create statement object for '%s', [%d] %s\n",
+ $query, $mysql->errno, $mysql->error);
+ }
- $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
- return $stmt;
- }
+ $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
+ return $stmt;
+ }
- require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ require_once("connect.inc");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) ||
- (mysqli_get_server_version($mysql) < 50009)) {
- /* we really want to skip it... */
- die(var_dump(63));
- }
+ if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) ||
+ (mysqli_get_server_version($mysql) < 50009)) {
+ /* we really want to skip it... */
+ die(var_dump(63));
+ }
- $a = array();
+ $a = array();
- for ($i=0;$i < 3; $i++) {
- $mysql->query("DROP TABLE IF EXISTS cursor$i");
- $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine);
- $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)");
- $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i");
- $stmt[$i]->execute();
- $stmt[$i]->bind_result($a[$i]);
- }
+ for ($i=0;$i < 3; $i++) {
+ $mysql->query("DROP TABLE IF EXISTS cursor$i");
+ $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine);
+ $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)");
+ $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i");
+ $stmt[$i]->execute();
+ $stmt[$i]->bind_result($a[$i]);
+ }
- $cnt = 0;
- while ($stmt[0]->fetch()) {
- $stmt[1]->fetch();
- $stmt[2]->fetch();
- $cnt += $a[0] + $a[1] + $a[2];
- }
+ $cnt = 0;
+ while ($stmt[0]->fetch()) {
+ $stmt[1]->fetch();
+ $stmt[2]->fetch();
+ $cnt += $a[0] + $a[1] + $a[2];
+ }
- for ($i=0; $i < 3; $i++) {
- $stmt[$i]->close();
- }
+ for ($i=0; $i < 3; $i++) {
+ $stmt[$i]->close();
+ }
- $mysql->close();
- var_dump($cnt);
+ $mysql->close();
+ var_dump($cnt);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/068.phpt b/ext/mysqli/tests/068.phpt
index 17160f78f1..24a4255483 100644
--- a/ext/mysqli/tests/068.phpt
+++ b/ext/mysqli/tests/068.phpt
@@ -4,8 +4,8 @@ mysqli get_client_info
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- $s = mysqli_get_client_info();
- echo gettype($s);
+ $s = mysqli_get_client_info();
+ echo gettype($s);
?>
--EXPECT--
string
diff --git a/ext/mysqli/tests/069.phpt b/ext/mysqli/tests/069.phpt
index 29ed2fd94a..9f1d0b447e 100644
--- a/ext/mysqli/tests/069.phpt
+++ b/ext/mysqli/tests/069.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- if (!$mysql->more_results()) {
- break;
- }
- } while (@$mysql->next_result());
- $mysql->close();
- print "done!";
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ if (!$mysql->more_results()) {
+ break;
+ }
+ } while (@$mysql->next_result());
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/070.phpt b/ext/mysqli/tests/070.phpt
index 6452d6ab78..a9832815da 100644
--- a/ext/mysqli/tests/070.phpt
+++ b/ext/mysqli/tests/070.phpt
@@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump($mysql->ping());
- $mysql->close();
- print "done!";
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ var_dump($mysql->ping());
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/071.phpt b/ext/mysqli/tests/071.phpt
index 48b719c629..0a1e4ce62e 100644
--- a/ext/mysqli/tests/071.phpt
+++ b/ext/mysqli/tests/071.phpt
@@ -8,63 +8,63 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $version = $mysql->server_version;
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $version = $mysql->server_version;
- var_dump($mysql->ping());
+ var_dump($mysql->ping());
- $ret = $mysql->kill($mysql->thread_id);
- if ($IS_MYSQLND) {
- if ($ret !== true){
- printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
- }
- } else {
- /* libmysql return value seems to depend on server version */
- if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
- /* TODO: find exact version */
- if ($ret !== true){
- printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- } else {
- if ($ret !== false){
- printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- }
- }
+ $ret = $mysql->kill($mysql->thread_id);
+ if ($IS_MYSQLND) {
+ if ($ret !== true){
+ printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
+ }
+ } else {
+ /* libmysql return value seems to depend on server version */
+ if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
+ /* TODO: find exact version */
+ if ($ret !== true){
+ printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ } else {
+ if ($ret !== false){
+ printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ }
+ }
- var_dump($mysql->ping());
+ var_dump($mysql->ping());
- $mysql->close();
+ $mysql->close();
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump(mysqli_ping($mysql));
+ var_dump(mysqli_ping($mysql));
- $ret = $mysql->kill($mysql->thread_id);
- if ($IS_MYSQLND) {
- if ($ret !== true){
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
- }
- } else {
- /* libmysql return value seems to depend on server version */
- if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
- /* TODO: find exact version */
- if ($ret !== true){
- printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- } else {
- if ($ret !== false){
- printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- }
- }
+ $ret = $mysql->kill($mysql->thread_id);
+ if ($IS_MYSQLND) {
+ if ($ret !== true){
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
+ }
+ } else {
+ /* libmysql return value seems to depend on server version */
+ if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
+ /* TODO: find exact version */
+ if ($ret !== true){
+ printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ } else {
+ if ($ret !== false){
+ printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ }
+ }
- var_dump(mysqli_ping($mysql));
+ var_dump(mysqli_ping($mysql));
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/072.phpt b/ext/mysqli/tests/072.phpt
index 997469d39c..cb4ff60a86 100644
--- a/ext/mysqli/tests/072.phpt
+++ b/ext/mysqli/tests/072.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS not_exists");
+ $mysql->query("DROP TABLE IF EXISTS not_exists");
- var_dump($mysql->warning_count);
+ var_dump($mysql->warning_count);
- $w = $mysql->get_warnings();
+ $w = $mysql->get_warnings();
- var_dump($w->errno);
- var_dump($w->message);
- var_dump($w->sqlstate);
+ var_dump($w->errno);
+ var_dump($w->message);
+ var_dump($w->sqlstate);
- $mysql->close();
- echo "done!"
+ $mysql->close();
+ echo "done!"
?>
--EXPECTF--
int(1)
diff --git a/ext/mysqli/tests/073.phpt b/ext/mysqli/tests/073.phpt
index 86e54ffc93..09156532d8 100644
--- a/ext/mysqli/tests/073.phpt
+++ b/ext/mysqli/tests/073.phpt
@@ -4,15 +4,15 @@ mysqli_driver properties
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- var_dump($driver->embedded);
- var_dump($driver->client_version);
- var_dump($driver->client_info);
- var_dump($driver->driver_version);
- var_dump($driver->reconnect);
- var_dump($driver->report_mode);
- print "done!";
+ var_dump($driver->embedded);
+ var_dump($driver->client_version);
+ var_dump($driver->client_info);
+ var_dump($driver->driver_version);
+ var_dump($driver->reconnect);
+ var_dump($driver->report_mode);
+ print "done!";
?>
--EXPECTF--
bool(%s)
diff --git a/ext/mysqli/tests/074.phpt b/ext/mysqli/tests/074.phpt
index a10f11136b..3f1271130f 100644
--- a/ext/mysqli/tests/074.phpt
+++ b/ext/mysqli/tests/074.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump($mysqli->autocommit(false));
- $result = $mysqli->query("SELECT @@autocommit");
- var_dump($result->fetch_row());
+ var_dump($mysqli->autocommit(false));
+ $result = $mysqli->query("SELECT @@autocommit");
+ var_dump($result->fetch_row());
- var_dump($mysqli->autocommit(true));
- $result = $mysqli->query("SELECT @@autocommit");
- var_dump($result->fetch_row());
+ var_dump($mysqli->autocommit(true));
+ $result = $mysqli->query("SELECT @@autocommit");
+ var_dump($result->fetch_row());
?>
--EXPECT--
diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt
index 1837048517..89b441d034 100644
--- a/ext/mysqli/tests/bug28817.phpt
+++ b/ext/mysqli/tests/bug28817.phpt
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class my_mysql extends mysqli {
- public $p_test;
+ class my_mysql extends mysqli {
+ public $p_test;
- function __construct() {
- $this->p_test[] = "foo";
- $this->p_test[] = "bar";
- }
- }
+ function __construct() {
+ $this->p_test[] = "foo";
+ $this->p_test[] = "bar";
+ }
+ }
- $mysql = new my_mysql();
+ $mysql = new my_mysql();
- var_dump($mysql->p_test);
- var_dump($mysql->errno);
+ var_dump($mysql->p_test);
+ var_dump($mysql->errno);
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db("nonexistingdb");
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql->select_db("nonexistingdb");
- var_dump($mysql->errno > 0);
+ var_dump($mysql->errno > 0);
- $mysql->close();
+ $mysql->close();
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt
index cfd5235e2b..a5808418bf 100644
--- a/ext/mysqli/tests/bug29311.phpt
+++ b/ext/mysqli/tests/bug29311.phpt
@@ -7,45 +7,45 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- /* class 1 calls parent constructor */
- class mysql1 extends mysqli {
- function __construct() {
- global $host, $user, $passwd, $db, $port, $socket;
- parent::__construct($host, $user, $passwd, $db, $port, $socket);
- }
- }
-
- /* class 2 has an own constructor */
- class mysql2 extends mysqli {
-
- function __construct() {
- global $host, $user, $passwd, $db, $port, $socket;
- $this->connect($host, $user, $passwd, $db, $port, $socket);
- }
- }
-
- /* class 3 has no constructor */
- class mysql3 extends mysqli {
-
- }
-
- $foo[0] = new mysql1();
- $foo[1] = new mysql2();
- $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket);
-
-
- for ($i=0; $i < 3; $i++) {
- if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
- $row = $result->fetch_row();
- if ($row[0] != $db)
- printf("%d: %s\n", $i, $row[0]);
- $result->close();
- }
- $foo[$i]->close();
- }
- print "done!";
+ require_once("connect.inc");
+
+ /* class 1 calls parent constructor */
+ class mysql1 extends mysqli {
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 2 has an own constructor */
+ class mysql2 extends mysqli {
+
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ $this->connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 3 has no constructor */
+ class mysql3 extends mysqli {
+
+ }
+
+ $foo[0] = new mysql1();
+ $foo[1] = new mysql2();
+ $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket);
+
+
+ for ($i=0; $i < 3; $i++) {
+ if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
+ $row = $result->fetch_row();
+ if ($row[0] != $db)
+ printf("%d: %s\n", $i, $row[0]);
+ $result->close();
+ }
+ $foo[$i]->close();
+ }
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt
index 9af81ea12a..9e68a0caec 100644
--- a/ext/mysqli/tests/bug30967.phpt
+++ b/ext/mysqli/tests/bug30967.phpt
@@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class mysql1 extends mysqli {
- }
+ class mysql1 extends mysqli {
+ }
- class mysql2 extends mysql1 {
- }
+ class mysql2 extends mysql1 {
+ }
- $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("THIS DOES NOT WORK");
- printf("%d\n", $mysql->errno);
+ $mysql->query("THIS DOES NOT WORK");
+ printf("%d\n", $mysql->errno);
- $mysql->close();
+ $mysql->close();
?>
--EXPECT--
1064
diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt
index 71834742a9..9894896dd5 100644
--- a/ext/mysqli/tests/bug31141.phpt
+++ b/ext/mysqli/tests/bug31141.phpt
@@ -6,13 +6,13 @@ Bug #31141 (properties declared in the class extending MySQLi are not available)
<?php
class Test extends mysqli
{
- public $test = array();
+ public $test = array();
- function foo()
- {
- $ar_test = array("foo", "bar");
- $this->test = &$ar_test;
- }
+ function foo()
+ {
+ $ar_test = array("foo", "bar");
+ $this->test = &$ar_test;
+ }
}
$my_test = new Test;
diff --git a/ext/mysqli/tests/bug31668.phpt b/ext/mysqli/tests/bug31668.phpt
index 40bf357b6a..1dad169cc8 100644
--- a/ext/mysqli/tests/bug31668.phpt
+++ b/ext/mysqli/tests/bug31668.phpt
@@ -7,34 +7,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- } while ($mysql->next_result());
- var_dump($mysql->error, __LINE__);
- $mysql->close();
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
+ $mysql->close();
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- } while ($mysql->next_result());
- var_dump($mysql->error, __LINE__);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
?>
--EXPECTF--
array(1) {
diff --git a/ext/mysqli/tests/bug32405.phpt b/ext/mysqli/tests/bug32405.phpt
index 84ec9fd963..af41924c37 100644
--- a/ext/mysqli/tests/bug32405.phpt
+++ b/ext/mysqli/tests/bug32405.phpt
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
- mysqli_query($link, "SET sql_mode=''");
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, "test");
+ mysqli_query($link, "SET sql_mode=''");
- /* two fields are needed. the problem does not occur with 1 field only selected. */
- $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))");
- $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")');
+ /* two fields are needed. the problem does not occur with 1 field only selected. */
+ $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))");
+ $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")');
- if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) {
- $stmt->execute();
- $stmt->bind_result($col1, $col2);
- while ($stmt->fetch()) {
- var_dump($col1, $col2);
- }
- $stmt->close();
- }
+ if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) {
+ $stmt->execute();
+ $stmt->bind_result($col1, $col2);
+ while ($stmt->fetch()) {
+ var_dump($col1, $col2);
+ }
+ $stmt->close();
+ }
- mysqli_query($link,"DROP TABLE test_users");
- mysqli_close($link);
+ mysqli_query($link,"DROP TABLE test_users");
+ mysqli_close($link);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug33090.phpt b/ext/mysqli/tests/bug33090.phpt
index c95043c551..6bddfa4290 100644
--- a/ext/mysqli/tests/bug33090.phpt
+++ b/ext/mysqli/tests/bug33090.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
- mysqli_select_db($link, $db);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
+ mysqli_select_db($link, $db);
- if (!($link->prepare("this makes no sense"))) {
- printf("%d\n", $link->errno);
- printf("%s\n", $link->sqlstate);
- }
- $link->close();
+ if (!($link->prepare("this makes no sense"))) {
+ printf("%d\n", $link->errno);
+ printf("%s\n", $link->sqlstate);
+ }
+ $link->close();
?>
--EXPECT--
1064
diff --git a/ext/mysqli/tests/bug33263.phpt b/ext/mysqli/tests/bug33263.phpt
index e9ca36fe49..5df4065d25 100644
--- a/ext/mysqli/tests/bug33263.phpt
+++ b/ext/mysqli/tests/bug33263.phpt
@@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class test extends mysqli
- {
- public function __construct($host, $user, $passwd, $db, $port, $socket) {
- parent::init();
- parent::real_connect($host, $user, $passwd, $db, $port, $socket);
- }
- }
+ class test extends mysqli
+ {
+ public function __construct($host, $user, $passwd, $db, $port, $socket) {
+ parent::init();
+ parent::real_connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
- $mysql = new test($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new test($host, $user, $passwd, $db, $port, $socket);
- $stmt = $mysql->prepare("SELECT DATABASE()");
- $stmt->execute();
- $stmt->bind_result($database);
- $stmt->fetch();
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT DATABASE()");
+ $stmt->execute();
+ $stmt->bind_result($database);
+ $stmt->fetch();
+ $stmt->close();
- if ($database != $db)
- printf("[001] Expecting '%s' got %s/'%s'.\n",
- gettype($database), $database);
+ if ($database != $db)
+ printf("[001] Expecting '%s' got %s/'%s'.\n",
+ gettype($database), $database);
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt
index 18dd4c3566..17a18f4ca9 100644
--- a/ext/mysqli/tests/bug34785.phpt
+++ b/ext/mysqli/tests/bug34785.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- class my_stmt extends mysqli_stmt
- {
- public function __construct($link, $query) {
- parent::__construct($link, $query);
- }
- }
+ class my_stmt extends mysqli_stmt
+ {
+ public function __construct($link, $query) {
+ parent::__construct($link, $query);
+ }
+ }
- class my_result extends mysqli_result
- {
- public function __construct($link, $query) {
- parent::__construct($link, $query);
- }
- }
+ class my_result extends mysqli_result
+ {
+ public function __construct($link, $query) {
+ parent::__construct($link, $query);
+ }
+ }
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_query($link, "SET sql_mode=''");
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_query($link, "SET sql_mode=''");
- $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL");
+ $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($var);
- $stmt->fetch();
+ $stmt->execute();
+ $stmt->bind_result($var);
+ $stmt->fetch();
- $stmt->close();
- var_dump($var);
+ $stmt->close();
+ var_dump($var);
- mysqli_real_query($link, "SELECT 'bar' FROM DUAL");
- $result = new my_result($link, MYSQLI_STORE_RESULT);
- $row = $result->fetch_row();
- $result->close();
+ mysqli_real_query($link, "SELECT 'bar' FROM DUAL");
+ $result = new my_result($link, MYSQLI_STORE_RESULT);
+ $row = $result->fetch_row();
+ $result->close();
- var_dump($row[0]);
+ var_dump($row[0]);
- mysqli_close($link);
+ mysqli_close($link);
?>
--EXPECTF--
%s(3) "foo"
diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt
index ff7985e49b..9157a13b9a 100644
--- a/ext/mysqli/tests/bug34810.phpt
+++ b/ext/mysqli/tests/bug34810.phpt
@@ -9,37 +9,37 @@ require_once('skipifconnectfailure.inc');
<?php
class DbConnection {
- public function connect() {
- require_once("connect.inc");
+ public function connect() {
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- var_dump($link);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ var_dump($link);
- $link = mysqli_init();
+ $link = mysqli_init();
var_dump($link);
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test_warnings");
- $mysql->query("CREATE TABLE test_warnings (a int not null)");
- $mysql->query("SET sql_mode=''");
- $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_warnings");
+ $mysql->query("CREATE TABLE test_warnings (a int not null)");
+ $mysql->query("SET sql_mode=''");
+ $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
- $warning = $mysql->get_warnings();
- if (!$warning)
- printf("[001] No warning!\n");
+ $warning = $mysql->get_warnings();
+ if (!$warning)
+ printf("[001] No warning!\n");
- if ($warning->errno == 1048 || $warning->errno == 1253) {
- /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */
- if ("HY000" != $warning->sqlstate)
- printf("[003] Wrong sql state code: %s\n", $warning->sqlstate);
+ if ($warning->errno == 1048 || $warning->errno == 1253) {
+ /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */
+ if ("HY000" != $warning->sqlstate)
+ printf("[003] Wrong sql state code: %s\n", $warning->sqlstate);
- if ("" == $warning->message)
- printf("[004] Message string must not be empty\n");
- } else {
- printf("[002] Empty error message!\n");
- var_dump($warning);
- }
- }
+ if ("" == $warning->message)
+ printf("[004] Message string must not be empty\n");
+ } else {
+ printf("[002] Empty error message!\n");
+ var_dump($warning);
+ }
+ }
}
$db = new DbConnection();
diff --git a/ext/mysqli/tests/bug35103.phpt b/ext/mysqli/tests/bug35103.phpt
index fbd83fcf56..95f65320f9 100644
--- a/ext/mysqli/tests/bug35103.phpt
+++ b/ext/mysqli/tests/bug35103.phpt
@@ -12,44 +12,44 @@ $drop = <<<EOSQL
DROP TABLE test_bint;
DROP TABLE test_buint;
EOSQL;
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test_bint");
- $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM");
- $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_bint");
+ $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM");
+ $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)");
- $mysql->query("DROP TABLE IF EXISTS test_buint");
- $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)");
- $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)");
+ $mysql->query("DROP TABLE IF EXISTS test_buint");
+ $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)");
+ $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)");
- $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a");
- $stmt->bind_result($v);
- $stmt->execute();
- $i=0;
- echo "BIG INT SIGNED, TEST\n";
- while ($i++ < 8) {
- $stmt->fetch();
- echo $v, "\n";
- }
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a");
+ $stmt->bind_result($v);
+ $stmt->execute();
+ $i=0;
+ echo "BIG INT SIGNED, TEST\n";
+ while ($i++ < 8) {
+ $stmt->fetch();
+ echo $v, "\n";
+ }
+ $stmt->close();
- echo str_repeat("-", 20), "\n";
+ echo str_repeat("-", 20), "\n";
- $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a");
- $stmt->bind_result($v2);
- $stmt->execute();
- $j=0;
- echo "BIG INT UNSIGNED TEST\n";
- while ($j++ < 6) {
- $stmt->fetch();
- echo $v2, "\n";
- }
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a");
+ $stmt->bind_result($v2);
+ $stmt->execute();
+ $j=0;
+ echo "BIG INT UNSIGNED TEST\n";
+ while ($j++ < 6) {
+ $stmt->fetch();
+ echo $v2, "\n";
+ }
+ $stmt->close();
- $mysql->multi_query($drop);
+ $mysql->multi_query($drop);
- $mysql->close();
+ $mysql->close();
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug35517.phpt b/ext/mysqli/tests/bug35517.phpt
index 2a199a7a33..578f905f35 100644
--- a/ext/mysqli/tests/bug35517.phpt
+++ b/ext/mysqli/tests/bug35517.phpt
@@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
- $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
- $stmt = $mysql->prepare("SELECT id FROM temp");
- $stmt->execute();
- $stmt->bind_result($id);
- while ($stmt->fetch()) {
- if (PHP_INT_SIZE == 8) {
- if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
- printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
- } else {
- if (gettype($id) !== 'string') {
- printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
- }
- }
- print $id;
- print "\n";
- }
- $stmt->close();
+ $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
+ $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
+ $stmt = $mysql->prepare("SELECT id FROM temp");
+ $stmt->execute();
+ $stmt->bind_result($id);
+ while ($stmt->fetch()) {
+ if (PHP_INT_SIZE == 8) {
+ if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
+ printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
+ } else {
+ if (gettype($id) !== 'string') {
+ printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
+ }
+ }
+ print $id;
+ print "\n";
+ }
+ $stmt->close();
- $mysql->query("DROP TABLE temp");
- $mysql->close();
- print "done!";
+ $mysql->query("DROP TABLE temp");
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug35759.phpt b/ext/mysqli/tests/bug35759.phpt
index d6d7a7582b..5ae032eb83 100644
--- a/ext/mysqli/tests/bug35759.phpt
+++ b/ext/mysqli/tests/bug35759.phpt
@@ -8,49 +8,49 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
- $col_num= 1000;
-
- $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test");
- $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''";
- $i= 0;
- while (++$i < $col_num) {
- $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''";
- }
- $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5
-
- if (!$mysql->query($create)) {
- if (1101 == $mysql->errno) {
- /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */
- print "done!";
- exit(0);
- }
- printf("[001] [%d] %s\n", $mysql->errno, $mysql->error);
- }
-
- if (!$mysql->query("INSERT INTO test (a0) VALUES ('')"))
- printf("[002] [%d] %s\n", $mysql->errno, $mysql->error);
-
- $stmt = $mysql->prepare("SELECT * FROM test");
- if ($stmt) {
-
- $stmt->execute();
- $stmt->store_result();
- for ($i = 0; $i < $col_num; $i++) {
- $params[] = &$col_num;
- }
- call_user_func_array(array($stmt, "bind_result"), $params);
- $stmt->fetch();
-
- $stmt->close();
- } else {
- printf("[003] [%d] %s\n", $mysql->errno, $mysql->error);
- }
-
- $mysql->close();
-
- echo "done!";
+ require_once("connect.inc");
+ $col_num= 1000;
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test");
+ $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''";
+ $i= 0;
+ while (++$i < $col_num) {
+ $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''";
+ }
+ $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5
+
+ if (!$mysql->query($create)) {
+ if (1101 == $mysql->errno) {
+ /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */
+ print "done!";
+ exit(0);
+ }
+ printf("[001] [%d] %s\n", $mysql->errno, $mysql->error);
+ }
+
+ if (!$mysql->query("INSERT INTO test (a0) VALUES ('')"))
+ printf("[002] [%d] %s\n", $mysql->errno, $mysql->error);
+
+ $stmt = $mysql->prepare("SELECT * FROM test");
+ if ($stmt) {
+
+ $stmt->execute();
+ $stmt->store_result();
+ for ($i = 0; $i < $col_num; $i++) {
+ $params[] = &$col_num;
+ }
+ call_user_func_array(array($stmt, "bind_result"), $params);
+ $stmt->fetch();
+
+ $stmt->close();
+ } else {
+ printf("[003] [%d] %s\n", $mysql->errno, $mysql->error);
+ }
+
+ $mysql->close();
+
+ echo "done!";
?>
--CLEAN--
<?php require("clean_table.inc"); ?>
diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt
index 744985ab41..6450a7772f 100644
--- a/ext/mysqli/tests/bug36745.phpt
+++ b/ext/mysqli/tests/bug36745.phpt
@@ -30,7 +30,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS litest"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt
index 65e6d9a8ce..b6c23c9d7d 100644
--- a/ext/mysqli/tests/bug36802.phpt
+++ b/ext/mysqli/tests/bug36802.phpt
@@ -4,29 +4,29 @@ Bug #36802 (crashes with with mysqli_set_charset())
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- class really_my_mysqli extends mysqli {
- function __construct()
- {
- }
- }
+ class really_my_mysqli extends mysqli {
+ function __construct()
+ {
+ }
+ }
- require_once("connect.inc");
- $mysql = mysqli_init();
+ require_once("connect.inc");
+ $mysql = mysqli_init();
- /* following operations should not work */
- if (method_exists($mysql, 'set_charset')) {
- $x[0] = @$mysql->set_charset('utf8');
- } else {
- $x[0] = false;
- }
- $x[1] = @$mysql->query("SELECT 'foo' FROM DUAL");
+ /* following operations should not work */
+ if (method_exists($mysql, 'set_charset')) {
+ $x[0] = @$mysql->set_charset('utf8');
+ } else {
+ $x[0] = false;
+ }
+ $x[1] = @$mysql->query("SELECT 'foo' FROM DUAL");
- /* following operations should work */
- $x[2] = ($mysql->client_version > 0);
- $x[3] = $mysql->errno;
- $mysql->close();
+ /* following operations should work */
+ $x[2] = ($mysql->client_version > 0);
+ $x[3] = $mysql->errno;
+ $mysql->close();
- var_dump($x);
+ var_dump($x);
?>
--EXPECT--
array(4) {
diff --git a/ext/mysqli/tests/bug36949.phpt b/ext/mysqli/tests/bug36949.phpt
index d59ee81d90..7033eef23c 100644
--- a/ext/mysqli/tests/bug36949.phpt
+++ b/ext/mysqli/tests/bug36949.phpt
@@ -10,38 +10,38 @@ require_once('skipifconnectfailure.inc');
require_once("connect.inc");
class A {
- private $mysqli;
-
- public function __construct() {
- global $user, $host, $passwd, $db, $port, $socket;
- $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
- $row = $result->fetch_object();
- echo $row->my_time."<br>\n";
- $result->close();
- }
-
- public function __destruct() {
- $this->mysqli->close();
- }
+ private $mysqli;
+
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
+
+ public function __destruct() {
+ $this->mysqli->close();
+ }
}
class B {
- private $mysqli;
+ private $mysqli;
- public function __construct() {
- global $user, $host, $passwd, $db, $port, $socket;
- $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
- $row = $result->fetch_object();
- echo $row->my_time."<br>\n";
- $result->close();
- }
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
- public function __destruct() {
- $this->mysqli->close();
- }
+ public function __destruct() {
+ $this->mysqli->close();
+ }
}
$A = new A();
diff --git a/ext/mysqli/tests/bug37090.phpt b/ext/mysqli/tests/bug37090.phpt
index 1af1c1f5a2..8345b4b82f 100644
--- a/ext/mysqli/tests/bug37090.phpt
+++ b/ext/mysqli/tests/bug37090.phpt
@@ -10,22 +10,22 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $cs = array();
- $cs[] = $mysql->set_charset("latin1");
- $cs[] = $mysql->character_set_name();
+ $cs = array();
+ $cs[] = $mysql->set_charset("latin1");
+ $cs[] = $mysql->character_set_name();
- $cs[] = $mysql->set_charset("utf8");
- $cs[] = $mysql->character_set_name();
+ $cs[] = $mysql->set_charset("utf8");
+ $cs[] = $mysql->character_set_name();
- $cs[] = $mysql->set_charset("notdefined");
- $cs[] = $mysql->character_set_name();
+ $cs[] = $mysql->set_charset("notdefined");
+ $cs[] = $mysql->character_set_name();
- var_dump($cs);
- print "done!";
+ var_dump($cs);
+ print "done!";
?>
--EXPECT--
array(6) {
diff --git a/ext/mysqli/tests/bug38710.phpt b/ext/mysqli/tests/bug38710.phpt
index 7a47003632..dc6496971a 100644
--- a/ext/mysqli/tests/bug38710.phpt
+++ b/ext/mysqli/tests/bug38710.phpt
@@ -16,7 +16,7 @@ $qry->execute();
$qry->bind_result($text);
$qry->fetch();
if ($text !== str_repeat('a', ($IS_MYSQLND || mysqli_get_server_version($db) > 50110)? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) {
- var_dump(strlen($text));
+ var_dump(strlen($text));
}
echo "Done";
?>
diff --git a/ext/mysqli/tests/bug39457.phpt b/ext/mysqli/tests/bug39457.phpt
index ec9239bb15..f518b14331 100644
--- a/ext/mysqli/tests/bug39457.phpt
+++ b/ext/mysqli/tests/bug39457.phpt
@@ -7,15 +7,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = mysqli_init();
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql = mysqli_init();
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->close();
- echo "OK\n";
+ $mysql->close();
+ echo "OK\n";
?>
--EXPECT--
OK
diff --git a/ext/mysqli/tests/bug42378.phpt b/ext/mysqli/tests/bug42378.phpt
index 3b0638c840..7b42d70118 100644
--- a/ext/mysqli/tests/bug42378.phpt
+++ b/ext/mysqli/tests/bug42378.phpt
@@ -182,7 +182,7 @@ memory_limit=83886080
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
FLOAT
diff --git a/ext/mysqli/tests/bug42548.phpt b/ext/mysqli/tests/bug42548.phpt
index c6f18f3016..e188d83666 100644
--- a/ext/mysqli/tests/bug42548.phpt
+++ b/ext/mysqli/tests/bug42548.phpt
@@ -19,8 +19,8 @@ require_once('connect.inc');
$mysqli = mysqli_init();
$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
+ printf("Connect failed: %s\n", mysqli_connect_error());
+ exit();
}
$mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
@@ -28,22 +28,22 @@ $mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($
if ($mysqli->multi_query("CALL p1();"))
{
- do
- {
- if ($objResult = $mysqli->store_result()) {
- while ($row = $objResult->fetch_assoc()) {
- print_r($row);
- }
- $objResult->close();
- if ($mysqli->more_results()) {
- print "----- next result -----------\n";
- }
- } else {
- print "no results found\n";
- }
- } while ($mysqli->more_results() && $mysqli->next_result());
+ do
+ {
+ if ($objResult = $mysqli->store_result()) {
+ while ($row = $objResult->fetch_assoc()) {
+ print_r($row);
+ }
+ $objResult->close();
+ if ($mysqli->more_results()) {
+ print "----- next result -----------\n";
+ }
+ } else {
+ print "no results found\n";
+ }
+ } while ($mysqli->more_results() && $mysqli->next_result());
} else {
- print $mysqli->error;
+ print $mysqli->error;
}
$mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
diff --git a/ext/mysqli/tests/bug44897.phpt b/ext/mysqli/tests/bug44897.phpt
index b5cecd5685..430a32856e 100644
--- a/ext/mysqli/tests/bug44897.phpt
+++ b/ext/mysqli/tests/bug44897.phpt
@@ -19,57 +19,57 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once("table.inc");
+ require_once("table.inc");
- if (!$link->query('DROP PROCEDURE IF EXISTS p'))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query('DROP PROCEDURE IF EXISTS p'))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
- if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;'))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;'))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- $new_id = 100;
- $new_label = 'z';
+ $new_id = 100;
+ $new_label = 'z';
- if (!$stmt = $link->prepare('CALL p(?, ?)'))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare('CALL p(?, ?)'))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute())
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute())
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- $out_new_label = null;
- if (!$stmt->bind_result($out_new_label) || !$stmt->fetch())
- printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
+ $out_new_label = null;
+ if (!$stmt->bind_result($out_new_label) || !$stmt->fetch())
+ printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($out_new_label != $new_label)
- printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
- $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
+ if ($out_new_label != $new_label)
+ printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
+ $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
- $stmt->close();
+ $stmt->close();
- $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?');
- if (!is_object($stmt2)) {
+ $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?');
+ if (!is_object($stmt2)) {
- printf("[007] Failed to create new statement object, [%d] %s\n",
- $link->errno, $link->error);
+ printf("[007] Failed to create new statement object, [%d] %s\n",
+ $link->errno, $link->error);
- } else {
+ } else {
- if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute())
- printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute())
+ printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $out_new_label = null;
- if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch())
- printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ $out_new_label = null;
+ if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
- if ($out_new_label != $new_label)
- printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
- $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
+ if ($out_new_label != $new_label)
+ printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
+ $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
- }
+ }
- $link->close();
+ $link->close();
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug45019.phpt b/ext/mysqli/tests/bug45019.phpt
index f7ace737d8..faad5b9b90 100644
--- a/ext/mysqli/tests/bug45019.phpt
+++ b/ext/mysqli/tests/bug45019.phpt
@@ -8,48 +8,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
+ require_once("connect.inc");
+ require_once("table.inc");
- // Regular (non-prepared) queries
- print "Using CAST('somestring' AS CHAR)...\n";
- if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
+ // Regular (non-prepared) queries
+ print "Using CAST('somestring' AS CHAR)...\n";
+ if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- var_dump($row['column1']);
- }
- $res->free();
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ var_dump($row['column1']);
+ }
+ $res->free();
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- $index = 0;
- while ($stmt->fetch()) {
- /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
- if ($data[$index] != $column1) {
- if ($IS_MYSQLND || $index != 1) {
- printf("[004] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- } else {
- if ($column1 != "thre")
- printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
- }
- }
- $index++;
- }
- $stmt->close();
+ $index = 0;
+ while ($stmt->fetch()) {
+ /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
+ if ($data[$index] != $column1) {
+ if ($IS_MYSQLND || $index != 1) {
+ printf("[004] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ } else {
+ if ($column1 != "thre")
+ printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
+ }
+ }
+ $index++;
+ }
+ $stmt->close();
- $link->close();
+ $link->close();
- print "done!";
+ print "done!";
?>
--EXPECT--
Using CAST('somestring' AS CHAR)...
diff --git a/ext/mysqli/tests/bug45289.phpt b/ext/mysqli/tests/bug45289.phpt
index 974887276f..8604fc7260 100644
--- a/ext/mysqli/tests/bug45289.phpt
+++ b/ext/mysqli/tests/bug45289.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- $link->close();
+ $link->close();
- $link = mysqli_init();
- if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ $link = mysqli_init();
+ if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $id = 1;
- if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1')))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ $id = 1;
+ if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1')))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param('i', $id) || !$stmt->execute())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param('i', $id) || !$stmt->execute())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($res = $link->store_result()) {
- if ($IS_MYSQLND)
- printf("[004] Can store result!\n");
- else
- printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
- } else {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
+ if ($res = $link->store_result()) {
+ if ($IS_MYSQLND)
+ printf("[004] Can store result!\n");
+ else
+ printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
+ } else {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug46109.phpt b/ext/mysqli/tests/bug46109.phpt
index a1c77ac2d8..6b44275ed4 100644
--- a/ext/mysqli/tests/bug46109.phpt
+++ b/ext/mysqli/tests/bug46109.phpt
@@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli();
- $mysqli->init();
- $mysqli->init();
- echo "done";
+ $mysqli = new mysqli();
+ $mysqli->init();
+ $mysqli->init();
+ echo "done";
?>
--EXPECT--
done
diff --git a/ext/mysqli/tests/bug46614.phpt b/ext/mysqli/tests/bug46614.phpt
index d301b87f6a..e451abda9e 100644
--- a/ext/mysqli/tests/bug46614.phpt
+++ b/ext/mysqli/tests/bug46614.phpt
@@ -11,13 +11,13 @@ if (!defined("MYSQLI_ASYNC")) {
--FILE--
<?php
class MySQL_Ext extends mysqli{
- protected $fooData = array();
+ protected $fooData = array();
- public function isEmpty()
- {
- $this->extData[] = 'Bar';
- return empty($this->extData);
- }
+ public function isEmpty()
+ {
+ $this->extData[] = 'Bar';
+ return empty($this->extData);
+ }
}
include ("connect.inc");
diff --git a/ext/mysqli/tests/bug47050.phpt b/ext/mysqli/tests/bug47050.phpt
index c8e720a44c..1dd8f73a69 100644
--- a/ext/mysqli/tests/bug47050.phpt
+++ b/ext/mysqli/tests/bug47050.phpt
@@ -10,22 +10,22 @@ if (!defined("MYSQLI_ASYNC")) {
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
- mysqli_select_db($link1, $db);
+ $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
+ mysqli_select_db($link1, $db);
- $link1->query("SELECT 'test'", MYSQLI_ASYNC);
- $all_links = array($link1);
- $links = $errors = $reject = $all_links;
- mysqli_poll($links, $errors, $reject, 1);
+ $link1->query("SELECT 'test'", MYSQLI_ASYNC);
+ $all_links = array($link1);
+ $links = $errors = $reject = $all_links;
+ mysqli_poll($links, $errors, $reject, 1);
- echo "links: ", sizeof($links), "\n";
- echo "errors: ", sizeof($errors), "\n";
- echo "reject: ", sizeof($reject), "\n";
- echo "all_links: ", sizeof($all_links), "\n";
+ echo "links: ", sizeof($links), "\n";
+ echo "errors: ", sizeof($errors), "\n";
+ echo "reject: ", sizeof($reject), "\n";
+ echo "all_links: ", sizeof($all_links), "\n";
- $link1->close();
+ $link1->close();
?>
--EXPECT--
links: 1
diff --git a/ext/mysqli/tests/bug48909.phpt b/ext/mysqli/tests/bug48909.phpt
index 071f53dc7c..2d994f559e 100644
--- a/ext/mysqli/tests/bug48909.phpt
+++ b/ext/mysqli/tests/bug48909.phpt
@@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$link->query("DROP TABLE IF EXISTS test") ||
- !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine)))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("DROP TABLE IF EXISTS test") ||
+ !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine)))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param("bb",$bvar, $bvar))
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param("bb",$bvar, $bvar))
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$stmt->execute()) {
- if ($stmt->errno != 1366) {
- /*
- $bvar is null, b is for BLOB - any error like this should be OK:
- 1366 - Incorrect integer value: '' for column 'id' at row 1
- */
- printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
- }
- }
+ if (!$stmt->execute()) {
+ if ($stmt->errno != 1366) {
+ /*
+ $bvar is null, b is for BLOB - any error like this should be OK:
+ 1366 - Incorrect integer value: '' for column 'id' at row 1
+ */
+ printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
+ }
+ }
- $stmt->close();
- $link->close();
+ $stmt->close();
+ $link->close();
- echo "done";
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug49027.phpt b/ext/mysqli/tests/bug49027.phpt
index 0ff2f51935..6a459ed4ac 100644
--- a/ext/mysqli/tests/bug49027.phpt
+++ b/ext/mysqli/tests/bug49027.phpt
@@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) {
- printf("[001] Cannot set INIT_COMMAND\n");
- }
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) {
+ printf("[001] Cannot set INIT_COMMAND\n");
+ }
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- var_dump($link->query("SELECT 42")->fetch_row());
+ var_dump($link->query("SELECT 42")->fetch_row());
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) {
- printf("[004] Cannot set INIT_COMMAND\n");
- }
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) {
+ printf("[004] Cannot set INIT_COMMAND\n");
+ }
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$res = mysqli_query($link, "SELECT id FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
+ var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug49442.phpt b/ext/mysqli/tests/bug49442.phpt
index 4c3fbcdb24..82063365d9 100644
--- a/ext/mysqli/tests/bug49442.phpt
+++ b/ext/mysqli/tests/bug49442.phpt
@@ -106,7 +106,7 @@ mysqli.max_persistent=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
array(2) {
diff --git a/ext/mysqli/tests/bug50772.phpt b/ext/mysqli/tests/bug50772.phpt
index 9f26135c60..8987d0ac48 100644
--- a/ext/mysqli/tests/bug50772.phpt
+++ b/ext/mysqli/tests/bug50772.phpt
@@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include "connect.inc";
- $db1 = new mysqli();
+ include "connect.inc";
+ $db1 = new mysqli();
- // These calls fail
- $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
- my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket);
- if(mysqli_connect_error()) {
- echo "error 1\n";
- } else {
- echo "ok 1\n";
- }
+ // These calls fail
+ $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket);
+ if(mysqli_connect_error()) {
+ echo "error 1\n";
+ } else {
+ echo "ok 1\n";
+ }
- $db2 = mysqli_init();
+ $db2 = mysqli_init();
- $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
- my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket);
- if(mysqli_connect_error()) {
- echo "error 2\n";
- } else {
- echo "ok 2\n";
- }
- echo "done\n";
+ $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket);
+ if(mysqli_connect_error()) {
+ echo "error 2\n";
+ } else {
+ echo "ok 2\n";
+ }
+ echo "done\n";
?>
--EXPECT--
ok 1
diff --git a/ext/mysqli/tests/bug51647.phpt b/ext/mysqli/tests/bug51647.phpt
index abcf5e4f0e..2ba6bd4508 100644
--- a/ext/mysqli/tests/bug51647.phpt
+++ b/ext/mysqli/tests/bug51647.phpt
@@ -39,69 +39,69 @@ $link->close();
?>
--FILE--
<?php
- include ("connect.inc");
-
- if (!is_object($link = mysqli_init()))
- printf("[001] Cannot create link\n");
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) {
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
- if (1064 == $link->errno) {
- /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
- if ($res = $link->query("SHOW STATUS")) {
- while ($row = $res->fetch_assoc())
- if ($row['Variable_name'] == 'Ssl_cipher')
- break;
- } else {
- printf("[005] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- if (!$row = $res->fetch_assoc())
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- if (!strlen($row["Value"]))
- printf("[007] Empty cipher. No encrytion!");
- var_dump($row);
- }
-
- $link->close();
-
- if (!is_object($link = mysqli_init()))
- printf("[008] Cannot create link\n");
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) {
- printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
- if (1064 == $link->errno) {
- /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
- if ($res = $link->query("SHOW STATUS")) {
- while ($row = $res->fetch_assoc())
- if ($row['Variable_name'] == 'Ssl_cipher')
- break;
- } else {
- printf("[010] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- printf("[011] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- if (!$row = $res->fetch_assoc())
- printf("[012] [%d] %s\n", $link->errno, $link->error);
- if (!strlen($row["Value"]))
- printf("[013] Empty cipher. No encrytion!");
- var_dump($row);
- }
-
- $link->close();
-
- print "done!";
+ include ("connect.inc");
+
+ if (!is_object($link = mysqli_init()))
+ printf("[001] Cannot create link\n");
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) {
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
+ if (1064 == $link->errno) {
+ /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
+ if ($res = $link->query("SHOW STATUS")) {
+ while ($row = $res->fetch_assoc())
+ if ($row['Variable_name'] == 'Ssl_cipher')
+ break;
+ } else {
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ if (!$row = $res->fetch_assoc())
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ if (!strlen($row["Value"]))
+ printf("[007] Empty cipher. No encrytion!");
+ var_dump($row);
+ }
+
+ $link->close();
+
+ if (!is_object($link = mysqli_init()))
+ printf("[008] Cannot create link\n");
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) {
+ printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
+ if (1064 == $link->errno) {
+ /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
+ if ($res = $link->query("SHOW STATUS")) {
+ while ($row = $res->fetch_assoc())
+ if ($row['Variable_name'] == 'Ssl_cipher')
+ break;
+ } else {
+ printf("[010] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ printf("[011] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ if (!$row = $res->fetch_assoc())
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+ if (!strlen($row["Value"]))
+ printf("[013] Empty cipher. No encrytion!");
+ var_dump($row);
+ }
+
+ $link->close();
+
+ print "done!";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/bug52082.phpt b/ext/mysqli/tests/bug52082.phpt
index 11157195ab..f601406e8f 100644
--- a/ext/mysqli/tests/bug52082.phpt
+++ b/ext/mysqli/tests/bug52082.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $link = mysqli_init();
- $link->options(MYSQLI_SET_CHARSET_NAME, "latin2");
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- die("can't connect");
- }
- var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
- var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
- $link->change_user($user, $passwd, $db);
- var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
- var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
+ require_once("connect.inc");
+ $link = mysqli_init();
+ $link->options(MYSQLI_SET_CHARSET_NAME, "latin2");
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ die("can't connect");
+ }
+ var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
+ var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
+ $link->change_user($user, $passwd, $db);
+ var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
+ var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
- print "done!";
+ print "done!";
?>
--EXPECT--
array(2) {
diff --git a/ext/mysqli/tests/bug52891.phpt b/ext/mysqli/tests/bug52891.phpt
index 8ea2e36f35..2c4e19ca4c 100644
--- a/ext/mysqli/tests/bug52891.phpt
+++ b/ext/mysqli/tests/bug52891.phpt
@@ -10,90 +10,90 @@ if (!$IS_MYSQLND) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$link->query("DROP TABLE IF EXISTS tuint") ||
- !$link->query("DROP TABLE IF EXISTS tsint")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("DROP TABLE IF EXISTS tuint") ||
+ !$link->query("DROP TABLE IF EXISTS tsint")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
- !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
+ !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
- printf("[004] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- $param = 42;
+ $param = 42;
- if (!$stmt1->bind_param("i", $param))
- printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt1->bind_param("i", $param))
+ printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->bind_param("i", $param))
- printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->bind_param("i", $param))
+ printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* first insert normal value to force initial send of types */
- if (!$stmt1->execute())
- printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ /* first insert normal value to force initial send of types */
+ if (!$stmt1->execute())
+ printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
- $param = -4294967297;
- if (!$stmt2->execute())
- printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
+ $param = -4294967297;
+ if (!$stmt2->execute())
+ printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* again normal value */
- $param = 43;
+ /* again normal value */
+ $param = 43;
- if (!$stmt1->execute())
- printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt1->execute())
+ printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* again conversion */
- $param = -4294967295;
- if (!$stmt2->execute())
- printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ /* again conversion */
+ $param = -4294967295;
+ if (!$stmt2->execute())
+ printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $param = 4294967295;
- if (!$stmt1->execute())
- printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ $param = 4294967295;
+ if (!$stmt1->execute())
+ printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $param = 4294967297;
- if (!$stmt1->execute())
- printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ $param = 4294967297;
+ if (!$stmt1->execute())
+ printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
- $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
+ $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
+ $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
- echo "tsint:\n";
- while ($row = $result->fetch_assoc()) {
- var_dump($row);
- }
- echo "tuint:\n";
- while ($row = $result2->fetch_assoc()) {
- var_dump($row);
- }
+ echo "tsint:\n";
+ while ($row = $result->fetch_assoc()) {
+ var_dump($row);
+ }
+ echo "tuint:\n";
+ while ($row = $result2->fetch_assoc()) {
+ var_dump($row);
+ }
- echo "done";
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug53503.phpt b/ext/mysqli/tests/bug53503.phpt
index 0b187102f7..f37113667e 100644
--- a/ext/mysqli/tests/bug53503.phpt
+++ b/ext/mysqli/tests/bug53503.phpt
@@ -52,12 +52,12 @@ mysqli.allow_local_infile=1
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$link->close();
diff --git a/ext/mysqli/tests/bug55283.phpt b/ext/mysqli/tests/bug55283.phpt
index b0714aeaaa..d788fe12a4 100644
--- a/ext/mysqli/tests/bug55283.phpt
+++ b/ext/mysqli/tests/bug55283.phpt
@@ -39,28 +39,28 @@ $link->close();
?>
--FILE--
<?php
- require_once "connect.inc";
- $db1 = new mysqli();
+ require_once "connect.inc";
+ $db1 = new mysqli();
- $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
+ $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
- $link = mysqli_init();
- mysqli_ssl_set($link, null, null, null, null, "AES256-SHA");
- if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) {
- $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
- var_dump($r->fetch_row());
- }
+ $link = mysqli_init();
+ mysqli_ssl_set($link, null, null, null, null, "AES256-SHA");
+ if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) {
+ $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
+ var_dump($r->fetch_row());
+ }
- /* non-persistent connection */
- $link2 = mysqli_init();
- mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA");
- if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) {
- $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'");
- var_dump($r2->fetch_row());
- }
+ /* non-persistent connection */
+ $link2 = mysqli_init();
+ mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA");
+ if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) {
+ $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'");
+ var_dump($r2->fetch_row());
+ }
- echo "done\n";
+ echo "done\n";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/bug55582.phpt b/ext/mysqli/tests/bug55582.phpt
index 132a731d0c..86626c0279 100644
--- a/ext/mysqli/tests/bug55582.phpt
+++ b/ext/mysqli/tests/bug55582.phpt
@@ -8,21 +8,21 @@ require_once("connect.inc");
?>
--FILE--
<?php
- include "connect.inc";
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
- printf("[001] Cannot connect to the server");
- }
+ include "connect.inc";
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
+ printf("[001] Cannot connect to the server");
+ }
- var_dump($link->real_query("SELECT 1"));
- $res = $link->use_result();
- var_dump(mysqli_num_rows($res));
- var_dump($res->fetch_assoc());
- var_dump(mysqli_num_rows($res));
- var_dump($res->fetch_assoc());
- var_dump(mysqli_num_rows($res));
+ var_dump($link->real_query("SELECT 1"));
+ $res = $link->use_result();
+ var_dump(mysqli_num_rows($res));
+ var_dump($res->fetch_assoc());
+ var_dump(mysqli_num_rows($res));
+ var_dump($res->fetch_assoc());
+ var_dump(mysqli_num_rows($res));
- $link->close();
- echo "done\n";
+ $link->close();
+ echo "done\n";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/bug55653.phpt b/ext/mysqli/tests/bug55653.phpt
index 80e654771c..a51a7ddd22 100644
--- a/ext/mysqli/tests/bug55653.phpt
+++ b/ext/mysqli/tests/bug55653.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $in_and_out = "a";
+ $in_and_out = "a";
- if (!($stmt = $link->stmt_init()))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!($stmt = $link->stmt_init()))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!($stmt->prepare("SELECT ?")) ||
- !($stmt->bind_param("s", $in_and_out)) ||
- !($stmt->execute()) ||
- !($stmt->bind_result($in_and_out)))
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!($stmt->prepare("SELECT ?")) ||
+ !($stmt->bind_param("s", $in_and_out)) ||
+ !($stmt->execute()) ||
+ !($stmt->bind_result($in_and_out)))
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$stmt->fetch())
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->fetch())
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- if ("a" !== $in_and_out)
- printf("[005] Wrong result: '%s'\n", $in_and_out);
+ if ("a" !== $in_and_out)
+ printf("[005] Wrong result: '%s'\n", $in_and_out);
- echo "done!";
+ echo "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt
index e996de361d..5913ef399e 100644
--- a/ext/mysqli/tests/bug62046.phpt
+++ b/ext/mysqli/tests/bug62046.phpt
@@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
- printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (FALSE === $stmt->execute()) {
- printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->store_result()) {
- printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- $one = NULL;
- if (FALSE === $stmt->bind_result($one)) {
- printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->reset()) {
- printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- while ($stmt->fetch()) {
- var_dump($one);
- }
- $stmt->close();
- $link->close();
- echo "done!";
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
+ printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (FALSE === $stmt->execute()) {
+ printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->store_result()) {
+ printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ $one = NULL;
+ if (FALSE === $stmt->bind_result($one)) {
+ printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->reset()) {
+ printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ while ($stmt->fetch()) {
+ var_dump($one);
+ }
+ $stmt->close();
+ $link->close();
+ echo "done!";
?>
--EXPECT--
int(42)
diff --git a/ext/mysqli/tests/bug66043.phpt b/ext/mysqli/tests/bug66043.phpt
index 54ddf6943c..07714f217a 100644
--- a/ext/mysqli/tests/bug66043.phpt
+++ b/ext/mysqli/tests/bug66043.phpt
@@ -13,7 +13,7 @@ require_once('skipifconnectfailure.inc');
<?php
require 'connect.inc';
if (!$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
$stmt = $db->stmt_init();
diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt
index d5dec314cf..cede635e14 100644
--- a/ext/mysqli/tests/bug66124.phpt
+++ b/ext/mysqli/tests/bug66124.phpt
@@ -23,9 +23,9 @@ $id = '1311200011005001566';
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
}
$link->query($table_drop);
@@ -33,8 +33,8 @@ $link->query($table_create);
$stmt = $link->prepare($table_insert);
if (!$stmt) {
- printf("Can't prepare\n");
- exit(1);
+ printf("Can't prepare\n");
+ exit(1);
}
echo "Using 'i':\n";
@@ -43,8 +43,8 @@ $stmt->bind_param('i', $id);
if ($stmt->execute()){
echo "insert id:{$id}=>{$stmt->insert_id}\n";
} else {
- printf("Can't execute\n");
- exit(1);
+ printf("Can't execute\n");
+ exit(1);
}
@@ -55,8 +55,8 @@ if ($result){
echo "fetch id:{$row['id']}\n";
}
} else {
- printf("Can't select\n");
- exit(1);
+ printf("Can't select\n");
+ exit(1);
}
$stmt->close();
@@ -73,8 +73,8 @@ echo "Using 's':\n";
if ($stmt->execute()){
echo "insert id:{$id}\n";
} else{
- printf("Can't execute\n");
- exit(1);
+ printf("Can't execute\n");
+ exit(1);
}
$result = $link->query($table_select);
@@ -84,8 +84,8 @@ if ($result){
echo "fetch id:{$row['id']}\n";
}
} else {
- printf("Can't select\n");
- exit(1);
+ printf("Can't select\n");
+ exit(1);
}
$link->close();
diff --git a/ext/mysqli/tests/bug66762.phpt b/ext/mysqli/tests/bug66762.phpt
index f5240bc926..c1f749d8c4 100644
--- a/ext/mysqli/tests/bug66762.phpt
+++ b/ext/mysqli/tests/bug66762.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $read_stmt = $mysqli->prepare("SELECT 1");
+ $read_stmt = $mysqli->prepare("SELECT 1");
- var_dump($read_stmt->bind_result($data));
+ var_dump($read_stmt->bind_result($data));
- unset($mysqli);
- var_dump($read_stmt->bind_result($data));
+ unset($mysqli);
+ var_dump($read_stmt->bind_result($data));
?>
done!
--EXPECT--
diff --git a/ext/mysqli/tests/bug67839.phpt b/ext/mysqli/tests/bug67839.phpt
index de33c4c4ed..441e6b8ca9 100644
--- a/ext/mysqli/tests/bug67839.phpt
+++ b/ext/mysqli/tests/bug67839.phpt
@@ -62,7 +62,7 @@ precision=5
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
1: 9.9999: 9.9999
diff --git a/ext/mysqli/tests/bug68077.phpt b/ext/mysqli/tests/bug68077.phpt
index 2be4fe97aa..d01be951d2 100644
--- a/ext/mysqli/tests/bug68077.phpt
+++ b/ext/mysqli/tests/bug68077.phpt
@@ -65,12 +65,12 @@ open_basedir=
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$link->close();
diff --git a/ext/mysqli/tests/bug69899.phpt b/ext/mysqli/tests/bug69899.phpt
index 4de74270cd..13c0c95381 100644
--- a/ext/mysqli/tests/bug69899.phpt
+++ b/ext/mysqli/tests/bug69899.phpt
@@ -26,9 +26,9 @@ $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$stmt = $mysqli->prepare('SELECT 1');
var_dump(
- $mysqli->close(),
- $stmt->free_result(),
- $stmt->close()
+ $mysqli->close(),
+ $stmt->free_result(),
+ $stmt->close()
);
?>
diff --git a/ext/mysqli/tests/bug70384.phpt b/ext/mysqli/tests/bug70384.phpt
index 627b9ba256..83a53ba528 100644
--- a/ext/mysqli/tests/bug70384.phpt
+++ b/ext/mysqli/tests/bug70384.phpt
@@ -19,40 +19,40 @@ mysqli_float_handling - ensure 4 byte float is handled correctly
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- die();
- }
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ die();
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
- $jsfield_data = '{"aaa": 123}';
- // Insert via string to make sure the real floating number gets to the DB
- if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
+ $jsfield_data = '{"aaa": 123}';
+ // Insert via string to make sure the real floating number gets to the DB
+ if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!($res = mysqli_query($link, "SELECT * FROM test"))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
- $rows = $res->fetch_all();
- if (json_encode($rows[0][0]) != json_encode($jsfield_data)) {
- printf("[006] Data differs");
- var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data));
- die();
- }
- mysqli_close($link);
- echo "OK";
+ if (!($res = mysqli_query($link, "SELECT * FROM test"))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
+ $rows = $res->fetch_all();
+ if (json_encode($rows[0][0]) != json_encode($jsfield_data)) {
+ printf("[006] Data differs");
+ var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data));
+ die();
+ }
+ mysqli_close($link);
+ echo "OK";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug70949.phpt b/ext/mysqli/tests/bug70949.phpt
index c3b53bcf16..24c729c670 100644
--- a/ext/mysqli/tests/bug70949.phpt
+++ b/ext/mysqli/tests/bug70949.phpt
@@ -22,25 +22,25 @@ $sql = "select * from bug70949";
if ($stmt = $mysql->prepare($sql))
{
- $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
+ $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
- if ($stmt->bind_result($name)) {
- {
- if ($stmt->execute())
- {
- while ($stmt->fetch())
- {
- var_dump($name);
- }
- }
- }
+ if ($stmt->bind_result($name)) {
+ {
+ if ($stmt->execute())
+ {
+ while ($stmt->fetch())
+ {
+ var_dump($name);
+ }
+ }
+ }
- $stmt->free_result();
- $stmt->close();
- }
+ $stmt->free_result();
+ $stmt->close();
+ }
- $mysql->close();
+ $mysql->close();
}
?>
diff --git a/ext/mysqli/tests/bug72701.phpt b/ext/mysqli/tests/bug72701.phpt
index e60d0ad65b..0455d667a3 100644
--- a/ext/mysqli/tests/bug72701.phpt
+++ b/ext/mysqli/tests/bug72701.phpt
@@ -19,7 +19,7 @@ require_once("connect.inc");
$con = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
+ echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
var_dump(preg_match(",(127.0.0.1|localhost) via .*,i", mysqli_get_host_info($con)));
diff --git a/ext/mysqli/tests/bug73462.phpt b/ext/mysqli/tests/bug73462.phpt
index 5fb978feb1..4e0d35c88d 100644
--- a/ext/mysqli/tests/bug73462.phpt
+++ b/ext/mysqli/tests/bug73462.phpt
@@ -8,34 +8,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /* Initial persistent connection */
- $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db);
- $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'");
- $c1 = $result->fetch_row();
- $result->free();
- $mysql_1->close();
+ /* Initial persistent connection */
+ $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db);
+ $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'");
+ $c1 = $result->fetch_row();
+ $result->free();
+ $mysql_1->close();
- /* Failed connection to invalid host */
- $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db);
- @$mysql_2->close();
+ /* Failed connection to invalid host */
+ $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db);
+ @$mysql_2->close();
- /* Re-use persistent connection */
- $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db);
- $error = mysqli_connect_errno();
- $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'");
- $c3 = $result->fetch_row();
- $result->free();
- $mysql_3->close();
+ /* Re-use persistent connection */
+ $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db);
+ $error = mysqli_connect_errno();
+ $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'");
+ $c3 = $result->fetch_row();
+ $result->free();
+ $mysql_3->close();
- if (end($c1) !== end($c3))
- printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3));
+ if (end($c1) !== end($c3))
+ printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3));
- if ($error !== 0)
- printf("[002] Expected '0' got '%d'.\n", $error);
+ if ($error !== 0)
+ printf("[002] Expected '0' got '%d'.\n", $error);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug74547.phpt b/ext/mysqli/tests/bug74547.phpt
index 940357ad04..ff61d78d7a 100644
--- a/ext/mysqli/tests/bug74547.phpt
+++ b/ext/mysqli/tests/bug74547.phpt
@@ -7,17 +7,17 @@ Bug #74547 mysqli::change_user() doesn't accept null as $database argument w/str
?>
--FILE--
<?php
- declare(strict_types=1);
+ declare(strict_types=1);
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- var_dump(mysqli_change_user($link, $user, $passwd, NULL));
+ var_dump(mysqli_change_user($link, $user, $passwd, NULL));
- mysqli_close($link);
+ mysqli_close($link);
?>
===DONE===
--EXPECT--
diff --git a/ext/mysqli/tests/bug74968.phpt b/ext/mysqli/tests/bug74968.phpt
index f78fa92d83..e3e971eb1f 100644
--- a/ext/mysqli/tests/bug74968.phpt
+++ b/ext/mysqli/tests/bug74968.phpt
@@ -7,13 +7,13 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli("$host:$port", $user, $passwd, $db);
- abstract class test {
- public $a;
- }
- $mysqli->query("SELECT 1 as a")->fetch_object("test");
+ $mysqli = new mysqli("$host:$port", $user, $passwd, $db);
+ abstract class test {
+ public $a;
+ }
+ $mysqli->query("SELECT 1 as a")->fetch_object("test");
?>
==DONE==
--EXPECTF--
diff --git a/ext/mysqli/tests/bug75018.phpt b/ext/mysqli/tests/bug75018.phpt
index 20d836166b..126775bd36 100644
--- a/ext/mysqli/tests/bug75018.phpt
+++ b/ext/mysqli/tests/bug75018.phpt
@@ -27,7 +27,7 @@ $sql = "SELECT bit_column_1 FROM $tbl";
$result = $mysqli->query($sql);
while ($row = $result->fetch_assoc()) {
- var_dump($row['bit_column_1']);
+ var_dump($row['bit_column_1']);
}
?>
diff --git a/ext/mysqli/tests/bug77956.phpt b/ext/mysqli/tests/bug77956.phpt
index b1f3b1eb40..5a374bfe23 100644
--- a/ext/mysqli/tests/bug77956.phpt
+++ b/ext/mysqli/tests/bug77956.phpt
@@ -45,11 +45,11 @@ mysqli.allow_local_infile=0
<?php
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$link->close();
unlink('bug77956.data');
diff --git a/ext/mysqli/tests/bug_bits.phpt b/ext/mysqli/tests/bug_bits.phpt
index 59752e4159..a4afa3e544 100644
--- a/ext/mysqli/tests/bug_bits.phpt
+++ b/ext/mysqli/tests/bug_bits.phpt
@@ -22,12 +22,12 @@ if (!$link->query("CREATE TABLE `bug_bits` (`inty` bigint(20) unsigned NOT NULL
}
$insertQuery = "INSERT INTO `bug_bits` VALUES (18446744073709551615, 18446744073709551615)".
- ",(18446744073709551614, 18446744073709551614)".
- ",(4294967296, 4294967296)".
- ",(4294967295, 4294967295)".
- ",(2147483648, 2147483648)".
- ",(2147483647, 2147483647)".
- ",(1, 1)";
+ ",(18446744073709551614, 18446744073709551614)".
+ ",(4294967296, 4294967296)".
+ ",(4294967295, 4294967295)".
+ ",(2147483648, 2147483648)".
+ ",(2147483647, 2147483647)".
+ ",(1, 1)";
if (!$link->query($insertQuery)) {
printf("[004] [%d] %s\n", $link->errno, $link->error);
}
@@ -37,7 +37,7 @@ if (!($res = $link->query("SELECT * FROM `bug_bits`"))) {
}
while ($row = $res->fetch_assoc()) {
- var_dump($row);
+ var_dump($row);
}
$link->close();
diff --git a/ext/mysqli/tests/bug_mysql_49406.phpt b/ext/mysqli/tests/bug_mysql_49406.phpt
index 74ea471702..73ca0ad882 100644
--- a/ext/mysqli/tests/bug_mysql_49406.phpt
+++ b/ext/mysqli/tests/bug_mysql_49406.phpt
@@ -7,90 +7,90 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END";
+ $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END";
- if (!$res = $link->query($query))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query($query))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = $res->fetch_row())
- printf("[003] No result, [%d] %s\n", $link->errno, $link->error);
+ if (!$row = $res->fetch_row())
+ printf("[003] No result, [%d] %s\n", $link->errno, $link->error);
- $res->free();
+ $res->free();
- if ($row[0] != '2009-12-03') {
- printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]);
- }
+ if ($row[0] != '2009-12-03') {
+ printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]);
+ }
- if (!$stmt = $link->prepare($query))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare($query))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->execute() || !$stmt->store_result())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->execute() || !$stmt->store_result())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
- $datatypes = array(
- MYSQLI_TYPE_TINY => "TINY",
- MYSQLI_TYPE_SHORT => "SHORT",
- MYSQLI_TYPE_LONG => "LONG",
- MYSQLI_TYPE_FLOAT => "FLOAT",
- MYSQLI_TYPE_DOUBLE => "DOUBLE",
- MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP",
- MYSQLI_TYPE_LONGLONG => "LONGLONG",
- MYSQLI_TYPE_INT24 => "INT24",
- MYSQLI_TYPE_DATE => "DATE",
- MYSQLI_TYPE_TIME => "TIME",
- MYSQLI_TYPE_DATETIME => "DATETIME",
- MYSQLI_TYPE_YEAR => "YEAR",
- MYSQLI_TYPE_ENUM => "ENUM",
- MYSQLI_TYPE_SET => "SET",
- MYSQLI_TYPE_TINY_BLOB => "TINYBLOB",
- MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB",
- MYSQLI_TYPE_LONG_BLOB => "LONGBLOB",
- MYSQLI_TYPE_BLOB => "BLOB",
- MYSQLI_TYPE_VAR_STRING => "VAR_STRING",
- MYSQLI_TYPE_STRING => "STRING",
- MYSQLI_TYPE_NULL => "NULL",
- MYSQLI_TYPE_NEWDATE => "NEWDATE",
- MYSQLI_TYPE_INTERVAL => "INTERVAL",
- MYSQLI_TYPE_GEOMETRY => "GEOMETRY",
- );
+ $datatypes = array(
+ MYSQLI_TYPE_TINY => "TINY",
+ MYSQLI_TYPE_SHORT => "SHORT",
+ MYSQLI_TYPE_LONG => "LONG",
+ MYSQLI_TYPE_FLOAT => "FLOAT",
+ MYSQLI_TYPE_DOUBLE => "DOUBLE",
+ MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP",
+ MYSQLI_TYPE_LONGLONG => "LONGLONG",
+ MYSQLI_TYPE_INT24 => "INT24",
+ MYSQLI_TYPE_DATE => "DATE",
+ MYSQLI_TYPE_TIME => "TIME",
+ MYSQLI_TYPE_DATETIME => "DATETIME",
+ MYSQLI_TYPE_YEAR => "YEAR",
+ MYSQLI_TYPE_ENUM => "ENUM",
+ MYSQLI_TYPE_SET => "SET",
+ MYSQLI_TYPE_TINY_BLOB => "TINYBLOB",
+ MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB",
+ MYSQLI_TYPE_LONG_BLOB => "LONGBLOB",
+ MYSQLI_TYPE_BLOB => "BLOB",
+ MYSQLI_TYPE_VAR_STRING => "VAR_STRING",
+ MYSQLI_TYPE_STRING => "STRING",
+ MYSQLI_TYPE_NULL => "NULL",
+ MYSQLI_TYPE_NEWDATE => "NEWDATE",
+ MYSQLI_TYPE_INTERVAL => "INTERVAL",
+ MYSQLI_TYPE_GEOMETRY => "GEOMETRY",
+ );
- $meta_res = $stmt->result_metadata();
- for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) {
- $field = $meta_res->fetch_field();
- printf("Field : %d\n", $field_idx);
- printf("Name : %s\n", $field->name);
- printf("Orgname : %s\n", $field->orgname);
- printf("Table : %s\n", $field->table);
- printf("Orgtable : %s\n", $field->orgtable);
- printf("Maxlength : %d\n", $field->max_length);
- printf("Length : %d\n", $field->length);
- printf("Charsetnr : %d\n", $field->charsetnr);
- printf("Flags : %d\n", $field->flags);
- printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown');
- printf("Decimals : %d\n", $field->decimals);
- }
+ $meta_res = $stmt->result_metadata();
+ for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) {
+ $field = $meta_res->fetch_field();
+ printf("Field : %d\n", $field_idx);
+ printf("Name : %s\n", $field->name);
+ printf("Orgname : %s\n", $field->orgname);
+ printf("Table : %s\n", $field->table);
+ printf("Orgtable : %s\n", $field->orgtable);
+ printf("Maxlength : %d\n", $field->max_length);
+ printf("Length : %d\n", $field->length);
+ printf("Charsetnr : %d\n", $field->charsetnr);
+ printf("Flags : %d\n", $field->flags);
+ printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown');
+ printf("Decimals : %d\n", $field->decimals);
+ }
- $row_stmt = null;
- if (!$stmt->bind_result($row_stmt) || !$stmt->fetch())
- printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
+ $row_stmt = null;
+ if (!$stmt->bind_result($row_stmt) || !$stmt->fetch())
+ printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($row[0] != $row_stmt) {
- printf("[008] PS and non-PS results differ, dumping data\n");
- var_dump($row[0]);
- var_dump($row_stmt);
- }
+ if ($row[0] != $row_stmt) {
+ printf("[008] PS and non-PS results differ, dumping data\n");
+ var_dump($row[0]);
+ var_dump($row_stmt);
+ }
- $stmt->close();
- $link->close();
+ $stmt->close();
+ $link->close();
- echo "done";
+ echo "done";
?>
--EXPECTF--
Field : %s
diff --git a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
index 35a9facd06..b799b6e3ac 100644
--- a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
+++ b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require('table.inc');
+ require_once("connect.inc");
+ require('table.inc');
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result()); // should return false
var_dump($link->store_result()); // now what happens here!?
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result());
var_dump($link->use_result());
diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt
index 7d90817769..36c5286a0c 100644
--- a/ext/mysqli/tests/mysqli_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_affected_rows.phpt
@@ -8,124 +8,124 @@ mysqli_affected_rows()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_affected_rows()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_affected_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_affected_rows($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_affected_rows($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[005] Expecting int/0, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[005] Expecting int/0, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
- mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')");
- if (-1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
+ mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')");
+ if (-1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (4 !== ($tmp = mysqli_affected_rows($link)))
- printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
+ if (4 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2"))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2"))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- $charsets = array('utf8');
- foreach ($charsets as $k => $charset) {
- if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset))))
- continue;
- mysqli_free_result($res);
- if (true !== ($tmp = mysqli_set_charset($link, $charset)))
- printf("[026] Expecting boolean/true got %s/%s\n",
- gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
- }
+ $charsets = array('utf8');
+ foreach ($charsets as $k => $charset) {
+ if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset))))
+ continue;
+ mysqli_free_result($res);
+ if (true !== ($tmp = mysqli_set_charset($link, $charset)))
+ printf("[026] Expecting boolean/true got %s/%s\n",
+ gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
+ }
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) {
- printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) {
+ printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) {
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) {
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_affected_rows($link)))
- printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_affected_rows($link)))
+ printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
index 51c82de87e..7b7bbdf4b7 100644
--- a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
+++ b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
@@ -8,103 +8,103 @@ mysqli->affected_rows
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli();
- if (false !== ($tmp = @$mysqli->affected_rows))
- printf("[000a] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ if (false !== ($tmp = @$mysqli->affected_rows))
+ printf("[000a] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"))
- printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"))
+ printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
- $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')");
- if (-1 !== ($tmp = $mysqli->affected_rows))
- printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
+ $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')");
+ if (-1 !== ($tmp = $mysqli->affected_rows))
+ printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
- printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
+ printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (4 !== ($tmp = $mysqli->affected_rows))
- printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
+ if (4 !== ($tmp = $mysqli->affected_rows))
+ printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')"))
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')"))
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')"))
- printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')"))
+ printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2"))
- printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2"))
+ printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) {
- printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) {
+ printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) {
- printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) {
+ printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->affected_rows))
- printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->affected_rows))
+ printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_auth_pam.phpt b/ext/mysqli/tests/mysqli_auth_pam.phpt
index 778e36f69c..aa2c6a818b 100644
--- a/ext/mysqli/tests/mysqli_auth_pam.phpt
+++ b/ext/mysqli/tests/mysqli_auth_pam.phpt
@@ -83,9 +83,9 @@ max_execution_time=240
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
- mysqli_query($link, 'DROP USER pamtest');
- mysqli_query($link, 'DROP USER pamtest@localhost');
+ require_once("clean_table.inc");
+ mysqli_query($link, 'DROP USER pamtest');
+ mysqli_query($link, 'DROP USER pamtest@localhost');
?>
--EXPECTF--
Warning: mysqli_real_connect(): (28000/1045): Access denied for user %s
diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt
index 96fd838850..c72d2522b9 100644
--- a/ext/mysqli/tests/mysqli_autocommit.phpt
+++ b/ext/mysqli/tests/mysqli_autocommit.phpt
@@ -17,127 +17,127 @@ mysqli_autocommit()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_autocommit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_autocommit()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_autocommit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_autocommit($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_autocommit($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_autocommit($link, $link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_autocommit($link, true)))
- printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_autocommit($link, true)))
+ printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'SET AUTOCOMMIT = 0'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET AUTOCOMMIT = 0'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if ($tmp['auto_commit'])
- printf("[008] Cannot turn off autocommit\n");
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if ($tmp['auto_commit'])
+ printf("[008] Cannot turn off autocommit\n");
- if (true !== ($tmp = mysqli_autocommit($link, true)))
- printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, true)))
+ printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['auto_commit'])
- printf("[011] Cannot turn on autocommit\n");
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['auto_commit'])
+ printf("[011] Cannot turn on autocommit\n");
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
- printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], mysqli_errno($link), mysqli_error($link));
+ if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
+ printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'SET AUTOCOMMIT = 1'))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET AUTOCOMMIT = 1'))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['auto_commit'])
- printf("[021] Cannot turn on autocommit\n");
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['auto_commit'])
+ printf("[021] Cannot turn on autocommit\n");
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (0 != $tmp['num'])
- printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (0 != $tmp['num'])
+ printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'COMMIT'))
- printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'COMMIT'))
+ printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
- printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
+ printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_autocommit($link, false)))
- printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_autocommit($link, false)))
+ printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_autocommit_oo.phpt b/ext/mysqli/tests/mysqli_autocommit_oo.phpt
index 80fd6c3039..99937b4d7a 100644
--- a/ext/mysqli/tests/mysqli_autocommit_oo.phpt
+++ b/ext/mysqli/tests/mysqli_autocommit_oo.phpt
@@ -18,116 +18,116 @@ mysqli->autocommit()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = $mysqli->autocommit(true)))
- printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = $mysqli->autocommit(true)))
+ printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('SET AUTOCOMMIT = 0'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET AUTOCOMMIT = 0'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if ($tmp['auto_commit'])
- printf("[005] Cannot turn off autocommit\n");
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if ($tmp['auto_commit'])
+ printf("[005] Cannot turn off autocommit\n");
- if (true !== ($tmp = $mysqli->autocommit( true)))
- printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->autocommit( true)))
+ printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['auto_commit'])
- printf("[008] Cannot turn on autocommit\n");
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['auto_commit'])
+ printf("[008] Cannot turn on autocommit\n");
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('ROLLBACK'))
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
- printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], $mysqli->errno, $mysqli->error);
+ if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
+ printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], $mysqli->errno, $mysqli->error);
- $res->free_result();
+ $res->free_result();
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('SET AUTOCOMMIT = 1'))
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET AUTOCOMMIT = 1'))
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['auto_commit'])
- printf("[018] Cannot turn on autocommit\n");
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['auto_commit'])
+ printf("[018] Cannot turn on autocommit\n");
- if (true !== ($tmp = $mysqli->autocommit( false)))
- printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->autocommit( false)))
+ printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('ROLLBACK'))
- printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- if (0 != $tmp['num'])
- printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- $res->free_result();
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ if (0 != $tmp['num'])
+ printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ $res->free_result();
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('COMMIT'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('COMMIT'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
- printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], $mysqli->errno, $mysqli->error);
- $res->free_result();
+ if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
+ printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], $mysqli->errno, $mysqli->error);
+ $res->free_result();
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->autocommit( false)))
- printf("[030] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->autocommit( false)))
+ printf("[030] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt
index 59c8277a5f..a4bbefce95 100644
--- a/ext/mysqli/tests/mysqli_begin_transaction.phpt
+++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt
@@ -15,104 +15,104 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_begin_transaction()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
- printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (true !== ($tmp = mysqli_autocommit($link, true)))
- printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- /* overrule autocommit */
- if (true !== ($tmp = mysqli_begin_transaction($link)))
- printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- /* empty */
- $res = mysqli_query($link, "SELECT * FROM test");
- var_dump($res->fetch_assoc());
-
- /* valid flags */
- $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT);
-
- if (mysqli_get_server_version($link) >= 50605) {
- $flags[] = MYSQLI_TRANS_START_READ_WRITE;
- $flags[] = MYSQLI_TRANS_START_READ_ONLY;
- }
-
- /* just coverage */
- foreach ($flags as $flag) {
- if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
-
- /* does it really set a flag? */
- if (mysqli_get_server_version($link) >= 50605) {
- if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) {
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- } else if (!mysqli_commit($link)) {
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- } else {
- $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
- }
- }
-
- if (!mysqli_begin_transaction($link, -1)) {
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_get_server_version($link) >= 50605) {
- /* does it like stupid names? */
- if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /* does it like stupid names? */
- if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "done!";
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_begin_transaction()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_begin_transaction($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
+ printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (true !== ($tmp = mysqli_autocommit($link, true)))
+ printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* overrule autocommit */
+ if (true !== ($tmp = mysqli_begin_transaction($link)))
+ printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* empty */
+ $res = mysqli_query($link, "SELECT * FROM test");
+ var_dump($res->fetch_assoc());
+
+ /* valid flags */
+ $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT);
+
+ if (mysqli_get_server_version($link) >= 50605) {
+ $flags[] = MYSQLI_TRANS_START_READ_WRITE;
+ $flags[] = MYSQLI_TRANS_START_READ_ONLY;
+ }
+
+ /* just coverage */
+ foreach ($flags as $flag) {
+ if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ /* does it really set a flag? */
+ if (mysqli_get_server_version($link) >= 50605) {
+ if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) {
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ } else if (!mysqli_commit($link)) {
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ } else {
+ $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
+ }
+ }
+
+ if (!mysqli_begin_transaction($link, -1)) {
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_get_server_version($link) >= 50605) {
+ /* does it like stupid names? */
+ if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ /* does it like stupid names? */
+ if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt
index 7b9f23cf9e..31d68b371d 100644
--- a/ext/mysqli/tests/mysqli_change_user.phpt
+++ b/ext/mysqli/tests/mysqli_change_user.phpt
@@ -8,141 +8,141 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_change_user()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_change_user()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_change_user($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_change_user($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_change_user($link, $link, $link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
- printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
+ printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- // Reconnect because after 3 failed change_user attempts, the server blocks you off.
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ // Reconnect because after 3 failed change_user attempts, the server blocks you off.
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[012] Cannot set test variable\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[012] Cannot set test variable\n");
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
+ printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
+ /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
(empty db = no db send with COM_CHANGE_USER) */
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
- printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
+ printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($tmp['dbname'] != "")
- printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']);
+ if ($tmp['dbname'] != "")
+ printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[022] Cannot set test variable\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[022] Cannot set test variable\n");
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (NULL !== $tmp['test_var'])
- printf("[028] Test variable is still set!\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (NULL !== $tmp['test_var'])
+ printf("[028] Test variable is still set!\n");
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
index 75d0930a83..29e9fe57e1 100644
--- a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
@@ -95,7 +95,7 @@ sleep(5);
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
Testing GET_LOCK()...
diff --git a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
index 960fd8dfea..252a354fc6 100644
--- a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
@@ -13,49 +13,49 @@ if (!$IS_MYSQLND) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (($insert_id = mysqli_insert_id($link)) !== 100)
- printf("[005] Expecting 100, got %d, [%d] %s\n",
- $insert_id,
- mysqli_errno($link), mysqli_error($link));
+ if (($insert_id = mysqli_insert_id($link)) !== 100)
+ printf("[005] Expecting 100, got %d, [%d] %s\n",
+ $insert_id,
+ mysqli_errno($link), mysqli_error($link));
- // LAST_INSERT_ID should be reset
- mysqli_change_user($link, $user, $passwd, $db);
+ // LAST_INSERT_ID should be reset
+ mysqli_change_user($link, $user, $passwd, $db);
- if (($insert_id = mysqli_insert_id($link)) !== 0)
- printf("[006] Expecting 0, got %d, [%d] %s\n",
- $insert_id,
- mysqli_errno($link), mysqli_error($link));
+ if (($insert_id = mysqli_insert_id($link)) !== 0)
+ printf("[006] Expecting 0, got %d, [%d] %s\n",
+ $insert_id,
+ mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if ($row['_insert_id'] != $insert_id)
- printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n",
- $row['_insert_id'], $insert_id);
+ if ($row['_insert_id'] != $insert_id)
+ printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n",
+ $row['_insert_id'], $insert_id);
- if ($row['_insert_id'] != 0)
- printf("Expecting 0 got %d\n", $row['_insert_id']);
+ if ($row['_insert_id'] != 0)
+ printf("Expecting 0 got %d\n", $row['_insert_id']);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
index a696743145..fd4e9943ab 100644
--- a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
@@ -9,95 +9,95 @@ die("skip - is the server still buggy?");
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot create second connection handle, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot create second connection handle, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, 'LOCK TABLE test WRITE'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'LOCK TABLE test WRITE'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /*
- if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) {
- printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
- mysqli_free_result($res);
- }
- */
+ /*
+ if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) {
+ printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
+ mysqli_free_result($res);
+ }
+ */
- // LOCKS should be removed
- mysqli_change_user($link, $user, $passwd, $db);
+ // LOCKS should be removed
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] < 1)
- printf("[005] There should be some rows in the table test\n");
+ if ($row['_num'] < 1)
+ printf("[005] There should be some rows in the table test\n");
- mysqli_free_result($res);
- mysqli_close($link2);
+ mysqli_free_result($res);
+ mysqli_close($link2);
- if (!mysqli_query($link, 'DROP TABLE test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] != 3)
- printf("[011] There should be three rows in the table test\n");
+ if ($row['_num'] != 3)
+ printf("[011] There should be three rows in the table test\n");
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // Temporary tables should be dropped
- mysqli_change_user($link, $user, $passwd, $db);
+ // Temporary tables should be dropped
+ mysqli_change_user($link, $user, $passwd, $db);
- if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) {
- printf("[012] There should be no table test any more, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- }
+ if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) {
+ printf("[012] There should be no table test any more, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+ }
- if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != 1)
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // GET_LOCK("phptest") should be released
- mysqli_change_user($link, $user, $passwd, $db);
+ // GET_LOCK("phptest") should be released
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[018] Lock 'phptest' should have been released, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != 1)
+ printf("[018] Lock 'phptest' should have been released, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_free_result($res);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_new.phpt b/ext/mysqli/tests/mysqli_change_user_new.phpt
index 47a80a288f..2b8993fc20 100644
--- a/ext/mysqli/tests/mysqli_change_user_new.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_new.phpt
@@ -15,25 +15,25 @@ if (mysqli_get_server_version($link) < 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* Pre 5.6: link remains useable */
- if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ /* Pre 5.6: link remains useable */
+ if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- var_dump($res->fetch_assoc());
+ if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ var_dump($res->fetch_assoc());
- print "done!";
+ print "done!";
?>
--EXPECT--
[003] [2006] MySQL server has gone away
diff --git a/ext/mysqli/tests/mysqli_change_user_old.phpt b/ext/mysqli/tests/mysqli_change_user_old.phpt
index 18c5dd08af..5f7246be90 100644
--- a/ext/mysqli/tests/mysqli_change_user_old.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_old.phpt
@@ -15,98 +15,98 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
- printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- // Reconnect because Percona and MariaDB block any commands after 3 failed
- // change_user commands
- mysqli_close($link);
+ // Reconnect because Percona and MariaDB block any commands after 3 failed
+ // change_user commands
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[012] Cannot set test variable\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[012] Cannot set test variable\n");
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (NULL !== $tmp['test_var'])
- printf("[019] Test variable is still set!\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (NULL !== $tmp['test_var'])
+ printf("[019] Test variable is still set!\n");
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
+ printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
+ /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
(empty db = no db send with COM_CHANGE_USER) */
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
- printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
+ printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($tmp['dbname'] != "")
- printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
+ if ($tmp['dbname'] != "")
+ printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
- printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_oo.phpt b/ext/mysqli/tests/mysqli_change_user_oo.phpt
index 00922a670b..2244335899 100644
--- a/ext/mysqli/tests/mysqli_change_user_oo.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_oo.phpt
@@ -16,65 +16,65 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- include_once("connect.inc");
+ include_once("connect.inc");
- $link = NULL;
- $tmp = NULL;
+ $link = NULL;
+ $tmp = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- // Reconnect because after 3 failed change_user attempts, the server blocks you off.
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ // Reconnect because after 3 failed change_user attempts, the server blocks you off.
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
- printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
+ printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (1 != $tmp['test_var'])
- printf("[011] Cannot set test variable\n");
+ if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (1 != $tmp['test_var'])
+ printf("[011] Cannot set test variable\n");
- if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db)))
- printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db)))
+ printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user'))
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
+ if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user'))
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (NULL !== $tmp['test_var'])
- printf("[017] Test variable is still set!\n");
+ if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (NULL !== $tmp['test_var'])
+ printf("[017] Test variable is still set!\n");
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db)))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
index 1f3eaceceb..4409d453ab 100644
--- a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
@@ -8,26 +8,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'"))
- printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'"))
+ printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_change_user($link, $user, $passwd, $db);
+ mysqli_change_user($link, $user, $passwd, $db);
- $wrong = null;
- if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) {
- printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong);
- } else {
- if ($stmt->errno == 0)
- printf("Error code 2013, 1243 or similar should have been set\n");
- }
+ $wrong = null;
+ if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) {
+ printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong);
+ } else {
+ if ($stmt->errno == 0)
+ printf("Error code 2013, 1243 or similar should have been set\n");
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_rollback.phpt b/ext/mysqli/tests/mysqli_change_user_rollback.phpt
index 9422c4ed05..44fd350b2c 100644
--- a/ext/mysqli/tests/mysqli_change_user_rollback.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_rollback.phpt
@@ -14,53 +14,53 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB'))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB'))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_autocommit($link, false);
+ mysqli_autocommit($link, false);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- $num = $row['_num'];
- assert($num > 0);
+ $num = $row['_num'];
+ assert($num > 0);
- if (!$res = mysqli_query($link, 'DELETE FROM test'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'DELETE FROM test'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (0 != $row['_num'])
- printf("[007] Rows should have been deleted in this transaction\n");
+ if (0 != $row['_num'])
+ printf("[007] Rows should have been deleted in this transaction\n");
- // DELETE should be rolled back
- mysqli_change_user($link, $user, $passwd, $db);
+ // DELETE should be rolled back
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] != $num)
- printf("[010] Expecting %d rows in the table test, found %d rows\n",
- $num, $row['_num']);
+ if ($row['_num'] != $num)
+ printf("[010] Expecting %d rows in the table test, found %d rows\n",
+ $num, $row['_num']);
- mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_free_result($res);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_set_names.phpt b/ext/mysqli/tests/mysqli_change_user_set_names.phpt
index 2c063af633..05d8669ba7 100644
--- a/ext/mysqli/tests/mysqli_change_user_set_names.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_set_names.phpt
@@ -23,135 +23,135 @@ if ($version[0] <= 4 && $version[1] < 1)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[$row['Charset']] = $row['Default collation'];
-
- mysqli_free_result($res);
- if (!mysqli_query($link, 'SET NAMES DEFAULT'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$defaults = mysqli_fetch_assoc($res))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- $not_changed = $defaults;
- foreach ($charsets as $charset => $collation) {
-
- if (isset($not_changed['charset_client']) &&
- $charset != $not_changed['charset_client'] &&
- mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset)))
- unset($not_changed['charset_client']);
-
- if (isset($not_changed['charset_connection']) &&
- $charset != $not_changed['charset_connection'] &&
- mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset)))
- unset($not_changed['charset_connection']);
-
- if (isset($not_changed['charset_results']) &&
- $charset != $not_changed['charset_results'] &&
- mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset)))
- unset($not_changed['charset_results']);
-
- if (isset($not_changed['collation_connection']) &&
- $collation != $not_changed['collation_connection'] &&
- mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation)))
- unset($not_changed['collation_connection']);
-
- if (isset($not_changed['collation_database']) &&
- $collation != $not_changed['collation_database'] &&
- mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation)))
- unset($not_changed['collation_database']);
-
- if (isset($not_changed['collation_server']) &&
- $collation != $not_changed['collation_server'] &&
- mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation)))
- unset($not_changed['collation_server']);
-
- if (empty($not_changed))
- break;
- }
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$modified = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($modified == $defaults)
- printf("[008] Not all settings have been changed\n");
-
- // LAST_INSERT_ID should be reset
- mysqli_change_user($link, $user, $passwd, $db);
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$new = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($new == $modified) {
- printf("[011] Charsets/collations have not been reset.\n");
- printf("Got:\n");
- var_dump($new);
- printf("Expected:\n");
- var_dump($defaults);
- }
-
- if ($new != $defaults) {
- printf("[012] Charsets/collations have not been reset to their defaults.\n");
- printf("Got:\n");
- var_dump($new);
- printf("Expected:\n");
- var_dump($defaults);
- }
-
- if (!is_object($charset = mysqli_get_charset($link)))
- printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
-
- if ($charset->charset != $defaults['charset_connection'])
- printf("[014] Expecting connection charset to be %s got %s\n",
- $defaults['charset_connection'],
- $charset->charset);
-
- if ($charset->collation != $defaults['collation_connection'])
- printf("[015] Expecting collation to be %s got %s\n",
- $defaults['collation_connection'],
- $charset->collation);
-
- mysqli_close($link);
- print "done!";
+ require_once('connect.inc');
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[$row['Charset']] = $row['Default collation'];
+
+ mysqli_free_result($res);
+ if (!mysqli_query($link, 'SET NAMES DEFAULT'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$defaults = mysqli_fetch_assoc($res))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ $not_changed = $defaults;
+ foreach ($charsets as $charset => $collation) {
+
+ if (isset($not_changed['charset_client']) &&
+ $charset != $not_changed['charset_client'] &&
+ mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset)))
+ unset($not_changed['charset_client']);
+
+ if (isset($not_changed['charset_connection']) &&
+ $charset != $not_changed['charset_connection'] &&
+ mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset)))
+ unset($not_changed['charset_connection']);
+
+ if (isset($not_changed['charset_results']) &&
+ $charset != $not_changed['charset_results'] &&
+ mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset)))
+ unset($not_changed['charset_results']);
+
+ if (isset($not_changed['collation_connection']) &&
+ $collation != $not_changed['collation_connection'] &&
+ mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation)))
+ unset($not_changed['collation_connection']);
+
+ if (isset($not_changed['collation_database']) &&
+ $collation != $not_changed['collation_database'] &&
+ mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation)))
+ unset($not_changed['collation_database']);
+
+ if (isset($not_changed['collation_server']) &&
+ $collation != $not_changed['collation_server'] &&
+ mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation)))
+ unset($not_changed['collation_server']);
+
+ if (empty($not_changed))
+ break;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$modified = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($modified == $defaults)
+ printf("[008] Not all settings have been changed\n");
+
+ // LAST_INSERT_ID should be reset
+ mysqli_change_user($link, $user, $passwd, $db);
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$new = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($new == $modified) {
+ printf("[011] Charsets/collations have not been reset.\n");
+ printf("Got:\n");
+ var_dump($new);
+ printf("Expected:\n");
+ var_dump($defaults);
+ }
+
+ if ($new != $defaults) {
+ printf("[012] Charsets/collations have not been reset to their defaults.\n");
+ printf("Got:\n");
+ var_dump($new);
+ printf("Expected:\n");
+ var_dump($defaults);
+ }
+
+ if (!is_object($charset = mysqli_get_charset($link)))
+ printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
+
+ if ($charset->charset != $defaults['charset_connection'])
+ printf("[014] Expecting connection charset to be %s got %s\n",
+ $defaults['charset_connection'],
+ $charset->charset);
+
+ if ($charset->collation != $defaults['collation_connection'])
+ printf("[015] Expecting collation to be %s got %s\n",
+ $defaults['collation_connection'],
+ $charset->collation);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_character_set.phpt b/ext/mysqli/tests/mysqli_character_set.phpt
index 52371d78e8..43b9c37ce8 100644
--- a/ext/mysqli/tests/mysqli_character_set.phpt
+++ b/ext/mysqli/tests/mysqli_character_set.phpt
@@ -12,92 +12,92 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] 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_query($link, 'SELECT version() AS server_version'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[004] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
- printf("[005] Cannot get list of available character sets, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[] = $row;
- mysqli_free_result($res);
-
- foreach ($charsets as $charset) {
- $k = $charset['Charset'];
- /* The server currently 17.07.2007 can't handle data sent in ucs2 */
- /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
- /* The server currently 02.09.2011 can't handle data sent in utf16le */
- if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) {
- continue;
- }
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']);
- if (!mysqli_query($link, $sql)) {
- printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_set_charset($link, $charset['Charset'])) {
- printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- for ($i = 1; $i <= 3; $i++) {
- if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')",
- $i, mysqli_real_escape_string($link, chr(ord("a") + $i)))))
- {
- var_dump($charset['Charset']);
- printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
- continue;
- }
- }
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
- printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- for ($i = 1; $i <= 3; $i++) {
-
- if (!$tmp = mysqli_fetch_assoc($res))
- printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- if ($tmp['id'] != $i)
- printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k,
- $i, $tmp['id'],
- mysqli_errno($link), mysqli_error($link));
-
- if ($tmp['label'] != chr(ord("a") + $i))
- printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k,
- chr(ord("a") + $i), $tmp['label'],
- mysqli_errno($link), mysqli_error($link));
-
- }
- mysqli_free_result($res);
- }
-
- mysqli_close($link);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] 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_query($link, 'SELECT version() AS server_version'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[004] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
+ printf("[005] Cannot get list of available character sets, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[] = $row;
+ mysqli_free_result($res);
+
+ foreach ($charsets as $charset) {
+ $k = $charset['Charset'];
+ /* The server currently 17.07.2007 can't handle data sent in ucs2 */
+ /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+ /* The server currently 02.09.2011 can't handle data sent in utf16le */
+ if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) {
+ continue;
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']);
+ if (!mysqli_query($link, $sql)) {
+ printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_set_charset($link, $charset['Charset'])) {
+ printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ for ($i = 1; $i <= 3; $i++) {
+ if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')",
+ $i, mysqli_real_escape_string($link, chr(ord("a") + $i)))))
+ {
+ var_dump($charset['Charset']);
+ printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+ printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ for ($i = 1; $i <= 3; $i++) {
+
+ if (!$tmp = mysqli_fetch_assoc($res))
+ printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ if ($tmp['id'] != $i)
+ printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k,
+ $i, $tmp['id'],
+ mysqli_errno($link), mysqli_error($link));
+
+ if ($tmp['label'] != chr(ord("a") + $i))
+ printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k,
+ chr(ord("a") + $i), $tmp['label'],
+ mysqli_errno($link), mysqli_error($link));
+
+ }
+ mysqli_free_result($res);
+ }
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt
index 90dd46fa73..9e499c6f47 100644
--- a/ext/mysqli/tests/mysqli_character_set_name.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name.phpt
@@ -8,68 +8,68 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
- require_once("connect.inc");
+ /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_character_set_name()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_character_set_name($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_character_set_name($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_character_set_name($link, $link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[005] 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_query($link, 'SELECT version() AS server_version'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+ if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[007] Need MySQL Server 4.1+ for the test!\n");
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[007] Need MySQL Server 4.1+ for the test!\n");
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['charset'])
- printf("[009] Cannot determine current character set and collation\n");
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['charset'])
+ printf("[009] Cannot determine current character set and collation\n");
- $charset = mysqli_character_set_name($link);
- if ($tmp['charset'] !== $charset) {
- if ($tmp['collation'] === $charset) {
- printf("[010] 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("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
- }
- }
+ $charset = mysqli_character_set_name($link);
+ if ($tmp['charset'] !== $charset) {
+ if ($tmp['collation'] === $charset) {
+ printf("[010] 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("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
+ }
+ }
- $charset2 = mysqli_character_set_name($link);
- if ($charset2 !== $charset) {
- printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset);
- }
+ $charset2 = mysqli_character_set_name($link);
+ if ($charset2 !== $charset) {
+ printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset);
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_character_set_name($link)))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_character_set_name($link)))
+ printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- /* Make sure that the function alias exists */
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Make sure that the function alias exists */
+ if (!is_null($tmp = @mysqli_character_set_name()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
index 562d8abefa..4d20baf0f6 100644
--- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
@@ -8,63 +8,63 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias]
?>
--FILE--
<?php
- /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
- require_once("connect.inc");
+ /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$mysqli->character_set_name($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT version() AS server_version'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+ if (!$res = $mysqli->query('SELECT version() AS server_version'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[007] Need MySQL Server 4.1+ for the test!\n");
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[007] Need MySQL Server 4.1+ for the test!\n");
- if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['charset'])
- printf("[009] Cannot determine current character set and collation\n");
+ if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['charset'])
+ printf("[009] Cannot determine current character set and collation\n");
- $charset = $mysqli->character_set_name();
- if ($tmp['charset'] !== $charset) {
- if ($tmp['collation'] === $charset) {
- printf("[010] 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("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
- }
- }
+ $charset = $mysqli->character_set_name();
+ if ($tmp['charset'] !== $charset) {
+ if ($tmp['collation'] === $charset) {
+ printf("[010] 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("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
+ }
+ }
- $charset2 = $mysqli->character_set_name();
- if ($charset2 !== $charset) {
- printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n",
- gettype($charset2), $charset2, gettype($charset), $charset);
- }
+ $charset2 = $mysqli->character_set_name();
+ if ($charset2 !== $charset) {
+ printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n",
+ gettype($charset2), $charset2, gettype($charset), $charset);
+ }
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->character_set_name()))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->character_set_name()))
+ printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- /* Make sure that the function alias exists */
- if (false !== ($tmp = @$mysqli->character_set_name()))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ /* Make sure that the function alias exists */
+ if (false !== ($tmp = @$mysqli->character_set_name()))
+ printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
index 78784210bb..27cf9f0fc6 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
@@ -8,80 +8,80 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $driver = new mysqli_driver();
-
- printf("Parent class:\n");
- var_dump(get_parent_class($driver));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($driver);
- $expected_methods = array();
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($expected_methods[$method]);
- unset($methods[$k]);
- }
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (empty($expected_methods) && empty($methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($driver)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($driver));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert(mysqli_get_client_info() === $driver->client_info);
- printf("driver->client_info = '%s'\n", $driver->client_info);
-
- assert(mysqli_get_client_version() === $driver->client_version);
- printf("driver->client_version = '%s'\n", $driver->client_version);
-
- assert($driver->driver_version > 0);
- printf("driver->driver_version = '%s'\n", $driver->driver_version);
-
- assert(in_array($driver->report_mode,
- array(
- MYSQLI_REPORT_ALL,
- MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ERROR,
- MYSQLI_REPORT_INDEX,
- MYSQLI_REPORT_OFF
- )
- ));
-
- printf("driver->report_mode = '%s'\n", $driver->report_mode);
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- assert($driver->report_mode === MYSQLI_REPORT_STRICT);
-
- assert(is_bool($driver->embedded));
- printf("driver->embedded = '%s'\n", $driver->embedded);
-
- printf("driver->reconnect = '%s'\n", $driver->reconnect);
-
- printf("\nAccess to undefined properties:\n");
- printf("driver->unknown = '%s'\n", @$driver->unknown);
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ $driver = new mysqli_driver();
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($driver));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($driver);
+ $expected_methods = array();
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($expected_methods[$method]);
+ unset($methods[$k]);
+ }
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (empty($expected_methods) && empty($methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($driver)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($driver));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(mysqli_get_client_info() === $driver->client_info);
+ printf("driver->client_info = '%s'\n", $driver->client_info);
+
+ assert(mysqli_get_client_version() === $driver->client_version);
+ printf("driver->client_version = '%s'\n", $driver->client_version);
+
+ assert($driver->driver_version > 0);
+ printf("driver->driver_version = '%s'\n", $driver->driver_version);
+
+ assert(in_array($driver->report_mode,
+ array(
+ MYSQLI_REPORT_ALL,
+ MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_OFF
+ )
+ ));
+
+ printf("driver->report_mode = '%s'\n", $driver->report_mode);
+ $driver->report_mode = MYSQLI_REPORT_STRICT;
+ assert($driver->report_mode === MYSQLI_REPORT_STRICT);
+
+ assert(is_bool($driver->embedded));
+ printf("driver->embedded = '%s'\n", $driver->embedded);
+
+ printf("driver->reconnect = '%s'\n", $driver->reconnect);
+
+ printf("\nAccess to undefined properties:\n");
+ printf("driver->unknown = '%s'\n", @$driver->unknown);
+
+ print "done!";
?>
--EXPECTF--
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
index 3e0cd8a7c1..6567dda9bc 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
@@ -16,10 +16,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_driver');
- inspectClass($class);
- print "done!";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_driver');
+ inspectClass($class);
+ print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli_driver'
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
index dfefb9098c..794f8eb241 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
@@ -8,257 +8,257 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
-
- $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($mysqli));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($mysqli);
- $expected_methods = array(
- '__construct' => true,
- 'autocommit' => true,
- 'begin_transaction' => true,
- 'change_user' => true,
- 'character_set_name' => true,
- 'close' => true,
- 'commit' => true,
- 'connect' => true,
- 'dump_debug_info' => true,
- 'escape_string' => true,
- 'get_charset' => true,
- 'get_client_info' => true,
- 'get_server_info' => true,
- 'get_warnings' => true,
- 'init' => true,
- 'kill' => true,
- 'more_results' => true,
- 'multi_query' => true,
- 'next_result' => true,
- 'options' => true,
- 'ping' => true,
- 'prepare' => true,
- 'query' => true,
- 'real_connect' => true,
- 'real_escape_string' => true,
- 'real_query' => true,
- 'refresh' => true,
- 'rollback' => true,
- 'release_savepoint' => true,
- 'savepoint' => true,
- 'select_db' => true,
- 'set_charset' => true,
- 'set_opt' => true,
- 'ssl_set' => true,
- 'stat' => true,
- 'stmt_init' => true,
- 'store_result' => true,
- 'thread_safe' => true,
- 'use_result' => true,
- );
-
- if ($IS_MYSQLND) {
- // mysqlnd only
- /* $expected_methods['get_client_stats'] = true; */
- $expected_methods['get_connection_stats'] = true;
- $expected_methods['reap_async_query'] = true;
- $expected_methods['poll'] = true;
- }
-
- /* we should add ruled when to expect them */
- if (function_exists('mysqli_debug'))
- $expected_methods['debug'] = true;
- if (function_exists('ssl_set'))
- $expected_methods['ssl_set'] = true;
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
-
- $expected_class_variables = $expected_object_variables = array(
- "affected_rows" => true,
- "client_info" => true,
- "client_version" => true,
- "connect_errno" => true,
- "connect_error" => true,
- "errno" => true,
- "error" => true,
- "field_count" => true,
- "host_info" => true,
- "info" => true,
- "insert_id" => true,
- "protocol_version" => true,
- "server_info" => true,
- "server_version" => true,
- "sqlstate" => true,
- "thread_id" => true,
- "warning_count" => true,
- );
-
- $expected_class_variables["error_list"] = true;
- $expected_object_variables["error_list"] = true;
-
- $variables = get_class_vars(get_class($mysqli));
- foreach ($variables as $var => $v) {
- if (isset($expected_class_variables[$var])) {
- unset($expected_class_variables[$var]);
- unset($variables[$var]);
- }
- }
-
- if (!empty($expected_class_variables)) {
- printf("Dumping list of missing class variables\n");
- var_dump($expected_class_variables);
- }
- if (!empty($variables)) {
- printf("Dumping list of unexpected class variables\n");
- var_dump($variables);
- }
- echo "ok\n";
-
- printf("\nObject variables:\n");
- $variables = get_object_vars($mysqli);
- foreach ($variables as $var => $v) {
- if (isset($expected_object_variables[$var])) {
- unset($expected_object_variables[$var]);
- unset($variables[$var]);
- }
- }
-
- if (!empty($expected_object_variables)) {
- printf("Dumping list of missing object variables\n");
- var_dump($expected_object_variables);
- }
- if (!empty($variables)) {
- printf("Dumping list of unexpected object variables\n");
- var_dump($variables);
- }
- echo "ok\n";
-
-
- printf("\nMagic, magic properties:\n");
-
- assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
- printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
- $mysqli->affected_rows, gettype($mysqli->affected_rows),
- mysqli_affected_rows($link), gettype(mysqli_affected_rows($link)));
-
- assert(mysqli_get_client_info() === $mysqli->client_info);
- printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->client_info, gettype($mysqli->client_info),
- mysqli_get_client_info(), gettype(mysqli_get_client_info()));
-
- assert(mysqli_get_client_version() === $mysqli->client_version);
- printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->client_version, gettype($mysqli->client_version),
- mysqli_get_client_version(), gettype(mysqli_get_client_version()));
-
- assert(mysqli_errno($link) === $mysqli->errno);
- printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
- $mysqli->errno, gettype($mysqli->errno),
- mysqli_errno($link), gettype(mysqli_errno($link)));
-
- assert(mysqli_error($link) === $mysqli->error);
- printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
- $mysqli->error, gettype($mysqli->error),
- mysqli_error($link), gettype(mysqli_error($link)));
-
- assert(mysqli_error_list($link) === $mysqli->error_list);
- assert(is_array($mysqli->error_list));
-
- assert(mysqli_field_count($link) === $mysqli->field_count);
- printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
- $mysqli->field_count, gettype($mysqli->field_count),
- mysqli_field_count($link), gettype(mysqli_field_count($link)));
-
- assert(mysqli_insert_id($link) === $mysqli->insert_id);
- printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
- $mysqli->insert_id, gettype($mysqli->insert_id),
- mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
-
- assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
- printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
- $mysqli->sqlstate, gettype($mysqli->sqlstate),
- mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
-
- assert(mysqli_get_host_info($link) === $mysqli->host_info);
- printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->host_info, gettype($mysqli->host_info),
- mysqli_get_host_info($link), gettype(mysqli_get_host_info($link)));
-
- /* note that the data types are different */
- assert(mysqli_info($link) == $mysqli->info);
- printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
- $mysqli->info, gettype($mysqli->info),
- mysqli_info($link), gettype(mysqli_info($link)));
-
- assert(mysqli_thread_id($link) > $mysqli->thread_id);
- assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
- printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
- $mysqli->thread_id, gettype($mysqli->thread_id),
- mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
-
- assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
- printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->protocol_version, gettype($mysqli->protocol_version),
- mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link)));
-
- assert(mysqli_get_server_info($link) === $mysqli->server_info);
- printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->server_info, gettype($mysqli->server_info),
- mysqli_get_server_info($link), gettype(mysqli_get_server_info($link)));
-
- assert(mysqli_get_server_version($link) === $mysqli->server_version);
- printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->server_version, gettype($mysqli->server_version),
- mysqli_get_server_version($link), gettype(mysqli_get_server_version($link)));
-
- assert(mysqli_warning_count($link) === $mysqli->warning_count);
- printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
- $mysqli->warning_count, gettype($mysqli->warning_count),
- mysqli_warning_count($link), gettype(mysqli_warning_count($link)));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
-
- @$mysqli->unknown = 13;
- printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $unknown = 'friday';
- @$mysqli->unknown = $unknown;
- printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
- assert(mysqli_connect_error() === $mysqli->connect_error);
- printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
- $mysqli->connect_error, gettype($mysqli->connect_error),
- mysqli_connect_error(), gettype(mysqli_connect_error()));
-
- assert(mysqli_connect_errno() === $mysqli->connect_errno);
- printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
- $mysqli->connect_errno, gettype($mysqli->connect_errno),
- mysqli_connect_errno(), gettype(mysqli_connect_errno()));
-
- print "done!";
+ require('connect.inc');
+
+ $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($mysqli));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($mysqli);
+ $expected_methods = array(
+ '__construct' => true,
+ 'autocommit' => true,
+ 'begin_transaction' => true,
+ 'change_user' => true,
+ 'character_set_name' => true,
+ 'close' => true,
+ 'commit' => true,
+ 'connect' => true,
+ 'dump_debug_info' => true,
+ 'escape_string' => true,
+ 'get_charset' => true,
+ 'get_client_info' => true,
+ 'get_server_info' => true,
+ 'get_warnings' => true,
+ 'init' => true,
+ 'kill' => true,
+ 'more_results' => true,
+ 'multi_query' => true,
+ 'next_result' => true,
+ 'options' => true,
+ 'ping' => true,
+ 'prepare' => true,
+ 'query' => true,
+ 'real_connect' => true,
+ 'real_escape_string' => true,
+ 'real_query' => true,
+ 'refresh' => true,
+ 'rollback' => true,
+ 'release_savepoint' => true,
+ 'savepoint' => true,
+ 'select_db' => true,
+ 'set_charset' => true,
+ 'set_opt' => true,
+ 'ssl_set' => true,
+ 'stat' => true,
+ 'stmt_init' => true,
+ 'store_result' => true,
+ 'thread_safe' => true,
+ 'use_result' => true,
+ );
+
+ if ($IS_MYSQLND) {
+ // mysqlnd only
+ /* $expected_methods['get_client_stats'] = true; */
+ $expected_methods['get_connection_stats'] = true;
+ $expected_methods['reap_async_query'] = true;
+ $expected_methods['poll'] = true;
+ }
+
+ /* we should add ruled when to expect them */
+ if (function_exists('mysqli_debug'))
+ $expected_methods['debug'] = true;
+ if (function_exists('ssl_set'))
+ $expected_methods['ssl_set'] = true;
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+
+ $expected_class_variables = $expected_object_variables = array(
+ "affected_rows" => true,
+ "client_info" => true,
+ "client_version" => true,
+ "connect_errno" => true,
+ "connect_error" => true,
+ "errno" => true,
+ "error" => true,
+ "field_count" => true,
+ "host_info" => true,
+ "info" => true,
+ "insert_id" => true,
+ "protocol_version" => true,
+ "server_info" => true,
+ "server_version" => true,
+ "sqlstate" => true,
+ "thread_id" => true,
+ "warning_count" => true,
+ );
+
+ $expected_class_variables["error_list"] = true;
+ $expected_object_variables["error_list"] = true;
+
+ $variables = get_class_vars(get_class($mysqli));
+ foreach ($variables as $var => $v) {
+ if (isset($expected_class_variables[$var])) {
+ unset($expected_class_variables[$var]);
+ unset($variables[$var]);
+ }
+ }
+
+ if (!empty($expected_class_variables)) {
+ printf("Dumping list of missing class variables\n");
+ var_dump($expected_class_variables);
+ }
+ if (!empty($variables)) {
+ printf("Dumping list of unexpected class variables\n");
+ var_dump($variables);
+ }
+ echo "ok\n";
+
+ printf("\nObject variables:\n");
+ $variables = get_object_vars($mysqli);
+ foreach ($variables as $var => $v) {
+ if (isset($expected_object_variables[$var])) {
+ unset($expected_object_variables[$var]);
+ unset($variables[$var]);
+ }
+ }
+
+ if (!empty($expected_object_variables)) {
+ printf("Dumping list of missing object variables\n");
+ var_dump($expected_object_variables);
+ }
+ if (!empty($variables)) {
+ printf("Dumping list of unexpected object variables\n");
+ var_dump($variables);
+ }
+ echo "ok\n";
+
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
+ printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
+ $mysqli->affected_rows, gettype($mysqli->affected_rows),
+ mysqli_affected_rows($link), gettype(mysqli_affected_rows($link)));
+
+ assert(mysqli_get_client_info() === $mysqli->client_info);
+ printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->client_info, gettype($mysqli->client_info),
+ mysqli_get_client_info(), gettype(mysqli_get_client_info()));
+
+ assert(mysqli_get_client_version() === $mysqli->client_version);
+ printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->client_version, gettype($mysqli->client_version),
+ mysqli_get_client_version(), gettype(mysqli_get_client_version()));
+
+ assert(mysqli_errno($link) === $mysqli->errno);
+ printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
+ $mysqli->errno, gettype($mysqli->errno),
+ mysqli_errno($link), gettype(mysqli_errno($link)));
+
+ assert(mysqli_error($link) === $mysqli->error);
+ printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
+ $mysqli->error, gettype($mysqli->error),
+ mysqli_error($link), gettype(mysqli_error($link)));
+
+ assert(mysqli_error_list($link) === $mysqli->error_list);
+ assert(is_array($mysqli->error_list));
+
+ assert(mysqli_field_count($link) === $mysqli->field_count);
+ printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli->field_count, gettype($mysqli->field_count),
+ mysqli_field_count($link), gettype(mysqli_field_count($link)));
+
+ assert(mysqli_insert_id($link) === $mysqli->insert_id);
+ printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
+ $mysqli->insert_id, gettype($mysqli->insert_id),
+ mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
+
+ assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
+ printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
+ $mysqli->sqlstate, gettype($mysqli->sqlstate),
+ mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
+
+ assert(mysqli_get_host_info($link) === $mysqli->host_info);
+ printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->host_info, gettype($mysqli->host_info),
+ mysqli_get_host_info($link), gettype(mysqli_get_host_info($link)));
+
+ /* note that the data types are different */
+ assert(mysqli_info($link) == $mysqli->info);
+ printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->info, gettype($mysqli->info),
+ mysqli_info($link), gettype(mysqli_info($link)));
+
+ assert(mysqli_thread_id($link) > $mysqli->thread_id);
+ assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
+ printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
+ $mysqli->thread_id, gettype($mysqli->thread_id),
+ mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
+
+ assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
+ printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->protocol_version, gettype($mysqli->protocol_version),
+ mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link)));
+
+ assert(mysqli_get_server_info($link) === $mysqli->server_info);
+ printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->server_info, gettype($mysqli->server_info),
+ mysqli_get_server_info($link), gettype(mysqli_get_server_info($link)));
+
+ assert(mysqli_get_server_version($link) === $mysqli->server_version);
+ printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->server_version, gettype($mysqli->server_version),
+ mysqli_get_server_version($link), gettype(mysqli_get_server_version($link)));
+
+ assert(mysqli_warning_count($link) === $mysqli->warning_count);
+ printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli->warning_count, gettype($mysqli->warning_count),
+ mysqli_warning_count($link), gettype(mysqli_warning_count($link)));
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
+
+ @$mysqli->unknown = 13;
+ printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $unknown = 'friday';
+ @$mysqli->unknown = $unknown;
+ printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
+ assert(mysqli_connect_error() === $mysqli->connect_error);
+ printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
+ $mysqli->connect_error, gettype($mysqli->connect_error),
+ mysqli_connect_error(), gettype(mysqli_connect_error()));
+
+ assert(mysqli_connect_errno() === $mysqli->connect_errno);
+ printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
+ $mysqli->connect_errno, gettype($mysqli->connect_errno),
+ mysqli_connect_errno(), gettype(mysqli_connect_errno()));
+
+ print "done!";
?>
--EXPECTF--
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
index b7f227a7c2..56446e3411 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
@@ -8,135 +8,135 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function dump_properties($mysqli) {
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($mysqli)));
- sort($variables);
- foreach ($variables as $k => $var) {
- printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
- }
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($mysqli));
- foreach ($variables as $k => $var) {
- printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
- }
-
- printf("\nMagic, magic properties:\n");
-
- assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
- printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
- @$mysqli->affected_rows, gettype(@$mysqli->affected_rows),
- @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
-
- assert(@mysqli_get_client_info() === @$mysqli->client_info);
- printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->client_info, gettype(@$mysqli->client_info),
- @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
-
- assert(@mysqli_get_client_version() === @$mysqli->client_version);
- printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->client_version, gettype(@$mysqli->client_version),
- @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
-
- assert(@mysqli_errno($mysqli) === @$mysqli->errno);
- printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
- @$mysqli->errno, gettype(@$mysqli->errno),
-
- @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
-
- assert(@mysqli_error($mysqli) === @$mysqli->error);
- printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
- @$mysqli->error, gettype(@$mysqli->error),
- @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
-
- assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
- printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
- @$mysqli->field_count, gettype(@$mysqli->field_count),
- @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
-
- assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
- printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
- @$mysqli->insert_id, gettype(@$mysqli->insert_id),
- @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
-
- assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
- printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
- @$mysqli->sqlstate, gettype(@$mysqli->sqlstate),
- @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
-
- assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
- printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->host_info, gettype(@$mysqli->host_info),
- @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
-
- /* note that the data types are different */
- assert(@mysqli_info($mysqli) == @$mysqli->info);
- printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->info, gettype(@$mysqli->info),
- @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
-
- assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
- assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
- printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
- @$mysqli->thread_id, gettype(@$mysqli->thread_id),
- @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
-
- assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
- printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->protocol_version, gettype(@$mysqli->protocol_version),
- @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
-
- assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
- printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->server_info, gettype(@$mysqli->server_info),
- @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
-
- assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
- printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->server_version, gettype(@$mysqli->server_version),
- @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
-
- assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
- printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
- @$mysqli->warning_count, gettype(@$mysqli->warning_count),
- @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
-
- @$mysqli->unknown = 13;
- printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $unknown = 'friday';
- @$mysqli->unknown = $unknown;
- printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
- assert(@mysqli_connect_error() === @$mysqli->connect_error);
- printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
- @$mysqli->connect_error, gettype(@$mysqli->connect_error),
- @mysqli_connect_error(), gettype(@mysqli_connect_error()));
-
- assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
- printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
- @$mysqli->connect_errno, gettype(@$mysqli->connect_errno),
- @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
- }
-
- printf("Without RS\n");
- $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
- dump_properties($mysqli);
-
- printf("With RS\n");
- $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
- $res = @$mysqli->query("SELECT * FROM test");
- dump_properties($mysqli);
-
- print "done!";
+ require('table.inc');
+
+ function dump_properties($mysqli) {
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($mysqli)));
+ sort($variables);
+ foreach ($variables as $k => $var) {
+ printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
+ }
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($mysqli));
+ foreach ($variables as $k => $var) {
+ printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
+ }
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
+ printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->affected_rows, gettype(@$mysqli->affected_rows),
+ @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
+
+ assert(@mysqli_get_client_info() === @$mysqli->client_info);
+ printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->client_info, gettype(@$mysqli->client_info),
+ @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
+
+ assert(@mysqli_get_client_version() === @$mysqli->client_version);
+ printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->client_version, gettype(@$mysqli->client_version),
+ @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
+
+ assert(@mysqli_errno($mysqli) === @$mysqli->errno);
+ printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->errno, gettype(@$mysqli->errno),
+
+ @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
+
+ assert(@mysqli_error($mysqli) === @$mysqli->error);
+ printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->error, gettype(@$mysqli->error),
+ @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
+
+ assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
+ printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->field_count, gettype(@$mysqli->field_count),
+ @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
+
+ assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
+ printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->insert_id, gettype(@$mysqli->insert_id),
+ @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
+
+ assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
+ printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->sqlstate, gettype(@$mysqli->sqlstate),
+ @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
+
+ assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
+ printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->host_info, gettype(@$mysqli->host_info),
+ @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
+
+ /* note that the data types are different */
+ assert(@mysqli_info($mysqli) == @$mysqli->info);
+ printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->info, gettype(@$mysqli->info),
+ @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
+
+ assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
+ assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
+ printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->thread_id, gettype(@$mysqli->thread_id),
+ @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
+
+ assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
+ printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->protocol_version, gettype(@$mysqli->protocol_version),
+ @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
+
+ assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
+ printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->server_info, gettype(@$mysqli->server_info),
+ @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
+
+ assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
+ printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->server_version, gettype(@$mysqli->server_version),
+ @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
+
+ assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
+ printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->warning_count, gettype(@$mysqli->warning_count),
+ @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
+
+ @$mysqli->unknown = 13;
+ printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $unknown = 'friday';
+ @$mysqli->unknown = $unknown;
+ printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
+ assert(@mysqli_connect_error() === @$mysqli->connect_error);
+ printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->connect_error, gettype(@$mysqli->connect_error),
+ @mysqli_connect_error(), gettype(@mysqli_connect_error()));
+
+ assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
+ printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->connect_errno, gettype(@$mysqli->connect_errno),
+ @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
+ }
+
+ printf("Without RS\n");
+ $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
+ dump_properties($mysqli);
+
+ printf("With RS\n");
+ $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
+ $res = @$mysqli->query("SELECT * FROM test");
+ dump_properties($mysqli);
+
+ print "done!";
?>
--CLEAN--
<?php require_once("clean_table.inc"); ?>
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
index 149356ac05..932f7bf2be 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
@@ -17,10 +17,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli');
- inspectClass($class);
- print "done!\n";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli');
+ inspectClass($class);
+ print "done!\n";
?>
--EXPECT--
Inspecting class 'mysqli'
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
index 7367a5cd7c..070b0a5b7c 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
@@ -8,151 +8,151 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysqli_result = $mysqli->query('SELECT * FROM test');
- $row = $mysqli_result->fetch_row();
-
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $res = mysqli_query($link, 'SELECT * FROM test');
- assert(mysqli_fetch_row($res) === $row);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($mysqli_result));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($mysqli_result);
- $expected_methods = array(
- '__construct' => true,
- 'close' => true,
- 'data_seek' => true,
- 'fetch_array' => true,
- 'fetch_assoc' => true,
- 'fetch_field' => true,
- 'fetch_field_direct' => true,
- 'fetch_fields' => true,
- 'fetch_object' => true,
- 'fetch_row' => true,
- 'field_seek' => true,
- 'free' => true,
- 'free_result' => true,
- );
- if ($IS_MYSQLND)
- $expected_methods['fetch_all'] = true;
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($expected_methods[$method]);
- unset($methods[$k]);
- }
- if ($method == 'mysqli_result') {
- // get_class_method reports different constructor names
- unset($expected_methods['__construct']);
- unset($methods[$k]);
- }
- }
-
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (empty($expected_methods) && empty($methods))
- printf("ok\n");
-
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($mysqli_result)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($mysqli_result));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field);
- printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->current_field, gettype($mysqli_result->current_field),
- $tmp, gettype($tmp));
-
- assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count);
- printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->field_count, gettype($mysqli_result->field_count),
- $tmp, gettype($tmp));
-
- assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
- printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n",
- ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'),
- gettype($mysqli_result->lengths),
- ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'),
- gettype($tmp));
-
- assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
- printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->num_rows, gettype($mysqli_result->num_rows),
- $tmp, gettype($tmp));
-
- assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT)));
- printf("mysqli_result->type = '%s'/%s\n",
- ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'),
- gettype($mysqli_result->type));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
-
- printf("\nConstructor:\n");
- if (!is_object($res = new mysqli_result($link)))
- printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res);
-
- if (null !== ($tmp = @$res->num_rows))
- printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, "SELECT id FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link)))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT)))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, 'invalid')))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
- do {
- $mode = mt_rand(-1000, 1000);
- } while (in_array($mode, $valid));
-
- if ($TEST_EXPERIMENTAL) {
- ob_start();
- if (!is_object($res = new mysqli_result($link, $mode)))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $content = ob_get_contents();
- ob_end_clean();
- if (!stristr($content, 'Invalid value for resultmode'))
- printf("[009] Expecting warning because of invalid resultmode\n");
- }
-
- if (!is_object($res = new mysqli_result('foo')))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT, 1)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysqli_result = $mysqli->query('SELECT * FROM test');
+ $row = $mysqli_result->fetch_row();
+
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $res = mysqli_query($link, 'SELECT * FROM test');
+ assert(mysqli_fetch_row($res) === $row);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($mysqli_result));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($mysqli_result);
+ $expected_methods = array(
+ '__construct' => true,
+ 'close' => true,
+ 'data_seek' => true,
+ 'fetch_array' => true,
+ 'fetch_assoc' => true,
+ 'fetch_field' => true,
+ 'fetch_field_direct' => true,
+ 'fetch_fields' => true,
+ 'fetch_object' => true,
+ 'fetch_row' => true,
+ 'field_seek' => true,
+ 'free' => true,
+ 'free_result' => true,
+ );
+ if ($IS_MYSQLND)
+ $expected_methods['fetch_all'] = true;
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($expected_methods[$method]);
+ unset($methods[$k]);
+ }
+ if ($method == 'mysqli_result') {
+ // get_class_method reports different constructor names
+ unset($expected_methods['__construct']);
+ unset($methods[$k]);
+ }
+ }
+
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (empty($expected_methods) && empty($methods))
+ printf("ok\n");
+
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($mysqli_result)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($mysqli_result));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field);
+ printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->current_field, gettype($mysqli_result->current_field),
+ $tmp, gettype($tmp));
+
+ assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count);
+ printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->field_count, gettype($mysqli_result->field_count),
+ $tmp, gettype($tmp));
+
+ assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
+ printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n",
+ ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'),
+ gettype($mysqli_result->lengths),
+ ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'),
+ gettype($tmp));
+
+ assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
+ printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->num_rows, gettype($mysqli_result->num_rows),
+ $tmp, gettype($tmp));
+
+ assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT)));
+ printf("mysqli_result->type = '%s'/%s\n",
+ ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'),
+ gettype($mysqli_result->type));
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
+
+ printf("\nConstructor:\n");
+ if (!is_object($res = new mysqli_result($link)))
+ printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res);
+
+ if (null !== ($tmp = @$res->num_rows))
+ printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_query($link, "SELECT id FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link)))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT)))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link, 'invalid')))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
+ do {
+ $mode = mt_rand(-1000, 1000);
+ } while (in_array($mode, $valid));
+
+ if ($TEST_EXPERIMENTAL) {
+ ob_start();
+ if (!is_object($res = new mysqli_result($link, $mode)))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $content = ob_get_contents();
+ ob_end_clean();
+ if (!stristr($content, 'Invalid value for resultmode'))
+ printf("[009] Expecting warning because of invalid resultmode\n");
+ }
+
+ if (!is_object($res = new mysqli_result('foo')))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT, 1)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ print "done!";
?>
--EXPECTF--
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
index 0383d704f6..cd74a07fed 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
@@ -17,10 +17,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_result');
- inspectClass($class);
- print "done!";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_result');
+ inspectClass($class);
+ print "done!";
?>
--EXPECT--
Inspecting class 'mysqli_result'
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
index 2adef27c3a..a534599141 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
@@ -8,76 +8,76 @@ Interface of the class mysqli_stmt
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($link);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($stmt));
-
- printf("\nMethods:\n");
-
- $methods = get_class_methods($stmt);
- $expected_methods = array(
- '__construct' => true,
- 'attr_get' => true,
- 'attr_set' => true,
- 'bind_param' => true,
- 'bind_result' => true,
- 'close' => true,
- 'data_seek' => true,
- 'execute' => true,
- 'fetch' => true,
- 'free_result' => true,
- 'get_warnings' => true,
- 'num_rows' => true,
- 'prepare' => true,
- 'reset' => true,
- 'result_metadata' => true,
- 'send_long_data' => true,
- 'store_result' => true,
- );
-
- if ($IS_MYSQLND) {
- $expected_methods['get_result'] = true;
- $expected_methods['more_results'] = true;
- $expected_methods['next_result'] = true;
- }
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- if ($method == 'mysqli_stmt') {
- // get_class_method reports different constructor names
- unset($expected_methods['__construct']);
- unset($methods[$k]);
- }
- }
- if (!empty($methods)) {
- printf("More methods found than indicated. Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Some methods are missing. Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($stmt)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($stmt));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
+ require('connect.inc');
+ require('table.inc');
+
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $stmt = new mysqli_stmt($link);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($stmt));
+
+ printf("\nMethods:\n");
+
+ $methods = get_class_methods($stmt);
+ $expected_methods = array(
+ '__construct' => true,
+ 'attr_get' => true,
+ 'attr_set' => true,
+ 'bind_param' => true,
+ 'bind_result' => true,
+ 'close' => true,
+ 'data_seek' => true,
+ 'execute' => true,
+ 'fetch' => true,
+ 'free_result' => true,
+ 'get_warnings' => true,
+ 'num_rows' => true,
+ 'prepare' => true,
+ 'reset' => true,
+ 'result_metadata' => true,
+ 'send_long_data' => true,
+ 'store_result' => true,
+ );
+
+ if ($IS_MYSQLND) {
+ $expected_methods['get_result'] = true;
+ $expected_methods['more_results'] = true;
+ $expected_methods['next_result'] = true;
+ }
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ if ($method == 'mysqli_stmt') {
+ // get_class_method reports different constructor names
+ unset($expected_methods['__construct']);
+ unset($methods[$k]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("More methods found than indicated. Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Some methods are missing. Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($stmt)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($stmt));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
index bdeee4903f..7c31979727 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
@@ -12,82 +12,82 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require('connect.inc');
-
- $warning = new mysqli_warning();
- $warning = new mysqli_warning(null);
- $warning = new mysqli_warning(null, null);
-
- $mysqli = new mysqli();
- $warning = new mysqli_warning($mysqli);
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysqli);
- $warning = new mysqli_warning($stmt);
-
- $stmt = $mysqli->stmt_init();
- $warning = new mysqli_warning($stmt);
-
- $obj = new stdClass();
- $warning = new mysqli_warning($obj);
-
- include("table.inc");
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")');
- $warning = mysqli_get_warnings($mysqli);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($warning));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($warning);
- $expected_methods = array(
- 'next' => true,
- );
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = get_class_vars(get_class($mysqli));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = get_object_vars($mysqli);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert('' === $warning->message);
- printf("warning->message = '%s'\n", $warning->message);
-
- assert('' === $warning->sqlstate);
- printf("warning->sqlstate= '%s'\n", $warning->sqlstate);
-
- assert(0 === $warning->errno);
- printf("warning->errno = '%s'\n", $warning->errno);
-
- printf("\nAccess to undefined properties:\n");
- printf("warning->unknown = '%s'\n", @$warning->unknown);
-
- print "done!";
+ require('connect.inc');
+
+ $warning = new mysqli_warning();
+ $warning = new mysqli_warning(null);
+ $warning = new mysqli_warning(null, null);
+
+ $mysqli = new mysqli();
+ $warning = new mysqli_warning($mysqli);
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $stmt = new mysqli_stmt($mysqli);
+ $warning = new mysqli_warning($stmt);
+
+ $stmt = $mysqli->stmt_init();
+ $warning = new mysqli_warning($stmt);
+
+ $obj = new stdClass();
+ $warning = new mysqli_warning($obj);
+
+ include("table.inc");
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")');
+ $warning = mysqli_get_warnings($mysqli);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($warning));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($warning);
+ $expected_methods = array(
+ 'next' => true,
+ );
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = get_class_vars(get_class($mysqli));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = get_object_vars($mysqli);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert('' === $warning->message);
+ printf("warning->message = '%s'\n", $warning->message);
+
+ assert('' === $warning->sqlstate);
+ printf("warning->sqlstate= '%s'\n", $warning->sqlstate);
+
+ assert(0 === $warning->errno);
+ printf("warning->errno = '%s'\n", $warning->errno);
+
+ printf("\nAccess to undefined properties:\n");
+ printf("warning->unknown = '%s'\n", @$warning->unknown);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
index c2093353aa..08f205047c 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
@@ -16,10 +16,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_warning');
- inspectClass($class);
- print "done!\n";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_warning');
+ inspectClass($class);
+ print "done!\n";
?>
--EXPECTF--
Inspecting class 'mysqli_warning'
diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt
index a300fb8314..f8bc8c690f 100644
--- a/ext/mysqli/tests/mysqli_close.phpt
+++ b/ext/mysqli/tests/mysqli_close.phpt
@@ -8,33 +8,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_close()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_close($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_close($link, $link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $tmp = @mysqli_close(NULL);
- if (NULL !== $tmp)
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = @mysqli_close(NULL);
+ if (NULL !== $tmp)
+ printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- $tmp = mysqli_close($link);
- if (true !== $tmp)
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_close($link);
+ if (true !== $tmp)
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = @mysqli_query($link, "SELECT 1")))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_query($link, "SELECT 1")))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt
index 305d5edf88..cb12bce426 100644
--- a/ext/mysqli/tests/mysqli_close_oo.phpt
+++ b/ext/mysqli/tests/mysqli_close_oo.phpt
@@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$mysqli->close($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $tmp = $mysqli->close();
- if (true !== $tmp)
- printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = $mysqli->close();
+ if (true !== $tmp)
+ printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = @$mysqli->close()))
- printf("[004] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->close()))
+ printf("[004] Expecting false got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = @$mysqli->query("SELECT 1")))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->query("SELECT 1")))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt
index 17a976f144..3c40aba034 100644
--- a/ext/mysqli/tests/mysqli_commit.phpt
+++ b/ext/mysqli/tests/mysqli_commit.phpt
@@ -15,59 +15,59 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_commit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_commit()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_commit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_commit($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_commit($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_commit($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_commit($link);
- if ($tmp !== true)
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_commit($link);
+ if ($tmp !== true)
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (1 != $tmp['num'])
- printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (1 != $tmp['num'])
+ printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_commit($link)))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_commit($link)))
+ printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt
index 4b55ab3de1..12f7ee1573 100644
--- a/ext/mysqli/tests/mysqli_commit_oo.phpt
+++ b/ext/mysqli/tests/mysqli_commit_oo.phpt
@@ -15,86 +15,86 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
- if (false !== ($tmp = @$mysqli->commit())) {
- printf("[013] Expecting false got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- if (true !== ($tmp = $mysqli->commit())) {
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (true !== ($tmp = $mysqli->autocommit(false))) {
- printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) {
- printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $tmp = $mysqli->commit();
- if ($tmp !== true) {
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli->query('ROLLBACK'))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) {
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $tmp = $res->fetch_assoc();
- if (1 != $tmp['num']) {
- printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
- }
- $res->free();
-
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->commit(0 , "tx_name0123")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "*/ nonsense")) {
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "tx_name ulf вендел")) {
- printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) {
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) {
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $mysqli->close();
-
- if (false !== ($tmp = @$mysqli->commit())) {
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $mysqli = new mysqli();
+ if (false !== ($tmp = @$mysqli->commit())) {
+ printf("[013] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ if (true !== ($tmp = $mysqli->commit())) {
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (true !== ($tmp = $mysqli->autocommit(false))) {
+ printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) {
+ printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $tmp = $mysqli->commit();
+ if ($tmp !== true) {
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) {
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $tmp = $res->fetch_assoc();
+ if (1 != $tmp['num']) {
+ printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
+ }
+ $res->free();
+
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->commit(0 , "tx_name0123")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "*/ nonsense")) {
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "tx_name ulf вендел")) {
+ printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) {
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) {
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $mysqli->close();
+
+ if (false !== ($tmp = @$mysqli->commit())) {
+ printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt
index 66cd94bd54..a64c69b9d8 100644
--- a/ext/mysqli/tests/mysqli_connect.phpt
+++ b/ext/mysqli/tests/mysqli_connect.phpt
@@ -8,145 +8,145 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- /* we need to check, if the server allows anonymous login (empty user) */
- $tmp = @mysqli_connect('localhost');
- $anon_allow = (gettype($tmp) == "object");
-
- $exptype = ($anon_allow) ? "mysqli_object" : "false";
-
- $obj = new stdClass();
- if (!is_null($tmp = @mysqli_connect($obj)))
- printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- $tmp = @mysqli_connect($link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- mysqli_close($link);
-
- if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
-
- if (false !== $link)
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) {
- printf("[011] Usage of mysqli.default_socket failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_port', $port);
- if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) {
- printf("[013] Usage of mysqli.default_port failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'"))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!is_object($link = mysqli_connect($host, $user))) {
- printf("[015] Usage of mysqli.default_pw failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'"))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_user', $user);
- if (!is_object($link = mysqli_connect($host))) {
- printf("[017] Usage of mysqli.default_user failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', $host);
- if (!is_object($link = mysqli_connect())) {
- printf("[019] Usage of mysqli.default_host failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- if ($IS_MYSQLND) {
- ini_set('mysqli.default_host', 'p:' . $host);
- if (!is_object($link = mysqli_connect())) {
- printf("[021] Usage of mysqli.default_host (persistent) failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
- printf("[023] Result looks strange - check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', 'p:');
- if (is_object($link = @mysqli_connect())) {
- printf("[024] Usage of mysqli.default_host=p: did not fail\n") ;
- mysqli_close($link);
- }
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ /* we need to check, if the server allows anonymous login (empty user) */
+ $tmp = @mysqli_connect('localhost');
+ $anon_allow = (gettype($tmp) == "object");
+
+ $exptype = ($anon_allow) ? "mysqli_object" : "false";
+
+ $obj = new stdClass();
+ if (!is_null($tmp = @mysqli_connect($obj)))
+ printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+
+ $tmp = @mysqli_connect($link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ mysqli_close($link);
+
+ if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+
+ if (false !== $link)
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) {
+ printf("[011] Usage of mysqli.default_socket failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) {
+ printf("[013] Usage of mysqli.default_port failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'"))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!is_object($link = mysqli_connect($host, $user))) {
+ printf("[015] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'"))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!is_object($link = mysqli_connect($host))) {
+ printf("[017] Usage of mysqli.default_user failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!is_object($link = mysqli_connect())) {
+ printf("[019] Usage of mysqli.default_host failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ if ($IS_MYSQLND) {
+ ini_set('mysqli.default_host', 'p:' . $host);
+ if (!is_object($link = mysqli_connect())) {
+ printf("[021] Usage of mysqli.default_host (persistent) failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+ printf("[023] Result looks strange - check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', 'p:');
+ if (is_object($link = @mysqli_connect())) {
+ printf("[024] Usage of mysqli.default_host=p: did not fail\n") ;
+ mysqli_close($link);
+ }
+ }
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_connect_attr.phpt b/ext/mysqli/tests/mysqli_connect_attr.phpt
index 97adfdcc51..c9836cdf6d 100644
--- a/ext/mysqli/tests/mysqli_connect_attr.phpt
+++ b/ext/mysqli/tests/mysqli_connect_attr.phpt
@@ -37,13 +37,13 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
$res = NULL;
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket);
//in case $host is empty, do not test for _server_host field
if (isset($host) && trim($host) != '') {
diff --git a/ext/mysqli/tests/mysqli_connect_errno.phpt b/ext/mysqli/tests/mysqli_connect_errno.phpt
index e596a1891a..acb76ca45f 100644
--- a/ext/mysqli/tests/mysqli_connect_errno.phpt
+++ b/ext/mysqli/tests/mysqli_connect_errno.phpt
@@ -8,33 +8,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // too many parameter
- if (0 !== ($tmp = @mysqli_connect_errno($link)))
- printf("[001] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
+ // too many parameter
+ if (0 !== ($tmp = @mysqli_connect_errno($link)))
+ printf("[001] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (0 !== ($tmp = mysqli_connect_errno()))
- printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_connect_errno()))
+ printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
- if (false !== $link)
- printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true));
+ $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
+ if (false !== $link)
+ printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true));
- if (0 === ($tmp = mysqli_connect_errno()))
- printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 === ($tmp = mysqli_connect_errno()))
+ printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_connect_error.phpt b/ext/mysqli/tests/mysqli_connect_error.phpt
index d0c79d6c71..8535d4a182 100644
--- a/ext/mysqli/tests/mysqli_connect_error.phpt
+++ b/ext/mysqli/tests/mysqli_connect_error.phpt
@@ -8,32 +8,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // too many parameter
- if (!is_null($tmp = @mysqli_connect_error($link)))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // too many parameter
+ if (!is_null($tmp = @mysqli_connect_error($link)))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = mysqli_connect_error()))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_connect_error()))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
+ if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
- if ('' === ($tmp = mysqli_connect_error()))
- printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp);
+ if ('' === ($tmp = mysqli_connect_error()))
+ printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_connect_oo.phpt b/ext/mysqli/tests/mysqli_connect_oo.phpt
index 15520d42b5..f0890459e9 100644
--- a/ext/mysqli/tests/mysqli_connect_oo.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo.phpt
@@ -8,143 +8,143 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $obj = new stdClass();
-
- if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno())
- printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
-
- if (false !== $mysqli)
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) {
- printf("[005] Usage of mysqli.default_socket failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_port', $port);
- if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) {
- printf("[006] Usage of mysqli.default_port failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) {
- printf("[007] Usage of mysqli.default_pw failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_user', $user);
- if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) {
- printf("[008] Usage of mysqli.default_user failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_host', $host);
- if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) {
- printf("[012] Failed to create mysqli object\n");
- } else {
- // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
- // We had long discussions on this and found that the ext/mysqli API as
- // such is broken. As we can't fix it, we document how it has behaved from
- // the first day on. And that's: no connection.
- if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
- printf("[013] There shall be no connection!\n");
- $mysqli->close();
- }
- }
-
- if ($IS_MYSQLND) {
- ini_set('mysqli.default_host', 'p:' . $host);
- if (!is_object($mysqli = new mysqli())) {
- // Due to an API flaw this shall not connect
- printf("[010] Failed to create mysqli object\n");
- } else {
- // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
- // We had long discussions on this and found that the ext/mysqli API as
- // such is broken. As we can't fix it, we document how it has behaved from
- // the first day on. And that's: no connection.
- if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
- printf("[011] There shall be no connection!\n");
- $mysqli->close();
- }
- }
- }
-
- print "... and now Exceptions\n";
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
-
- try {
- $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
- printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- }
-
- ini_set('mysqli.default_socket', $socket);
- try {
- $mysqli = new mysqli($host, $user, $passwd, $db, $port);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[017] Usage of mysqli.default_socket failed\n") ;
- }
-
- ini_set('mysqli.default_port', $port);
- try {
- $mysqli = new mysqli($host, $user, $passwd, $db);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[018] Usage of mysqli.default_port failed\n") ;
- }
-
- ini_set('mysqli.default_pw', $passwd);
- try {
- $mysqli = new mysqli($host, $user);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[019] Usage of mysqli.default_pw failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- try {
- $mysqli = new mysqli($host);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[020] Usage of mysqli.default_user failed\n") ;
- }
-
- ini_set('mysqli.default_host', $host);
- try {
- /* NOTE that at this point one must use a different syntax! */
- $mysqli = mysqli_init();
- $mysqli->real_connect();
- assert(0 === mysqli_connect_errno());
- $mysqli->close();
- assert(0 === mysqli_connect_errno());
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[021] Usage of mysqli.default_host failed\n");
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $obj = new stdClass();
+
+ if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno())
+ printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+
+ if (false !== $mysqli)
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) {
+ printf("[005] Usage of mysqli.default_socket failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) {
+ printf("[006] Usage of mysqli.default_port failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) {
+ printf("[007] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) {
+ printf("[008] Usage of mysqli.default_user failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) {
+ printf("[012] Failed to create mysqli object\n");
+ } else {
+ // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
+ // We had long discussions on this and found that the ext/mysqli API as
+ // such is broken. As we can't fix it, we document how it has behaved from
+ // the first day on. And that's: no connection.
+ if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
+ printf("[013] There shall be no connection!\n");
+ $mysqli->close();
+ }
+ }
+
+ if ($IS_MYSQLND) {
+ ini_set('mysqli.default_host', 'p:' . $host);
+ if (!is_object($mysqli = new mysqli())) {
+ // Due to an API flaw this shall not connect
+ printf("[010] Failed to create mysqli object\n");
+ } else {
+ // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
+ // We had long discussions on this and found that the ext/mysqli API as
+ // such is broken. As we can't fix it, we document how it has behaved from
+ // the first day on. And that's: no connection.
+ if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
+ printf("[011] There shall be no connection!\n");
+ $mysqli->close();
+ }
+ }
+ }
+
+ print "... and now Exceptions\n";
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
+
+ try {
+ $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
+ printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ }
+
+ ini_set('mysqli.default_socket', $socket);
+ try {
+ $mysqli = new mysqli($host, $user, $passwd, $db, $port);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[017] Usage of mysqli.default_socket failed\n") ;
+ }
+
+ ini_set('mysqli.default_port', $port);
+ try {
+ $mysqli = new mysqli($host, $user, $passwd, $db);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[018] Usage of mysqli.default_port failed\n") ;
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ try {
+ $mysqli = new mysqli($host, $user);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[019] Usage of mysqli.default_pw failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ try {
+ $mysqli = new mysqli($host);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[020] Usage of mysqli.default_user failed\n") ;
+ }
+
+ ini_set('mysqli.default_host', $host);
+ try {
+ /* NOTE that at this point one must use a different syntax! */
+ $mysqli = mysqli_init();
+ $mysqli->real_connect();
+ assert(0 === mysqli_connect_errno());
+ $mysqli->close();
+ assert(0 === mysqli_connect_errno());
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[021] Usage of mysqli.default_host failed\n");
+ }
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli::__construct(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
index cdc8049719..c5e65f7616 100644
--- a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
@@ -8,153 +8,153 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if ($socket != "")
- /* mysqli.default_socket requires non-empty string */
- ini_set('mysqli.default_socket', 'socket');
-
- ini_set('mysqli.default_port', 9999);
- ini_set('mysqli.default_pw', 'password');
- ini_set('mysqli.default_user', 'user');
- ini_set('mysqli.default_host', 'host');
-
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
-
- if ($socket != "") {
- ini_set('mysqli.default_socket', $socket);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user, $passwd, $db, $port);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing"))
- printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
-
- if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') {
- printf("[002] mysqli.default_socket not properly set?\n");
- var_dump($tmp);
- }
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[002] Usage of mysqli.default_socket failed\n");
- }
- }
-
- ini_set('mysqli.default_port', $port);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user, $passwd, $db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing"))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[004] Usage of mysqli.default_port failed\n");
- }
-
- ini_set('mysqli.default_pw', $passwd);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user);
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing"))
- printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[006] Usage of mysqli.default_pw failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host);
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing"))
- printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[008] Usage of mysqli.default_user failed\n");
- }
-
- ini_set('mysqli.default_host', $host);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect();
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 1"))
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username"))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if ($tmp['username'] !== $user)
- printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']);
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[012] Usage of mysqli.default_host failed\n");
- }
-
- try {
- $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port'));
- mysqli_select_db($link, $db);
- if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[014] Usage of mysqli_connect() has failed\n");
- }
-
- try {
- $link = mysqli_connect($host, $user, $passwd, null);
- mysqli_select_db($link, $db);
- if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[016] Usage of mysqli_connect() has failed\n");
- }
-
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if ($socket != "")
+ /* mysqli.default_socket requires non-empty string */
+ ini_set('mysqli.default_socket', 'socket');
+
+ ini_set('mysqli.default_port', 9999);
+ ini_set('mysqli.default_pw', 'password');
+ ini_set('mysqli.default_user', 'user');
+ ini_set('mysqli.default_host', 'host');
+
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
+
+ if ($socket != "") {
+ ini_set('mysqli.default_socket', $socket);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user, $passwd, $db, $port);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing"))
+ printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+
+ if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') {
+ printf("[002] mysqli.default_socket not properly set?\n");
+ var_dump($tmp);
+ }
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[002] Usage of mysqli.default_socket failed\n");
+ }
+ }
+
+ ini_set('mysqli.default_port', $port);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user, $passwd, $db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing"))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[004] Usage of mysqli.default_port failed\n");
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user);
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing"))
+ printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[006] Usage of mysqli.default_pw failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host);
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing"))
+ printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[008] Usage of mysqli.default_user failed\n");
+ }
+
+ ini_set('mysqli.default_host', $host);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect();
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 1"))
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username"))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if ($tmp['username'] !== $user)
+ printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']);
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[012] Usage of mysqli.default_host failed\n");
+ }
+
+ try {
+ $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port'));
+ mysqli_select_db($link, $db);
+ if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[014] Usage of mysqli_connect() has failed\n");
+ }
+
+ try {
+ $link = mysqli_connect($host, $user, $passwd, null);
+ mysqli_select_db($link, $db);
+ if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[016] Usage of mysqli_connect() has failed\n");
+ }
+
+
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
index 4b9d2096d0..05d5ba59e7 100644
--- a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
@@ -12,34 +12,34 @@ new mysqli()
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $myhost = 'invalidhost';
- $link = NULL;
-
- print "1) bail\n";
- if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
-
- print "2) be quiet\n";
- if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
- var_dump(mysqli_connect_error());
- var_dump(mysqli_connect_errno());
-
- print "3) bail\n";
- if (false !== ($link = mysqli_connect($myhost))) {
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
- }
-
- print "4) be quiet\n";
- if (false !== ($link = @mysqli_connect($myhost))) {
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
- }
- var_dump(mysqli_connect_error());
- var_dump(mysqli_connect_errno());
-
- print "done!";
+ require_once("connect.inc");
+
+ $myhost = 'invalidhost';
+ $link = NULL;
+
+ print "1) bail\n";
+ if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
+
+ print "2) be quiet\n";
+ if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
+ var_dump(mysqli_connect_error());
+ var_dump(mysqli_connect_errno());
+
+ print "3) bail\n";
+ if (false !== ($link = mysqli_connect($myhost))) {
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+ }
+
+ print "4) be quiet\n";
+ if (false !== ($link = @mysqli_connect($myhost))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+ }
+ var_dump(mysqli_connect_error());
+ var_dump(mysqli_connect_errno());
+
+ print "done!";
?>
--EXPECTF--
1) bail
diff --git a/ext/mysqli/tests/mysqli_connect_twice.phpt b/ext/mysqli/tests/mysqli_connect_twice.phpt
index c5ba7493c1..6fa6746537 100644
--- a/ext/mysqli/tests/mysqli_connect_twice.phpt
+++ b/ext/mysqli/tests/mysqli_connect_twice.phpt
@@ -8,69 +8,69 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = mysqli_thread_id($link))
- printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = mysqli_thread_id($link))
+ printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
- printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+ printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = $link->thread_id)
- printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = $link->thread_id)
+ printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
- printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+ printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
- !($row = $res->fetch_assoc()))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+ !($row = $res->fetch_assoc()))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_constants_categories.phpt b/ext/mysqli/tests/mysqli_constants_categories.phpt
index 6a90e3d3f0..d02463e20a 100644
--- a/ext/mysqli/tests/mysqli_constants_categories.phpt
+++ b/ext/mysqli/tests/mysqli_constants_categories.phpt
@@ -7,18 +7,18 @@ require_once('skipifemb.inc');
?>
--FILE--
<?php
- $constants = get_defined_constants(true);
+ $constants = get_defined_constants(true);
- foreach ($constants as $group => $consts) {
- foreach ($consts as $name => $value) {
- if (stristr($name, 'mysqli')) {
- if ('mysqli' != $group)
- printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group);
- }
- }
- }
+ foreach ($constants as $group => $consts) {
+ foreach ($consts as $name => $value) {
+ if (stristr($name, 'mysqli')) {
+ if ('mysqli' != $group)
+ printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group);
+ }
+ }
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt
index 656ca8545b..219be00613 100644
--- a/ext/mysqli/tests/mysqli_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek.phpt
@@ -8,60 +8,60 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_data_seek()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_data_seek()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_data_seek($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_data_seek($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_data_seek($link, $link)))
- printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_data_seek($link, $link)))
+ printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ require('table.inc');
+ if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_data_seek($res, 3)))
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_data_seek($res, 3)))
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $row = mysqli_fetch_assoc($res);
- if (4 != $row['id'])
- printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
+ $row = mysqli_fetch_assoc($res);
+ if (4 != $row['id'])
+ printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
- if (true !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $row = mysqli_fetch_assoc($res);
- if (1 != $row['id'])
- printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
+ $row = mysqli_fetch_assoc($res);
+ if (1 != $row['id'])
+ printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
- if (false !== ($tmp = mysqli_data_seek($res, 4)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 4)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_data_seek($res, -1)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, -1)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 3)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 3)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 1)))
+ printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
index 1940e1557c..0376a2a07c 100644
--- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
@@ -8,69 +8,69 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $res = new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->data_seek(0)))
- printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $res = new mysqli_result($mysqli);
+ if (false !== ($tmp = @$res->data_seek(0)))
+ printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @$res->data_seek()))
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @$res->data_seek()))
+ printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @$res->data_seek($link)))
- printf("[005] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @$res->data_seek($link)))
+ printf("[005] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @$res->data_seek($link, $link)))
- printf("[006] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @$res->data_seek($link, $link)))
+ printf("[006] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = $res->data_seek(3)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $res->data_seek(3)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $row = $res->fetch_assoc();
- if (4 != $row['id'])
- printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
+ $row = $res->fetch_assoc();
+ if (4 != $row['id'])
+ printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
- if (true !== ($tmp = $res->data_seek(0)))
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $res->data_seek(0)))
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $row = $res->fetch_assoc();
- if (1 != $row['id'])
- printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
+ $row = $res->fetch_assoc();
+ if (1 != $row['id'])
+ printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
- if (false !== ($tmp = $res->data_seek(4)))
- printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(4)))
+ printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $res->data_seek(-1)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(-1)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $res->free_result();
+ $res->free_result();
- if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = $res->data_seek(3)))
- printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(3)))
+ printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $res->free_result();
+ $res->free_result();
- if (false !== ($tmp = $res->data_seek(1)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(1)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- $mysqli->close();
+ $mysqli->close();
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug.phpt b/ext/mysqli/tests/mysqli_debug.phpt
index e405e3d8c7..dbe6fedd3a 100644
--- a/ext/mysqli/tests/mysqli_debug.phpt
+++ b/ext/mysqli/tests/mysqli_debug.phpt
@@ -17,49 +17,49 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (NULL !== ($tmp = @mysqli_debug()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_debug()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- // NOTE: documentation is not clear on this: function always return NULL or TRUE
- if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
- printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ // NOTE: documentation is not clear on this: function always return NULL or TRUE
+ if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
+ printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if ($IS_MYSQLND) {
- // let's make this mysqlnd only - for libmysql we need debug installation
+ if ($IS_MYSQLND) {
+ // let's make this mysqlnd only - for libmysql we need debug installation
- // table.inc will create a database connection and run some SQL queries, therefore
- // the debug file should have entries
- require_once('table.inc');
+ // table.inc will create a database connection and run some SQL queries, therefore
+ // the debug file should have entries
+ require_once('table.inc');
- clearstatcache();
- $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
- if (!file_exists($trace_file))
- printf("[003] Trace file '%s' has not been created\n", $trace_file);
- if (filesize($trace_file) < 50)
- printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
- $trace_file,
- filesize($trace_file));
+ clearstatcache();
+ $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
+ if (!file_exists($trace_file))
+ printf("[003] Trace file '%s' has not been created\n", $trace_file);
+ if (filesize($trace_file) < 50)
+ printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+ $trace_file,
+ filesize($trace_file));
- // will mysqli_debug() mind if the trace file gets removed?
- unlink($trace_file);
- clearstatcache();
+ // will mysqli_debug() mind if the trace file gets removed?
+ unlink($trace_file);
+ clearstatcache();
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- clearstatcache();
- if (!file_exists($trace_file))
- printf("[006] Trace file '%s' does not exist\n", $trace_file);
- unlink($trace_file);
- }
+ clearstatcache();
+ if (!file_exists($trace_file))
+ printf("[006] Trace file '%s' does not exist\n", $trace_file);
+ unlink($trace_file);
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_append.phpt b/ext/mysqli/tests/mysqli_debug_append.phpt
index 13f5d26320..9fd62a68af 100644
--- a/ext/mysqli/tests/mysqli_debug_append.phpt
+++ b/ext/mysqli/tests/mysqli_debug_append.phpt
@@ -22,70 +22,70 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platfo
?>
--FILE--
<?php
- require_once('connect.inc');
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
- printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- // table.inc will create a database connection and run some SQL queries, therefore
- // the debug file should have entries
- require_once('table.inc');
-
- clearstatcache();
- $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
- if (!file_exists($trace_file))
- printf("[002] Trace file '%s' has not been created\n", $trace_file);
- if (filesize($trace_file) < 50)
- printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
- $trace_file,
- filesize($trace_file));
-
- // will mysqli_debug() mind if the trace file gets removed?
- unlink($trace_file);
- clearstatcache();
-
- if (!$fp = fopen($trace_file, 'w')) {
- printf("[004] Cannot create trace file to test append mode\n");
- } else {
-
- if (!fwrite($fp, 'mysqli_debug.phpt test line'))
- printf("[005] Cannot write to trace file.\n");
- fclose($fp);
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file))))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
-
- $trace = file_get_contents($trace_file);
- if (!strstr($trace, 'mysqli_debug.phpt test line'))
- printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file))))
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
-
- if (!strstr(file_get_contents($trace_file), $trace))
- printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
- }
-
- // what will happen if we create new trace entries...?
- unlink($trace_file);
- clearstatcache();
- if (file_exists($trace_file))
- printf("[012] Could not remove trace file '%s'.\n", $trace_file);
-
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here."
+ require_once('connect.inc');
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
+ printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ // table.inc will create a database connection and run some SQL queries, therefore
+ // the debug file should have entries
+ require_once('table.inc');
+
+ clearstatcache();
+ $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
+ if (!file_exists($trace_file))
+ printf("[002] Trace file '%s' has not been created\n", $trace_file);
+ if (filesize($trace_file) < 50)
+ printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+ $trace_file,
+ filesize($trace_file));
+
+ // will mysqli_debug() mind if the trace file gets removed?
+ unlink($trace_file);
+ clearstatcache();
+
+ if (!$fp = fopen($trace_file, 'w')) {
+ printf("[004] Cannot create trace file to test append mode\n");
+ } else {
+
+ if (!fwrite($fp, 'mysqli_debug.phpt test line'))
+ printf("[005] Cannot write to trace file.\n");
+ fclose($fp);
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file))))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
+
+ $trace = file_get_contents($trace_file);
+ if (!strstr($trace, 'mysqli_debug.phpt test line'))
+ printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file))))
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
+
+ if (!strstr(file_get_contents($trace_file), $trace))
+ printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
+ }
+
+ // what will happen if we create new trace entries...?
+ unlink($trace_file);
+ clearstatcache();
+ if (file_exists($trace_file))
+ printf("[012] Could not remove trace file '%s'.\n", $trace_file);
+
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here."
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_control_string.phpt b/ext/mysqli/tests/mysqli_debug_control_string.phpt
index 8c860acef7..cce3c9db1e 100644
--- a/ext/mysqli/tests/mysqli_debug_control_string.phpt
+++ b/ext/mysqli/tests/mysqli_debug_control_string.phpt
@@ -20,57 +20,57 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function try_control_string($link, $control_string, $trace_file, $offset) {
+ function try_control_string($link, $control_string, $trace_file, $offset) {
- if (true !== ($tmp = mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
+ if (true !== ($tmp = mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
- unlink($trace_file);
- }
+ unlink($trace_file);
+ }
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
- try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10);
- try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20);
- try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30);
- try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40);
- try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50);
- try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60);
- try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70);
- try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80);
- try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);#
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+ try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10);
+ try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20);
+ try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30);
+ try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40);
+ try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50);
+ try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60);
+ try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70);
+ try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80);
+ try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);#
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here."
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here."
?>
--EXPECTF--
[023][control string '%s'] Trace file has not been written.
diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
index 938d7205dc..35eab2dd1e 100644
--- a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
+++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
@@ -20,206 +20,206 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- function try_control_string($link, $control_string, $trace_file, $offset) {
-
- @unlink($trace_file);
- if (true !== ($tmp = @mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
-
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- return trim(substr(file_get_contents($trace_file), 0, 100024));
- }
-
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
-
- $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- // T - gettimeofday() system call, system dependent format
- // 16:57:03.350734 >mysql_real_query
- $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20);
- if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace))
- printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // i - add PID of the current process
- // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process
- if (false === ($pid = getmypid()))
- $pid = "[\d]+";
-
- $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30);
- if (!preg_match("@^" . $pid . "*@ismU", $trace))
- printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // L - line numbers
- $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40);
- if (!preg_match("@^[\d]+@ismU", $trace))
- printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // F - file name
- $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50);
- // hopefully we'll never see a file name that's not covered by this regular expression...
- if (!preg_match("@^\s*[/\w\\\\d\.:\-]+\.[ch]@ismU", $trace))
- printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // -n - print function nesting depth
- $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60);
- if (!preg_match("@^\d+:@ismU", $trace))
- printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // -t,[N] - maximum nesting level
- $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70);
- $lines = explode("\n", $trace);
- foreach ($lines as $k => $line) {
- $line = trim($line);
- if (!preg_match("@^(\d+):+@ismU", $line, $matches)) {
- printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80));
- } else {
- if (!isset($matches[1]) || ((int)$matches[1] > 1)) {
- printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n",
- $matches[1],
- substr($line, 0, 80));
- }
- }
- }
-
- // omitting t
- $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80);
- $lines = explode("\n", $trace);
- foreach ($lines as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) {
- printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n",
- substr($line, 0, 80));
- }
- }
-
- // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions
- $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90));
- $functions_all_funcs = array();
- foreach ($lines_all_funcs as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_all_funcs[$matches[1]] = $matches[1];
- }
- }
-
- $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100));
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $tmp = array_diff($functions_all_funcs, $functions_trace);
- if (!empty($tmp)) {
- printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff.");
- var_dump($tmp);
- }
-
- // get two or three function names to play with...
- $test_functions = array('simple' => array(), 'doubledot' => array());
-
- foreach ($functions_all_funcs as $func) {
- if (count($test_functions['simple']) < 2 && !strstr($func, '::'))
- $test_functions['simple'][$func] = $func;
- else if (count($test_functions['doubledot']) < 2 && strstr($func, '::'))
- $test_functions['doubledot'][$func] = $func;
- }
-
- $control_string = '';
- if ($func = reset($test_functions['simple']))
- $control_string .= sprintf('%s,', $func);
- if ($func = reset($test_functions['doubledot']))
- $control_string .= sprintf('%s,', $func);
- if ($func = next($test_functions['simple']))
- $control_string .= sprintf('%s,', $func);
- if ($func = next($test_functions['doubledot']))
- $control_string .= sprintf('%s,', $func);
- $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file);
-
- $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110));
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- foreach ($test_functions['simple'] as $func)
- if (isset($functions_trace[$func])) {
- unset($functions_trace[$func]);
- unset($test_functions['simple'][$func]);
- }
-
- foreach ($test_functions['doubledot'] as $func)
- if (isset($functions_trace[$func])) {
- unset($functions_trace[$func]);
- unset($test_functions['doubledot'][$func]);
- }
-
- if (!empty($functions_trace)) {
- printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n",
- $control_string);
- var_dump($functions_trace);
- }
- $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']);
- if (!empty($tmp)) {
- printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n",
- $control_string);
- var_dump($tmp);
- }
-
- if ($IS_MYSQLND) {
- // mysqlnd only option
- // m - trace memory allocations
- $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120);
- if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) &&
- !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) {
- printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n");
- var_dump($trace);
- }
-
- }
-
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here.";
- @unlink($trace_file);
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ function try_control_string($link, $control_string, $trace_file, $offset) {
+
+ @unlink($trace_file);
+ if (true !== ($tmp = @mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ return trim(substr(file_get_contents($trace_file), 0, 100024));
+ }
+
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+
+ $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ // T - gettimeofday() system call, system dependent format
+ // 16:57:03.350734 >mysql_real_query
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20);
+ if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace))
+ printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // i - add PID of the current process
+ // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process
+ if (false === ($pid = getmypid()))
+ $pid = "[\d]+";
+
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30);
+ if (!preg_match("@^" . $pid . "*@ismU", $trace))
+ printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // L - line numbers
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40);
+ if (!preg_match("@^[\d]+@ismU", $trace))
+ printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // F - file name
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50);
+ // hopefully we'll never see a file name that's not covered by this regular expression...
+ if (!preg_match("@^\s*[/\w\\\\d\.:\-]+\.[ch]@ismU", $trace))
+ printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // -n - print function nesting depth
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60);
+ if (!preg_match("@^\d+:@ismU", $trace))
+ printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // -t,[N] - maximum nesting level
+ $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70);
+ $lines = explode("\n", $trace);
+ foreach ($lines as $k => $line) {
+ $line = trim($line);
+ if (!preg_match("@^(\d+):+@ismU", $line, $matches)) {
+ printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80));
+ } else {
+ if (!isset($matches[1]) || ((int)$matches[1] > 1)) {
+ printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n",
+ $matches[1],
+ substr($line, 0, 80));
+ }
+ }
+ }
+
+ // omitting t
+ $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80);
+ $lines = explode("\n", $trace);
+ foreach ($lines as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) {
+ printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n",
+ substr($line, 0, 80));
+ }
+ }
+
+ // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions
+ $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90));
+ $functions_all_funcs = array();
+ foreach ($lines_all_funcs as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_all_funcs[$matches[1]] = $matches[1];
+ }
+ }
+
+ $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $tmp = array_diff($functions_all_funcs, $functions_trace);
+ if (!empty($tmp)) {
+ printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff.");
+ var_dump($tmp);
+ }
+
+ // get two or three function names to play with...
+ $test_functions = array('simple' => array(), 'doubledot' => array());
+
+ foreach ($functions_all_funcs as $func) {
+ if (count($test_functions['simple']) < 2 && !strstr($func, '::'))
+ $test_functions['simple'][$func] = $func;
+ else if (count($test_functions['doubledot']) < 2 && strstr($func, '::'))
+ $test_functions['doubledot'][$func] = $func;
+ }
+
+ $control_string = '';
+ if ($func = reset($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = reset($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file);
+
+ $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ foreach ($test_functions['simple'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['simple'][$func]);
+ }
+
+ foreach ($test_functions['doubledot'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['doubledot'][$func]);
+ }
+
+ if (!empty($functions_trace)) {
+ printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n",
+ $control_string);
+ var_dump($functions_trace);
+ }
+ $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']);
+ if (!empty($tmp)) {
+ printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n",
+ $control_string);
+ var_dump($tmp);
+ }
+
+ if ($IS_MYSQLND) {
+ // mysqlnd only option
+ // m - trace memory allocations
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120);
+ if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) &&
+ !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) {
+ printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n");
+ var_dump($trace);
+ }
+
+ }
+
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here.";
+ @unlink($trace_file);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
index 8343a99048..6eef97a2d9 100644
--- a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
+++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
@@ -21,108 +21,108 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- function try_control_string($link, $control_string, $trace_file, $offset) {
-
- @unlink($trace_file);
- if (true !== ($tmp = @mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
-
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- return trim(substr(file_get_contents($trace_file), 0, 100024));
- }
-
- $memory_funcs = array(
- '_mysqlnd_ecalloc',
- '_mysqlnd_emalloc',
- '_mysqlnd_palloc_free_thd_cache_reference',
- '_mysqlnd_pecalloc',
- '_mysqlnd_pefree',
- '_mysqlnd_pemalloc',
- '_mysqlnd_perealloc',
- );
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
-
- $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- $lines_trace = explode("\n", $trace);
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $found = 0;
- foreach ($memory_funcs as $k => $name)
- if (isset($functions_trace[$name]))
- $found++;
-
- if ($found < 1) {
- printf("[016] Only %d memory functions have been found, expecting at least %d.\n",
- $found, 1);
- var_dump($trace);
- }
-
- $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- $lines_trace = explode("\n", $trace);
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $found = 0;
- foreach ($memory_funcs as $k => $name)
- if (isset($functions_trace[$name]))
- $found++;
-
- if ($found > 2) {
- printf("[026] More than %d memory functions have been recorded, that's strange.\n",
- $found);
- var_dump($trace);
- }
-
- mysqli_close($link);
- @unlink($trace_file);
- print "done!";
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ function try_control_string($link, $control_string, $trace_file, $offset) {
+
+ @unlink($trace_file);
+ if (true !== ($tmp = @mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ return trim(substr(file_get_contents($trace_file), 0, 100024));
+ }
+
+ $memory_funcs = array(
+ '_mysqlnd_ecalloc',
+ '_mysqlnd_emalloc',
+ '_mysqlnd_palloc_free_thd_cache_reference',
+ '_mysqlnd_pecalloc',
+ '_mysqlnd_pefree',
+ '_mysqlnd_pemalloc',
+ '_mysqlnd_perealloc',
+ );
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+
+ $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ $lines_trace = explode("\n", $trace);
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $found = 0;
+ foreach ($memory_funcs as $k => $name)
+ if (isset($functions_trace[$name]))
+ $found++;
+
+ if ($found < 1) {
+ printf("[016] Only %d memory functions have been found, expecting at least %d.\n",
+ $found, 1);
+ var_dump($trace);
+ }
+
+ $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ $lines_trace = explode("\n", $trace);
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $found = 0;
+ foreach ($memory_funcs as $k => $name)
+ if (isset($functions_trace[$name]))
+ $found++;
+
+ if ($found > 2) {
+ printf("[026] More than %d memory functions have been recorded, that's strange.\n",
+ $found);
+ var_dump($trace);
+ }
+
+ mysqli_close($link);
+ @unlink($trace_file);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
index 5f1c1b8b17..a5cfe35342 100644
--- a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
+++ b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
@@ -12,31 +12,31 @@ if (!function_exists('mysqli_disable_reads_from_master')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_disable_reads_from_master()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_disable_reads_from_master()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_disable_reads_from_master($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_disable_reads_from_master($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = mysqli_disable_reads_from_master($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_disable_reads_from_master($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt
index 9f70cb4899..d4fa124a59 100644
--- a/ext/mysqli/tests/mysqli_driver.phpt
+++ b/ext/mysqli/tests/mysqli_driver.phpt
@@ -8,106 +8,106 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require("table.inc");
-
- if (!is_object($driver = new mysqli_driver()))
- printf("[001] Failed to create mysqli_driver object\n");
-
- $client_info = mysqli_get_client_info();
- if (($tmp = $driver->client_info) !== $client_info)
- printf("[002] Expecting %s/%s, got %s/%s\n",
- gettype($client_info), $client_info,
- gettype($tmp), $tmp);
-
- $client_version = mysqli_get_client_version();
- if (($tmp = $driver->client_version) !== $client_version)
- printf("[003] Expecting %s/%s, got %s/%s\n",
- gettype($client_version), $client_version,
- gettype($tmp), $tmp);
-
- if (!is_int($tmp = $driver->driver_version) || (0 == $tmp))
- printf("[004] Expecting int/any, got %s/%s\n",
- gettype($tmp), $tmp);
-
-
- $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
- $report_mode = $driver->report_mode;
- if (!is_int($report_mode))
- printf("[005] Expecting int/any, got %s/%s\n",
- gettype($report_mode), $report_mode);
-
- if (!in_array($report_mode, $all_modes))
- printf("[006] Illegal report mode returned? Got %s, expected %s\n",
- $report_mode, implode(', ', $all_modes));
-
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- $ok = false;
- try {
-
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
-
- } catch (mysqli_sql_exception $e) {
- $ok = true;
- if ('' == $e->getMessage())
- printf("[008] getMessage() has returned an empty string.\n");
- if ('' == $e->getCode())
- printf("[009] getCode() has returned an empty string.\n");
- if ('' == $e->getFile())
- printf("[010] getFile() has returned an empty string.\n");
- if ('' == $e->getLine())
- printf("[011] getLine() has returned an empty string.\n");
- $tmp = $e->getTrace();
- if (empty($tmp))
- printf("[012] getTrace() has returned an empty array.\n");
- if ('' == $e->getTraceAsString())
- printf("[013] getTraceAsString() has returned an empty string.\n");
- if ('' == $e->__toString())
- printf("[014] __toString() has returned an empty string.\n");
-
- }
- if (!$ok)
- printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
-
-
- $driver->report_mode = MYSQLI_REPORT_OFF;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
- mysqli_close($link);
-
- $driver->report_mode = MYSQLI_REPORT_ERROR;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
- mysqli_close($link);
-
- if (MYSQLI_REPORT_ERROR !== $driver->report_mode)
- printf("[018] Error mode should be different\n");
-
- /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
-
- $driver->report_mode = $report_mode;
-
- $reconnect = $driver->reconnect;
- if (!is_bool($reconnect))
- printf("[019] Expecting boolean/any, got %s/%s\n",
- gettype($reconnect), $reconnect);
-
- /* pointless, but I need more documentation */
- $driver->reconnect = true;
- $driver->reconnect = false;
- $driver->reconnect = $reconnect;
-
- if (!is_bool($embedded = $driver->embedded))
- printf("[020] Expecting boolean/any, got %s/%s\n",
- gettype($embedded), $embedded);
-
- print "done!";
+ require("table.inc");
+
+ if (!is_object($driver = new mysqli_driver()))
+ printf("[001] Failed to create mysqli_driver object\n");
+
+ $client_info = mysqli_get_client_info();
+ if (($tmp = $driver->client_info) !== $client_info)
+ printf("[002] Expecting %s/%s, got %s/%s\n",
+ gettype($client_info), $client_info,
+ gettype($tmp), $tmp);
+
+ $client_version = mysqli_get_client_version();
+ if (($tmp = $driver->client_version) !== $client_version)
+ printf("[003] Expecting %s/%s, got %s/%s\n",
+ gettype($client_version), $client_version,
+ gettype($tmp), $tmp);
+
+ if (!is_int($tmp = $driver->driver_version) || (0 == $tmp))
+ printf("[004] Expecting int/any, got %s/%s\n",
+ gettype($tmp), $tmp);
+
+
+ $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
+ $report_mode = $driver->report_mode;
+ if (!is_int($report_mode))
+ printf("[005] Expecting int/any, got %s/%s\n",
+ gettype($report_mode), $report_mode);
+
+ if (!in_array($report_mode, $all_modes))
+ printf("[006] Illegal report mode returned? Got %s, expected %s\n",
+ $report_mode, implode(', ', $all_modes));
+
+ $driver->report_mode = MYSQLI_REPORT_STRICT;
+ $ok = false;
+ try {
+
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+
+ } catch (mysqli_sql_exception $e) {
+ $ok = true;
+ if ('' == $e->getMessage())
+ printf("[008] getMessage() has returned an empty string.\n");
+ if ('' == $e->getCode())
+ printf("[009] getCode() has returned an empty string.\n");
+ if ('' == $e->getFile())
+ printf("[010] getFile() has returned an empty string.\n");
+ if ('' == $e->getLine())
+ printf("[011] getLine() has returned an empty string.\n");
+ $tmp = $e->getTrace();
+ if (empty($tmp))
+ printf("[012] getTrace() has returned an empty array.\n");
+ if ('' == $e->getTraceAsString())
+ printf("[013] getTraceAsString() has returned an empty string.\n");
+ if ('' == $e->__toString())
+ printf("[014] __toString() has returned an empty string.\n");
+
+ }
+ if (!$ok)
+ printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
+
+
+ $driver->report_mode = MYSQLI_REPORT_OFF;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ mysqli_query($link, "NO_SQL");
+ mysqli_close($link);
+
+ $driver->report_mode = MYSQLI_REPORT_ERROR;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ mysqli_query($link, "NO_SQL");
+ mysqli_close($link);
+
+ if (MYSQLI_REPORT_ERROR !== $driver->report_mode)
+ printf("[018] Error mode should be different\n");
+
+ /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
+
+ $driver->report_mode = $report_mode;
+
+ $reconnect = $driver->reconnect;
+ if (!is_bool($reconnect))
+ printf("[019] Expecting boolean/any, got %s/%s\n",
+ gettype($reconnect), $reconnect);
+
+ /* pointless, but I need more documentation */
+ $driver->reconnect = true;
+ $driver->reconnect = false;
+ $driver->reconnect = $reconnect;
+
+ if (!is_bool($embedded = $driver->embedded))
+ printf("[020] Expecting boolean/any, got %s/%s\n",
+ gettype($embedded), $embedded);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'NO_SQL' at line 1 in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_driver_unclonable.phpt b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
index 2b82f91d65..98559f46fc 100644
--- a/ext/mysqli/tests/mysqli_driver_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
@@ -5,9 +5,9 @@ Trying to clone mysqli_driver object
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- $driver = new mysqli_driver;
- $driver_clone = clone $driver;
- print "done!";
+ $driver = new mysqli_driver;
+ $driver_clone = clone $driver;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_driver in %s:%d
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
index b3fbde7fd9..156bd8a6fd 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
@@ -8,36 +8,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_dump_debug_info()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_dump_debug_info()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_dump_debug_info($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
- if (!is_bool($tmp = mysqli_dump_debug_info($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- mysqli_errno($link), mysqli_error($link));
+ if (!is_bool($tmp = mysqli_dump_debug_info($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_dump_debug_info($link)))
- printf("[005] Expecting NULL, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_dump_debug_info($link)))
+ printf("[005] Expecting NULL, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ mysqli_errno($link), mysqli_error($link));
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_dump_debug_info(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
index a0b5365432..0b11a90edd 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
@@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = @$mysqli->dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @$mysqli->dump_debug_info($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_bool($tmp = $mysqli->dump_debug_info()))
- printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $mysqli->errno, $mysqli->error);
+ if (!is_bool($tmp = $mysqli->dump_debug_info()))
+ printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = $mysqli->dump_debug_info()))
- printf("[004] Expecting false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $mysqli->errno, $mysqli->error);
+ if (false !== ($tmp = $mysqli->dump_debug_info()))
+ printf("[004] Expecting false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ $mysqli->errno, $mysqli->error);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli::dump_debug_info(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_embedded_connect.phpt b/ext/mysqli/tests/mysqli_embedded_connect.phpt
index d1a8730a06..7c6ca78ad4 100644
--- a/ext/mysqli/tests/mysqli_embedded_connect.phpt
+++ b/ext/mysqli/tests/mysqli_embedded_connect.phpt
@@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_embedded_connect()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_embedded_connect()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_embedded_connect($db)) {
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = mysqli_embedded_connect($db)) {
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown')))
- printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown')))
+ printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_embedded_connect() expects parameter 1 to be mysqli, null given in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
index 88da02bdc1..d8540c4108 100644
--- a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
+++ b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
@@ -12,31 +12,31 @@ if (!function_exists('mysqli_enable_reads_from_master')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_enable_reads_from_master()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_enable_reads_from_master()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_enable_reads_from_master($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_enable_reads_from_master($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = mysqli_enable_reads_from_master($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_enable_reads_from_master($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_enable_reads_from_master(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt
index 0a9c245341..d21c4dd4e8 100644
--- a/ext/mysqli/tests/mysqli_errno.phpt
+++ b/ext/mysqli/tests/mysqli_errno.phpt
@@ -8,40 +8,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_errno()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_errno($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
- var_dump(mysqli_errno($link));
+ var_dump(mysqli_errno($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_query($link, 'SELECT * FROM test');
- var_dump(mysqli_errno($link));
+ mysqli_query($link, 'SELECT * FROM test');
+ var_dump(mysqli_errno($link));
- @mysqli_query($link, 'No SQL');
- if (($tmp = mysqli_errno($link)) == 0)
- printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
+ @mysqli_query($link, 'No SQL');
+ if (($tmp = mysqli_errno($link)) == 0)
+ printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_errno($link));
+ var_dump(mysqli_errno($link));
- print "done!";
+ print "done!";
?>
--EXPECTF--
int(0)
diff --git a/ext/mysqli/tests/mysqli_errno_oo.phpt b/ext/mysqli/tests/mysqli_errno_oo.phpt
index f2fa2529a1..e27379eb39 100644
--- a/ext/mysqli/tests/mysqli_errno_oo.phpt
+++ b/ext/mysqli/tests/mysqli_errno_oo.phpt
@@ -8,37 +8,37 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- $mysqli = new mysqli();
- if (0 !== ($tmp = @$mysqli->errno))
- printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ if (0 !== ($tmp = @$mysqli->errno))
+ printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- var_dump($mysqli->errno);
+ var_dump($mysqli->errno);
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- $mysqli->query('SELECT * FROM test');
- var_dump($mysqli->errno);
+ $mysqli->query('SELECT * FROM test');
+ var_dump($mysqli->errno);
- @$mysqli->query('No SQL');
- if (($tmp = $mysqli->errno) === 0)
- printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
+ @$mysqli->query('No SQL');
+ if (($tmp = $mysqli->errno) === 0)
+ printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
- $mysqli->close();
+ $mysqli->close();
- var_dump($mysqli->errno);
+ var_dump($mysqli->errno);
- print "done!";
+ print "done!";
?>
--EXPECTF--
int(0)
diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt
index fd61f0f5d2..4bca8b88db 100644
--- a/ext/mysqli/tests/mysqli_error.phpt
+++ b/ext/mysqli/tests/mysqli_error.phpt
@@ -8,40 +8,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_error()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_error($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_query($link, 'SELECT * FROM test');
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
- printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ mysqli_query($link, 'SELECT * FROM test');
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
+ printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_error($link));
+ var_dump(mysqli_error($link));
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_error(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_error_oo.phpt b/ext/mysqli/tests/mysqli_error_oo.phpt
index d05fd6f383..9cf79680bb 100644
--- a/ext/mysqli/tests/mysqli_error_oo.phpt
+++ b/ext/mysqli/tests/mysqli_error_oo.phpt
@@ -8,37 +8,37 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- $mysqli = new mysqli();
- if ('' !== ($tmp = @$mysqli->error))
- printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ if ('' !== ($tmp = @$mysqli->error))
+ printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp);
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $tmp = $mysqli->error;
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+ $tmp = $mysqli->error;
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- $mysqli->query('SELECT * FROM test');
- $tmp = $mysqli->error;
- if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
- printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+ $mysqli->query('SELECT * FROM test');
+ $tmp = $mysqli->error;
+ if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
+ printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- var_dump($mysqli->error);
+ var_dump($mysqli->error);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: main(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt
index f4d8da9110..2d599b3668 100644
--- a/ext/mysqli/tests/mysqli_error_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_error_unicode.phpt
@@ -8,38 +8,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_error()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_error($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- mysqli_query($link, "set names utf8");
+ mysqli_query($link, "set names utf8");
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица');
- $tmp = mysqli_error($link);
- var_dump(str_replace($db.".", "", $tmp));
+ mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица');
+ $tmp = mysqli_error($link);
+ var_dump(str_replace($db.".", "", $tmp));
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_error($link));
+ var_dump(mysqli_error($link));
- print "done!";
+ print "done!";
?>
--EXPECTF--
string(%d) "Table 'нÑма_такава_таблица' doesn't exist"
diff --git a/ext/mysqli/tests/mysqli_expire_password.phpt b/ext/mysqli/tests/mysqli_expire_password.phpt
index f193add0be..8d80ec4a5e 100644
--- a/ext/mysqli/tests/mysqli_expire_password.phpt
+++ b/ext/mysqli/tests/mysqli_expire_password.phpt
@@ -50,71 +50,71 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- /* default */
- if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) {
- printf("[001] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
- }
- /* explicitly requesting default */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[003] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
- }
-
- /* allow connect */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[005] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
- $link->close();
- }
-
- /* allow connect, fix pw */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[007] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- if (!$link->query("SET PASSWORD='expiretest'")) {
- $link->query("SET PASSWORD=PASSWORD('expiretest')");
- }
- printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
- if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
- var_dump($res->fetch_assoc());
- $link->close();
- }
-
-
- /* check login */
- if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
- printf("[001] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
- var_dump($res->fetch_assoc());
- $link->close();
- }
-
-
-
- print "done!";
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ /* default */
+ if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[001] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
+ }
+ /* explicitly requesting default */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[003] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
+ }
+
+ /* allow connect */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[005] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
+ $link->close();
+ }
+
+ /* allow connect, fix pw */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[007] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ if (!$link->query("SET PASSWORD='expiretest'")) {
+ $link->query("SET PASSWORD=PASSWORD('expiretest')");
+ }
+ printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
+ if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
+ var_dump($res->fetch_assoc());
+ $link->close();
+ }
+
+
+ /* check login */
+ if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
+ printf("[001] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
+ var_dump($res->fetch_assoc());
+ $link->close();
+ }
+
+
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_explain_metadata.phpt b/ext/mysqli/tests/mysqli_explain_metadata.phpt
index a6cad18410..e55306c0ae 100644
--- a/ext/mysqli/tests/mysqli_explain_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_explain_metadata.phpt
@@ -11,149 +11,149 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2'))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2'))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $num_rows = 0;
- $num_fields = 0;
- $field_names = array();
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[002] Expecting result but got no data [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- } else {
- $num_rows++;
- $num_fields = count($row);
- foreach ($row as $name => $value)
- $field_names[$name] = gettype($value);
- }
+ $num_rows = 0;
+ $num_fields = 0;
+ $field_names = array();
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[002] Expecting result but got no data [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ } else {
+ $num_rows++;
+ $num_fields = count($row);
+ foreach ($row as $name => $value)
+ $field_names[$name] = gettype($value);
+ }
- while ($row = mysqli_fetch_assoc($res))
- $num_rows++;
+ while ($row = mysqli_fetch_assoc($res))
+ $num_rows++;
- if (($tmp = mysqli_num_rows($res)) !== $num_rows) {
- printf("[003] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_field_count($link)) !== $num_fields) {
- printf("[004] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- $fields = mysqli_fetch_fields($res);
- if (($tmp = count($fields)) !== $num_fields) {
- printf("[005] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
+ if (($tmp = mysqli_num_rows($res)) !== $num_rows) {
+ printf("[003] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_field_count($link)) !== $num_fields) {
+ printf("[004] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ $fields = mysqli_fetch_fields($res);
+ if (($tmp = count($fields)) !== $num_fields) {
+ printf("[005] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
- foreach ($fields as $k => $field) {
- $field->max_length = 0;// change it or we will get diff error
- if (isset($field_names[$field->name])) {
- unset($field_names[$field->name]);
- } else {
- printf("[006] Unexpected field '%s', dumping info\n");
- var_dump($field);
- }
- }
- if (!empty($field_names)) {
- printf("[007] Field descriptions missing for the following columns\n");
- var_dump($field_names);
- }
+ foreach ($fields as $k => $field) {
+ $field->max_length = 0;// change it or we will get diff error
+ if (isset($field_names[$field->name])) {
+ unset($field_names[$field->name]);
+ } else {
+ printf("[006] Unexpected field '%s', dumping info\n");
+ var_dump($field);
+ }
+ }
+ if (!empty($field_names)) {
+ printf("[007] Field descriptions missing for the following columns\n");
+ var_dump($field_names);
+ }
- mysqli_free_result($res);
+ mysqli_free_result($res);
- $stmt = mysqli_stmt_init($link);
- /* Depending on your version, the MySQL server migit not support this */
- if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $stmt = mysqli_stmt_init($link);
+ /* Depending on your version, the MySQL server migit not support this */
+ if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res_meta = mysqli_stmt_result_metadata($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$res_meta = mysqli_stmt_result_metadata($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
- printf("[010] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
- printf("[011] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_field_count($link)) !== $num_fields) {
- printf("[013] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = $res_meta->field_count) !== $num_fields) {
- printf("[014] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- $fields_res_meta = mysqli_fetch_fields($res_meta);
- if (($tmp = count($fields_res_meta)) !== $num_fields)
- printf("[015] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
+ if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
+ printf("[010] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
+ printf("[011] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_field_count($link)) !== $num_fields) {
+ printf("[013] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ if (($tmp = $res_meta->field_count) !== $num_fields) {
+ printf("[014] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ $fields_res_meta = mysqli_fetch_fields($res_meta);
+ if (($tmp = count($fields_res_meta)) !== $num_fields)
+ printf("[015] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
- if ($fields_res_meta != $fields) {
- printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
- var_dump($fields_res_meta);
- var_dump($fields);
- }
+ if ($fields_res_meta != $fields) {
+ printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
+ var_dump($fields_res_meta);
+ var_dump($fields);
+ }
- if (function_exists('mysqli_stmt_get_result') &&
- $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') &&
- $stmt->execute()) {
- if (!$res_stmt = mysqli_stmt_get_result($stmt)) {
- printf("[017] Cannot fetch result from PS [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) {
- printf("[018] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if ((mysqli_stmt_num_rows($stmt)) !== 0) {
- printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
- printf("[020] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
+ if (function_exists('mysqli_stmt_get_result') &&
+ $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') &&
+ $stmt->execute()) {
+ if (!$res_stmt = mysqli_stmt_get_result($stmt)) {
+ printf("[017] Cannot fetch result from PS [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) {
+ printf("[018] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if ((mysqli_stmt_num_rows($stmt)) !== 0) {
+ printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
+ printf("[020] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = $res_stmt->field_count) !== $num_fields) {
- printf("[021] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
+ }
+ if (($tmp = $res_stmt->field_count) !== $num_fields) {
+ printf("[021] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
- $fields_stmt = mysqli_fetch_fields($res_stmt);
- if (($tmp = count($fields_stmt)) !== $num_fields) {
- printf("[022] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- reset($fields);
- foreach ($fields_stmt as $fields_stmt_val) {
- $fields_val = current($fields);
- next($fields);
- unset($fields_stmt_val->max_length);
- unset($fields_val->max_length);
- if ($fields_stmt_val != $fields_val) {
- printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
- var_dump($fields_stmt_val);
- var_dump($fields_val);
- }
- }
+ $fields_stmt = mysqli_fetch_fields($res_stmt);
+ if (($tmp = count($fields_stmt)) !== $num_fields) {
+ printf("[022] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ reset($fields);
+ foreach ($fields_stmt as $fields_stmt_val) {
+ $fields_val = current($fields);
+ next($fields);
+ unset($fields_stmt_val->max_length);
+ unset($fields_val->max_length);
+ if ($fields_stmt_val != $fields_val) {
+ printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
+ var_dump($fields_stmt_val);
+ var_dump($fields_val);
+ }
+ }
/*
- if ($fields_stmt != $fields) {
- printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
- var_dump($fields_stmt);
- var_dump($fields);
- }
+ if ($fields_stmt != $fields) {
+ printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
+ var_dump($fields_stmt);
+ var_dump($fields);
+ }
*/
- mysqli_free_result($res_stmt);
- }
- }
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res_stmt);
+ }
+ }
+ mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt
index 27116b63a6..dc4ad68df8 100644
--- a/ext/mysqli/tests/mysqli_fetch_all.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all.phpt
@@ -10,316 +10,316 @@ if (!function_exists('mysqli_fetch_all'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_all()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_all($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[005]\n";
- var_dump(mysqli_fetch_all($res));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[007]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_NUM));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[008]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[010]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
-
- print "[011]\n";
- var_dump(mysqli_fetch_all($res));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[013]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
-
- print "[016]\n";
- var_dump(mysqli_fetch_all($res));
-
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
-
- mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[018] Cannot run query, [%d] %s\n",
- mysqli_errno($link), $mysqli_error($link));
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = mysqli_fetch_all($res, $illegal_mode);
- if (false !== $tmp)
- printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- 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);
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_fetch_all()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_fetch_all($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[005]\n";
+ var_dump(mysqli_fetch_all($res));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[007]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_NUM));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[008]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[010]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
+
+ print "[011]\n";
+ var_dump(mysqli_fetch_all($res));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[013]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
+
+ print "[016]\n";
+ var_dump(mysqli_fetch_all($res));
+
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
+
+ mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[018] Cannot run query, [%d] %s\n",
+ mysqli_errno($link), $mysqli_error($link));
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = mysqli_fetch_all($res, $illegal_mode);
+ if (false !== $tmp)
+ printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ 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);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- 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));
+ if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ 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));
+ /* 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);
- }
+ $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!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
index 02a6e15123..17ce9e718e 100644
--- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
@@ -11,297 +11,297 @@ if (!function_exists('mysqli_fetch_all'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
-
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- require('table.inc');
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[005]\n";
- var_dump($res->fetch_all());
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[007]\n";
- var_dump($res->fetch_all(MYSQLI_NUM));
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[008]\n";
- var_dump($res->fetch_all(MYSQLI_BOTH));
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[010]\n";
- var_dump($res->fetch_all(MYSQLI_ASSOC));
-
- print "[011]\n";
- var_dump($res->fetch_array());
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[013]\n";
- var_dump($res->fetch_all(MYSQLI_ASSOC));
-
- print "[016]\n";
- var_dump($res->fetch_array());
-
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
- }
- print "[017]\n";
- var_dump($res->fetch_all(MYSQLI_BOTH));
-
- $res->free_result();
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[018] Cannot run query, [%d] %s\n",
- $mysqli->errno, $$mysqli->error);
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = $res->fetch_all($illegal_mode);
- if (false !== $tmp)
- printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $res->free_result();
-
- function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
-
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if (!$link->query($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 (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error);
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql);
- return false;
- }
- } else {
- if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error);
- return false;
- }
- }
- }
-
- if (!$res = $link->query("SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error);
- return false;
- }
-
- if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error);
- 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'], $link->errno, $link->error);
- 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'], $link->errno, $link->error);
- return false;
- }
- }
- }
-
- return true;
- }
-
- function func_mysqli_fetch_array_oo_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
-
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
-
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410);
- func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420);
- func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430);
-
- $datetime = @date('Y-m-d H:i:s');
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440);
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450);
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460);
-
- func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470);
-
- $time = @date('H:i:s');
- func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480);
- func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490);
- func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500);
-
- func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_oo_make_string(255);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_oo_make_string(65400);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660);
-
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740);
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780);
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790);
-
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890);
- func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910);
-
- func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- mysqli_close($link);
-
- if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $mysqli = new mysqli();
+
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ require('table.inc');
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[005]\n";
+ var_dump($res->fetch_all());
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[007]\n";
+ var_dump($res->fetch_all(MYSQLI_NUM));
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[008]\n";
+ var_dump($res->fetch_all(MYSQLI_BOTH));
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[010]\n";
+ var_dump($res->fetch_all(MYSQLI_ASSOC));
+
+ print "[011]\n";
+ var_dump($res->fetch_array());
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[013]\n";
+ var_dump($res->fetch_all(MYSQLI_ASSOC));
+
+ print "[016]\n";
+ var_dump($res->fetch_array());
+
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
+ }
+ print "[017]\n";
+ var_dump($res->fetch_all(MYSQLI_BOTH));
+
+ $res->free_result();
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[018] Cannot run query, [%d] %s\n",
+ $mysqli->errno, $$mysqli->error);
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = $res->fetch_all($illegal_mode);
+ if (false !== $tmp)
+ printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $res->free_result();
+
+ function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$link->query($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 (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error);
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql);
+ return false;
+ }
+ } else {
+ if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error);
+ return false;
+ }
+ }
+ }
+
+ if (!$res = $link->query("SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error);
+ 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'], $link->errno, $link->error);
+ 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'], $link->errno, $link->error);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function func_mysqli_fetch_array_oo_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410);
+ func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420);
+ func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430);
+
+ $datetime = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440);
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450);
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470);
+
+ $time = @date('H:i:s');
+ func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480);
+ func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490);
+ func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500);
+
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_oo_make_string(255);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_oo_make_string(65400);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660);
+
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780);
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890);
+ func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910);
+
+ func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ mysqli_close($link);
+
+ if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt
index e9dd1602b5..8ff931b237 100644
--- a/ext/mysqli/tests/mysqli_fetch_array.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array.phpt
@@ -8,289 +8,289 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_array()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_array($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[005]\n";
- var_dump(mysqli_fetch_array($res));
-
- print "[006]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
-
- print "[007]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
-
- print "[008]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
-
- print "[009]\n";
- var_dump(mysqli_fetch_array($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
- }
- print "[011]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
-
- mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[012] Cannot run query, [%d] %s\n",
- mysqli_errno($link), $mysqli_error($link));
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = mysqli_fetch_array($res, $illegal_mode);
- if (false !== $tmp)
- printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_fetch_array($res, $illegal_mode);
- if (false !== $tmp)
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
-
- function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) {
-
- 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 (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- 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 ((gettype($php_value) == 'unicode') && $binary_type) {
- // Unicode is on and we are told that the MySQL column type is a binary type.
- // Don't expect a unicode value from the database, you'll get binary string
- if (($row['label'] != $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- if (gettype($row['label']) == 'unicode') {
- var_dump(mysqli_fetch_field_direct($res, 1), $row['label']);
- printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n",
- $offset + 6, $sql_type);
- 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 + 7,
- 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_array($link, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
- func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- if ($IS_MYSQLND ||
- ((mysqli_get_server_version($link) >= 51000) &&
- (mysqli_get_client_version($link) >= 51000))) {
- func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260);
- func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
- }
-
- func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
-
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410);
- func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420);
- func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430);
-
- $date = @date('Y-m-d H:i:s');
- func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440);
- func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450);
- func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460);
- func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470);
-
- $date = @date('H:i:s');
- func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480);
- func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490);
- func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500);
-
- func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_make_string(255);
- func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_make_string(65400);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true);
-
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true);
- func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true);
- func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true);
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true);
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true);
- func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true);
-
- func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_fetch_array()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_fetch_array($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[005]\n";
+ var_dump(mysqli_fetch_array($res));
+
+ print "[006]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
+
+ print "[007]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+
+ print "[008]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+
+ print "[009]\n";
+ var_dump(mysqli_fetch_array($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
+ }
+ print "[011]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+
+ mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[012] Cannot run query, [%d] %s\n",
+ mysqli_errno($link), $mysqli_error($link));
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = mysqli_fetch_array($res, $illegal_mode);
+ if (false !== $tmp)
+ printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_fetch_array($res, $illegal_mode);
+ if (false !== $tmp)
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+
+ function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) {
+
+ 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 (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ 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 ((gettype($php_value) == 'unicode') && $binary_type) {
+ // Unicode is on and we are told that the MySQL column type is a binary type.
+ // Don't expect a unicode value from the database, you'll get binary string
+ if (($row['label'] != $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ if (gettype($row['label']) == 'unicode') {
+ var_dump(mysqli_fetch_field_direct($res, 1), $row['label']);
+ printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n",
+ $offset + 6, $sql_type);
+ 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 + 7,
+ 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_array($link, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ if ($IS_MYSQLND ||
+ ((mysqli_get_server_version($link) >= 51000) &&
+ (mysqli_get_client_version($link) >= 51000))) {
+ func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260);
+ func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+ }
+
+ func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410);
+ func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420);
+ func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430);
+
+ $date = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440);
+ func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450);
+ func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460);
+ func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470);
+
+ $date = @date('H:i:s');
+ func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480);
+ func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490);
+ func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500);
+
+ func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_make_string(255);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_make_string(65400);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true);
+ func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true);
+ func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true);
+ func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ mysqli_close($link);
+
+ if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
[005]
diff --git a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
index fe73d780f3..4f696fad8a 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
@@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[002]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[002]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[004]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[004]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+ mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array_large.phpt b/ext/mysqli/tests/mysqli_fetch_array_large.phpt
index 59d5669126..b4a1c3e69b 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_large.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_large.phpt
@@ -161,7 +161,7 @@ memory_limit=-1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
stop: %s
diff --git a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
index 29412521ce..17ac93cf66 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
@@ -8,104 +8,104 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require("table.inc");
-
- // do as much as we can do in 5 seconds
- $start = microtime(true);
- for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')",
- $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) {
- printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link));
- break;
- }
- }
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- while ($row = mysqli_fetch_array($res)) {
- // overwrite results and check if the cache magic works
- $row['label'] = NULL;
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- $i = 0;
- $results = array();
- while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
-
- // create copies and destroy later
- $results[$i++] = &$row;
- if ($i % 999) {
- $results = array();
- }
-
- if ($row[0] < 0 || $row[0] > $id) {
- printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n",
- $row[0], $id, mysqli_errno($link), mysqli_error($link));
- break;
- }
- if ($row[0] !== $row['id']) {
- printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n",
- $row[0], $row[id], mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- $len = strlen($row[1]);
- if (!is_string($row[1]) || $len == 0 || $len > 1) {
- printf("[006] Unexpected result row[1] = '%s', [%d] %s\n",
- $row[1], mysqli_errno($link), mysqli_error($link));
- break;
- }
- if ($row[1] !== $row['label']) {
- printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n",
- $row[1], $row['label'], mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
- // overwrite results and check if the cache magic works
- $row['label'] = NULL;
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) {
- printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
- $row = mysqli_fetch_assoc($res);
- $num = $row['num'];
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- $i = 0;
- while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
- // overwrite results and check if the cache magic works
- $row[0] = NULL;
- $i++;
- }
- mysqli_free_result($res);
-
- if ($i != $num)
- printf("[011] Expecting %d results, got %d results, [%d] %s\n",
- $num, $i, mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- print "done!";
+ require("table.inc");
+
+ // do as much as we can do in 5 seconds
+ $start = microtime(true);
+ for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')",
+ $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) {
+ printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ while ($row = mysqli_fetch_array($res)) {
+ // overwrite results and check if the cache magic works
+ $row['label'] = NULL;
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ $i = 0;
+ $results = array();
+ while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
+
+ // create copies and destroy later
+ $results[$i++] = &$row;
+ if ($i % 999) {
+ $results = array();
+ }
+
+ if ($row[0] < 0 || $row[0] > $id) {
+ printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n",
+ $row[0], $id, mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if ($row[0] !== $row['id']) {
+ printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n",
+ $row[0], $row[id], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ $len = strlen($row[1]);
+ if (!is_string($row[1]) || $len == 0 || $len > 1) {
+ printf("[006] Unexpected result row[1] = '%s', [%d] %s\n",
+ $row[1], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if ($row[1] !== $row['label']) {
+ printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n",
+ $row[1], $row['label'], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
+ // overwrite results and check if the cache magic works
+ $row['label'] = NULL;
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) {
+ printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+ $row = mysqli_fetch_assoc($res);
+ $num = $row['num'];
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ $i = 0;
+ while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
+ // overwrite results and check if the cache magic works
+ $row[0] = NULL;
+ $i++;
+ }
+ mysqli_free_result($res);
+
+ if ($i != $num)
+ printf("[011] Expecting %d results, got %d results, [%d] %s\n",
+ $num, $i, mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
index 634ee96358..34d441accb 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
@@ -8,273 +8,273 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] 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->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[005]\n";
- var_dump($res->fetch_array());
-
- print "[006]\n";
- var_dump($res->fetch_array(MYSQLI_NUM));
-
- print "[007]\n";
- var_dump($res->fetch_array(MYSQLI_BOTH));
-
- print "[008]\n";
- var_dump($res->fetch_array(MYSQLI_ASSOC));
-
- print "[009]\n";
- var_dump($res->fetch_array());
-
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
- }
- print "[011]\n";
- var_dump($res->fetch_array(MYSQLI_BOTH));
-
- $res->free_result();
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[012] Cannot run query, [%d] %s\n",
- $mysqli->errno, $$mysqli->error);
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = $res->fetch_array($illegal_mode);
- if (false !== $tmp)
- printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $tmp = $res->fetch_array($illegal_mode);
- if (false !== $tmp)
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $res->free_result();
-
- function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
-
- if (!$mysqli->query("DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error);
- return false;
- }
-
- if (!$mysqli->query($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($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql);
- return false;
- }
- } else {
- if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
- return false;
- }
- }
- }
-
- if (!$res = $mysqli->query("SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error);
- return false;
- }
-
- if (!$row = $res->fetch_array(MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error);
- return false;
- }
- $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, $mysqli->error);
- 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, $mysqli->error);
- 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_array($mysqli, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- if ($IS_MYSQLND ||
- ((mysqli_get_server_version($link) >= 51000) &&
- (mysqli_get_client_version($link) >= 51000))) {
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
- }
-
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410);
- func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420);
- func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430);
-
- $date = @date('Y-m-d H:i:s');
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440);
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450);
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460);
- func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470);
- $date = @date('H:i:s');
- func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480);
- func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490);
- func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_make_string(255);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_make_string(65400);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660);
-
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700);
-
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740);
-
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780);
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790);
-
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890);
- func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910);
-
- func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- $mysqli->close();
-
- if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] 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->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[005]\n";
+ var_dump($res->fetch_array());
+
+ print "[006]\n";
+ var_dump($res->fetch_array(MYSQLI_NUM));
+
+ print "[007]\n";
+ var_dump($res->fetch_array(MYSQLI_BOTH));
+
+ print "[008]\n";
+ var_dump($res->fetch_array(MYSQLI_ASSOC));
+
+ print "[009]\n";
+ var_dump($res->fetch_array());
+
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
+ }
+ print "[011]\n";
+ var_dump($res->fetch_array(MYSQLI_BOTH));
+
+ $res->free_result();
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[012] Cannot run query, [%d] %s\n",
+ $mysqli->errno, $$mysqli->error);
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = $res->fetch_array($illegal_mode);
+ if (false !== $tmp)
+ printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $tmp = $res->fetch_array($illegal_mode);
+ if (false !== $tmp)
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $res->free_result();
+
+ function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
+
+ if (!$mysqli->query("DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+
+ if (!$mysqli->query($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($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql);
+ return false;
+ }
+ } else {
+ if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ }
+ }
+
+ if (!$res = $mysqli->query("SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+
+ if (!$row = $res->fetch_array(MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ $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, $mysqli->error);
+ 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, $mysqli->error);
+ 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_array($mysqli, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ if ($IS_MYSQLND ||
+ ((mysqli_get_server_version($link) >= 51000) &&
+ (mysqli_get_client_version($link) >= 51000))) {
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+ }
+
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410);
+ func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420);
+ func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430);
+
+ $date = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440);
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450);
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460);
+ func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470);
+ $date = @date('H:i:s');
+ func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480);
+ func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490);
+ func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_make_string(255);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_make_string(65400);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660);
+
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780);
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890);
+ func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910);
+
+ func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ $mysqli->close();
+
+ if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
index 6ae91ad74a..0c73a63062 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
@@ -8,64 +8,64 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_assoc()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_assoc()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_assoc($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_assoc($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "[005]\n";
- var_dump(mysqli_fetch_assoc($res));
+ print "[005]\n";
+ var_dump(mysqli_fetch_assoc($res));
- print "[006]\n";
- var_dump(mysqli_fetch_assoc($res));
+ print "[006]\n";
+ var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT
- 1 AS a,
- 2 AS a,
- 3 AS c,
- 4 AS C,
- NULL AS d,
- true AS e,
- 5 AS '-1',
- 6 AS '-10',
- 7 AS '-100',
- 8 AS '-1000',
- 9 AS '10000',
- 'a' AS '100000',
- 'b' AS '1000000',
- 'c' AS '9',
- 'd' AS '9',
- 'e' AS '01',
- 'f' AS '-02'
- ")) {
- printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[008]\n";
- var_dump(mysqli_fetch_assoc($res));
+ if (!$res = mysqli_query($link, "SELECT
+ 1 AS a,
+ 2 AS a,
+ 3 AS c,
+ 4 AS C,
+ NULL AS d,
+ true AS e,
+ 5 AS '-1',
+ 6 AS '-10',
+ 7 AS '-100',
+ 8 AS '-1000',
+ 9 AS '10000',
+ 'a' AS '100000',
+ 'b' AS '1000000',
+ 'c' AS '9',
+ 'd' AS '9',
+ 'e' AS '01',
+ 'f' AS '-02'
+ ")) {
+ printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[008]\n";
+ var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_fetch_assoc($res)))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_fetch_assoc($res)))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
index 2e45def227..0b193abf27 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
@@ -17,97 +17,97 @@ mysqli_fetch_assoc() - BIT
?>
--FILE--
<?php
- require('connect.inc');
+ require('connect.inc');
- function dec32bin($dec, $bits) {
+ function dec32bin($dec, $bits) {
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- for ($bits = 1; $bits <= 46; $bits++) {
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
- $tests = 0;
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+ for ($bits = 1; $bits <= 46; $bits++) {
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+ $tests = 0;
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
- if (!mysqli_query($link, $sql))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, $sql))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value);
- if (!$res = mysqli_query($link, $sql))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value);
+ if (!$res = mysqli_query($link, $sql))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
- printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
+ printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
- }
- }
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+ }
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
index f86502704a..a581499daa 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
@@ -8,79 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, "SELECT 1, 2")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[002]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1, 2")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[002]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[004]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[004]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[006]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[006]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[008]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[008]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- /* Now do it with unbuffered queries */
- if (!$res = mysqli_real_query($link, "SELECT 1, 2")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[011]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ /* Now do it with unbuffered queries */
+ if (!$res = mysqli_real_query($link, "SELECT 1, 2")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[011]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[014]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[014]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
[002]
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
index af535a803f..c115ca486a 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
@@ -35,48 +35,48 @@ mysqli_fetch_assoc() - utf8
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- /* some cyrillic (utf8) comes here */
- if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ /* some cyrillic (utf8) comes here */
+ if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[003]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[003]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) {
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) {
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[009]\n";
- while ($row = mysqli_fetch_assoc($res)) {
- var_dump($row);
- }
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[009]\n";
+ while ($row = mysqli_fetch_assoc($res)) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
[003]
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
index d06d6d5705..13aad9b2bf 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
@@ -8,51 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_assoc()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ $mysqli = new mysqli();
+ $res = @new mysqli_result($mysqli);
+ if (false !== ($tmp = @$res->fetch_assoc()))
+ printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$res->fetch_assoc($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$res->fetch_assoc($link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- print "[005]\n";
- var_dump($res->fetch_assoc());
+ print "[005]\n";
+ var_dump($res->fetch_assoc());
- print "[006]\n";
- var_dump($res->fetch_assoc());
+ print "[006]\n";
+ var_dump($res->fetch_assoc());
- $res->free_result();
+ $res->free_result();
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- print "[008]\n";
- var_dump($res->fetch_assoc());
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ print "[008]\n";
+ var_dump($res->fetch_assoc());
- $res->free_result();
+ $res->free_result();
- if (false !== ($tmp = $res->fetch_assoc()))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->fetch_assoc()))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
index e5e0fdf4d9..18affd421c 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
@@ -8,67 +8,67 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function zerofill($offset, $link, $datatype, $insert = 1) {
+ function zerofill($offset, $link, $datatype, $insert = 1) {
- mysqli_query($link, 'ALTER TABLE test DROP zero');
- $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
- if (!mysqli_query($link, $sql)) {
- // no worries - server might not support it
- return true;
- }
+ mysqli_query($link, 'ALTER TABLE test DROP zero');
+ $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
+ if (!mysqli_query($link, $sql)) {
+ // no worries - server might not support it
+ return true;
+ }
- if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
- printf("[%03d] UPDATE failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
+ printf("[%03d] UPDATE failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) {
- printf("[%03d] SELECT failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) {
+ printf("[%03d] SELECT failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $row = mysqli_fetch_assoc($res);
- $meta = mysqli_fetch_fields($res);
- mysqli_free_result($res);
- $meta = $meta[0];
- $length = $meta->length;
- if ($length > strlen($insert)) {
+ $row = mysqli_fetch_assoc($res);
+ $meta = mysqli_fetch_fields($res);
+ mysqli_free_result($res);
+ $meta = $meta[0];
+ $length = $meta->length;
+ if ($length > strlen($insert)) {
- $expected = str_repeat('0', $length - strlen($insert));
- $expected .= $insert;
- if ($expected !== $row['zero']) {
- printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']);
- return false;
- }
+ $expected = str_repeat('0', $length - strlen($insert));
+ $expected .= $insert;
+ if ($expected !== $row['zero']) {
+ printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']);
+ return false;
+ }
- } else if ($length <= 1) {
- printf("[%03d] Length reported is too small to run test\n", $offset);
- return false;
- }
+ } else if ($length <= 1) {
+ printf("[%03d] Length reported is too small to run test\n", $offset);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- zerofill(2, $link, 'TINYINT');
- zerofill(3, $link, 'SMALLINT');
- zerofill(4, $link, 'MEDIUMINT');
- zerofill(5, $link, 'INT');
- zerofill(6, $link, 'INTEGER');
- zerofill(7, $link, 'BIGINT');
- zerofill(8, $link, 'FLOAT');
- zerofill(9, $link, 'DOUBLE');
- zerofill(10, $link, 'DOUBLE PRECISION');
- zerofill(11, $link, 'DECIMAL');
- zerofill(12, $link, 'DEC');
+ zerofill(2, $link, 'TINYINT');
+ zerofill(3, $link, 'SMALLINT');
+ zerofill(4, $link, 'MEDIUMINT');
+ zerofill(5, $link, 'INT');
+ zerofill(6, $link, 'INTEGER');
+ zerofill(7, $link, 'BIGINT');
+ zerofill(8, $link, 'FLOAT');
+ zerofill(9, $link, 'DOUBLE');
+ zerofill(10, $link, 'DOUBLE PRECISION');
+ zerofill(11, $link, 'DECIMAL');
+ zerofill(12, $link, 'DEC');
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt
index 4c6276ddf8..f930e98d61 100644
--- a/ext/mysqli/tests/mysqli_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field.phpt
@@ -8,79 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_field()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ if (!is_null($tmp = @mysqli_fetch_field()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_field($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_field($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- $charsetInfo = mysqli_get_charset($link);
+ $charsetInfo = mysqli_get_charset($link);
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- /* ID column, binary charset */
- $tmp = mysqli_fetch_field($res);
- var_dump($tmp);
+ /* ID column, binary charset */
+ $tmp = mysqli_fetch_field($res);
+ var_dump($tmp);
- /* label column, result set charset */
- $tmp = mysqli_fetch_field($res);
- var_dump($tmp);
- if ($tmp->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
- }
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
- if ($tmp->db != $db) {
- printf("011] Expecting database '%s' got '%s'\n",
- $db, $tmp->db);
- }
+ /* label column, result set charset */
+ $tmp = mysqli_fetch_field($res);
+ var_dump($tmp);
+ if ($tmp->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
+ }
+ if ($tmp->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $tmp->max_length);
+ }
+ if ($tmp->db != $db) {
+ printf("011] Expecting database '%s' got '%s'\n",
+ $db, $tmp->db);
+ }
- var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_fetch_field($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // Read http://bugs.php.net/bug.php?id=42344 on defaults!
- if (false !== ($tmp = mysqli_fetch_field($res)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Read http://bugs.php.net/bug.php?id=42344 on defaults!
+ if (false !== ($tmp = mysqli_fetch_field($res)))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump(mysqli_fetch_assoc($res));
- /* binary */
- var_dump(mysqli_fetch_field($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump(mysqli_fetch_assoc($res));
+ /* binary */
+ var_dump(mysqli_fetch_field($res));
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
index 4ed1bef8a1..b11340e9b8 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
@@ -8,37 +8,37 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_field_direct()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_field_direct($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_field_direct($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- var_dump(mysqli_fetch_field_direct($res, -1));
- var_dump(mysqli_fetch_field_direct($res, 0));
- var_dump(mysqli_fetch_field_direct($res, 2));
+ var_dump(mysqli_fetch_field_direct($res, -1));
+ var_dump(mysqli_fetch_field_direct($res, 0));
+ var_dump(mysqli_fetch_field_direct($res, 2));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_fetch_field_direct($res, 0)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_fetch_field_direct($res, 0)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
index 98440079d5..8c85570b51 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
@@ -8,46 +8,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ $res = @new mysqli_result($mysqli);
+ if (!is_null($tmp = @$res->fetch_field_direct()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] 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->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$res->fetch_field_direct()))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @$res->fetch_field_direct($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$res->fetch_field_direct($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @$res->fetch_field_direct($link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$res->fetch_field_direct($link, $link)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- var_dump($res->fetch_field_direct(-1));
- var_dump($res->fetch_field_direct(0));
- var_dump($res->fetch_field_direct(2));
+ var_dump($res->fetch_field_direct(-1));
+ var_dump($res->fetch_field_direct(0));
+ var_dump($res->fetch_field_direct(2));
- $res->free_result();
+ $res->free_result();
- if (false !== ($tmp = $res->fetch_field_direct(0)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->fetch_field_direct(0)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- $mysqli->close();
- print "done!";
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
index 4eb2d007dd..44fcd1f52d 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
@@ -17,206 +17,206 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
/* TODO: mysqli.c needs to export a few more constants - see all the defined() calls! */
- $flags = array(
- MYSQLI_NOT_NULL_FLAG => 'NOT_NULL',
- MYSQLI_PRI_KEY_FLAG => 'PRI_KEY',
- MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY',
- MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY',
- MYSQLI_BLOB_FLAG => 'BLOB',
- MYSQLI_UNSIGNED_FLAG => 'UNSIGNED',
- MYSQLI_ZEROFILL_FLAG => 'ZEROFILL',
- MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT',
- MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP',
- MYSQLI_SET_FLAG => 'SET',
- MYSQLI_NUM_FLAG => 'NUM',
- MYSQLI_PART_KEY_FLAG => 'PART_KEY',
- // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only
- (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE',
- (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY',
- (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM',
- // MYSQLI_BINCMP_FLAG
- );
-
- // 5.1.24 / 6.0.4+
- if (defined('MYSQLI_ON_UPDATE_NOW'))
- $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW';
- else
- $flags[8192] = 'ON_UPDATE_NOW';
-
- krsort($flags);
-
- $columns = array(
- 'INT DEFAULT NULL' => 'NUM',
- 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM',
- 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM',
- 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM',
- 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM',
- 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM',
- 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM',
- 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY',
- 'CHAR(1) DEFAULT NULL' => '',
- 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE',
- 'VARBINARY(127) DEFAULT NULL' => 'BINARY',
- 'BLOB' => 'BLOB BINARY',
- 'TINYBLOB' => 'BLOB BINARY',
- 'MEDIUMBLOB' => 'BLOB BINARY',
- 'LONGBLOB' => 'BLOB BINARY',
- 'TEXT' => 'BLOB',
- 'TINYTEXT' => 'BLOB',
- 'MEDIUMTEXT' => 'BLOB',
- 'LONGTEXT' => 'BLOB',
- 'SET("one", "two")' => 'SET',
- 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE',
- 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET',
- 'ENUM("one", "two")' => 'ENUM',
- 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE',
- 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM',
- 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
- 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
- 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY',
- 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY',
- 'BIT' => 'UNSIGNED',
- 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY'
- );
-
-
-
- function checkFlags($reported_flags, $expected_flags, $flags) {
- $found_flags = $unexpected_flags = '';
- foreach ($flags as $code => $name) {
- if ($reported_flags >= $code) {
- $reported_flags -= $code;
- $found_flags .= $name . ' ';
- if (stristr($expected_flags, $name)) {
- $expected_flags = trim(str_ireplace($name, '', $expected_flags));
- } else {
- $unexpected_flags .= $name . ' ';
- }
- }
- }
-
- return array($expected_flags, $unexpected_flags, $found_flags);
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- foreach ($columns as $column_def => $expected_flags) {
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[002] %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def);
- if (!mysqli_query($link, $create)) {
- // Server might not support it - skip
- continue;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[003] Can't select from table, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $field = mysqli_fetch_field_direct($res, 1);
- if (!is_object($field)) {
- printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
- if ($field->name != 'col1') {
- printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- /*
- TODO
- Unfortunately different server versions give you slightly different
- results.The test does not yet fully reflect all server changes/bugs etc.
- */
- switch ($column_def) {
- case 'INT UNSIGNED NOT NULL':
- case 'INT NOT NULL':
- case 'CHAR(1) NOT NULL':
- case 'SET("one", "two") NOT NULL':
- case 'ENUM("one", "two") NOT NULL':
- $version = mysqli_get_server_version($link);
- if ($version < 50000) {
- // TODO - check exact version!
- $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags));
- }
- break;
-
- case 'BIT':
- $version = mysqli_get_server_version($link);
- if (($version <= 50114 && $version > 50100) || ($version == 50200)) {
- // TODO - check exact version!
- $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags));
- }
-
- default:
- break;
- }
-
- list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags);
- if ($unexpected_flags) {
- printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n",
- $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link));
- }
- if ($missing_flags) {
- printf("[007] The flags '%s' have not been reported for %s, found '%s'\n",
- $missing_flags, $column_def, $flags_found);
- var_dump($create);
- var_dump(mysqli_get_server_version($link));
- die($missing_flags);
- }
-
- mysqli_free_result($res);
- }
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[008] %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- }
-
- $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)');
- $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY');
- $create = 'CREATE TABLE test(id INT, ';
- foreach ($column_def as $k => $v) {
- $create .= sprintf('%s, ', $v);
- }
- $create = sprintf('%s)', substr($create, 0, -2));
-
- if (mysqli_query($link, $create)) {
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[009] Cannot run SELECT, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- }
- // id column - skip it
- $field = mysqli_fetch_field($res);
- while ($field = mysqli_fetch_field($res)) {
- if (!isset($expected_flags[$field->name])) {
- printf("[010] Found unexpected field '%s'\n", $field->name);
- }
- list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags);
- if ($unexpected_flags)
- printf("[011] Found unexpected flags '%s' for %s, found '%s'\n",
- $unexpected_flags, $field->name, $flags_found);
- if ($missing_flags)
- printf("[012] The flags '%s' have not been reported for %s, found '%s'\n",
- $missing_flags, $field->name, $flags_found);
- }
- }
-
- mysqli_close($link);
- print "done!";
+ $flags = array(
+ MYSQLI_NOT_NULL_FLAG => 'NOT_NULL',
+ MYSQLI_PRI_KEY_FLAG => 'PRI_KEY',
+ MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY',
+ MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY',
+ MYSQLI_BLOB_FLAG => 'BLOB',
+ MYSQLI_UNSIGNED_FLAG => 'UNSIGNED',
+ MYSQLI_ZEROFILL_FLAG => 'ZEROFILL',
+ MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT',
+ MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP',
+ MYSQLI_SET_FLAG => 'SET',
+ MYSQLI_NUM_FLAG => 'NUM',
+ MYSQLI_PART_KEY_FLAG => 'PART_KEY',
+ // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only
+ (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE',
+ (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY',
+ (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM',
+ // MYSQLI_BINCMP_FLAG
+ );
+
+ // 5.1.24 / 6.0.4+
+ if (defined('MYSQLI_ON_UPDATE_NOW'))
+ $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW';
+ else
+ $flags[8192] = 'ON_UPDATE_NOW';
+
+ krsort($flags);
+
+ $columns = array(
+ 'INT DEFAULT NULL' => 'NUM',
+ 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM',
+ 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM',
+ 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM',
+ 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM',
+ 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM',
+ 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM',
+ 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY',
+ 'CHAR(1) DEFAULT NULL' => '',
+ 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE',
+ 'VARBINARY(127) DEFAULT NULL' => 'BINARY',
+ 'BLOB' => 'BLOB BINARY',
+ 'TINYBLOB' => 'BLOB BINARY',
+ 'MEDIUMBLOB' => 'BLOB BINARY',
+ 'LONGBLOB' => 'BLOB BINARY',
+ 'TEXT' => 'BLOB',
+ 'TINYTEXT' => 'BLOB',
+ 'MEDIUMTEXT' => 'BLOB',
+ 'LONGTEXT' => 'BLOB',
+ 'SET("one", "two")' => 'SET',
+ 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE',
+ 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET',
+ 'ENUM("one", "two")' => 'ENUM',
+ 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE',
+ 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM',
+ 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
+ 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
+ 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY',
+ 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY',
+ 'BIT' => 'UNSIGNED',
+ 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY'
+ );
+
+
+
+ function checkFlags($reported_flags, $expected_flags, $flags) {
+ $found_flags = $unexpected_flags = '';
+ foreach ($flags as $code => $name) {
+ if ($reported_flags >= $code) {
+ $reported_flags -= $code;
+ $found_flags .= $name . ' ';
+ if (stristr($expected_flags, $name)) {
+ $expected_flags = trim(str_ireplace($name, '', $expected_flags));
+ } else {
+ $unexpected_flags .= $name . ' ';
+ }
+ }
+ }
+
+ return array($expected_flags, $unexpected_flags, $found_flags);
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ foreach ($columns as $column_def => $expected_flags) {
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[002] %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def);
+ if (!mysqli_query($link, $create)) {
+ // Server might not support it - skip
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[003] Can't select from table, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $field = mysqli_fetch_field_direct($res, 1);
+ if (!is_object($field)) {
+ printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+ if ($field->name != 'col1') {
+ printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ /*
+ TODO
+ Unfortunately different server versions give you slightly different
+ results.The test does not yet fully reflect all server changes/bugs etc.
+ */
+ switch ($column_def) {
+ case 'INT UNSIGNED NOT NULL':
+ case 'INT NOT NULL':
+ case 'CHAR(1) NOT NULL':
+ case 'SET("one", "two") NOT NULL':
+ case 'ENUM("one", "two") NOT NULL':
+ $version = mysqli_get_server_version($link);
+ if ($version < 50000) {
+ // TODO - check exact version!
+ $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags));
+ }
+ break;
+
+ case 'BIT':
+ $version = mysqli_get_server_version($link);
+ if (($version <= 50114 && $version > 50100) || ($version == 50200)) {
+ // TODO - check exact version!
+ $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags));
+ }
+
+ default:
+ break;
+ }
+
+ list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags);
+ if ($unexpected_flags) {
+ printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n",
+ $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link));
+ }
+ if ($missing_flags) {
+ printf("[007] The flags '%s' have not been reported for %s, found '%s'\n",
+ $missing_flags, $column_def, $flags_found);
+ var_dump($create);
+ var_dump(mysqli_get_server_version($link));
+ die($missing_flags);
+ }
+
+ mysqli_free_result($res);
+ }
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[008] %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ }
+
+ $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)');
+ $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY');
+ $create = 'CREATE TABLE test(id INT, ';
+ foreach ($column_def as $k => $v) {
+ $create .= sprintf('%s, ', $v);
+ }
+ $create = sprintf('%s)', substr($create, 0, -2));
+
+ if (mysqli_query($link, $create)) {
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[009] Cannot run SELECT, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ }
+ // id column - skip it
+ $field = mysqli_fetch_field($res);
+ while ($field = mysqli_fetch_field($res)) {
+ if (!isset($expected_flags[$field->name])) {
+ printf("[010] Found unexpected field '%s'\n", $field->name);
+ }
+ list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags);
+ if ($unexpected_flags)
+ printf("[011] Found unexpected flags '%s' for %s, found '%s'\n",
+ $unexpected_flags, $field->name, $flags_found);
+ if ($missing_flags)
+ printf("[012] The flags '%s' have not been reported for %s, found '%s'\n",
+ $missing_flags, $field->name, $flags_found);
+ }
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
index eb5d37922e..51ca4caa31 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
@@ -8,62 +8,62 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_field()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ $mysqli = new mysqli();
+ $res = @new mysqli_result($mysqli);
+ if (false !== ($tmp = @$res->fetch_field()))
+ printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ require('table.inc');
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$res->fetch_field($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @$res->fetch_field($link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!$mysqli->set_charset('utf8'))
- printf("[%d] %s\n", $mysqli->errno, $mysqli->errno);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!$mysqli->set_charset('utf8'))
+ printf("[%d] %s\n", $mysqli->errno, $mysqli->errno);
- $charsetInfo = $mysqli->get_charset();
+ $charsetInfo = $mysqli->get_charset();
- if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- var_dump($res->fetch_field());
+ var_dump($res->fetch_field());
- $tmp = $res->fetch_field();
- var_dump($tmp);
- if ($tmp->charsetnr != $charsetInfo->number) {
- printf("[005] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
- }
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[006] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
- if ($tmp->db != $db) {
- printf("[007] Expecting database '%s' got '%s'\n",
- $db, $tmp->db);
- }
+ $tmp = $res->fetch_field();
+ var_dump($tmp);
+ if ($tmp->charsetnr != $charsetInfo->number) {
+ printf("[005] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
+ }
+ if ($tmp->length != $charsetInfo->max_length) {
+ printf("[006] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $tmp->max_length);
+ }
+ if ($tmp->db != $db) {
+ printf("[007] Expecting database '%s' got '%s'\n",
+ $db, $tmp->db);
+ }
- var_dump($res->fetch_field());
+ var_dump($res->fetch_field());
- $res->free_result();
+ $res->free_result();
- if (false !== ($tmp = $res->fetch_field()))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->fetch_field()))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- $mysqli->close();
- print "done!";
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_types.phpt b/ext/mysqli/tests/mysqli_fetch_field_types.phpt
index 6b8248e02d..d5ecf2f1d9 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_types.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_types.phpt
@@ -8,115 +8,115 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") {
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[001] %s, [%d] %s\n", $sql_type,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") {
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[001] %s, [%d] %s\n", $sql_type,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset);
- if (!mysqli_query($link, $create)) {
- printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset);
+ if (!mysqli_query($link, $create)) {
+ printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (is_string($php_value))
- $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value);
- else
- $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value);
+ if (is_string($php_value))
+ $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value);
+ else
+ $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value);
- if (!mysqli_query($link, $sql)) {
- printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, $sql)) {
+ printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!$res = mysqli_query($link, 'SELECT id FROM test')) {
- printf("[004] %s, [%d] %s\n", $sql_type,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!$res = mysqli_query($link, 'SELECT id FROM test')) {
+ printf("[004] %s, [%d] %s\n", $sql_type,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!is_object($field = mysqli_fetch_field($res))) {
- printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type,
- gettype($field),
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!is_object($field = mysqli_fetch_field($res))) {
+ printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type,
+ gettype($field),
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if ($field->type != $php_type) {
- $code_name = 'unknown';
- foreach ($datatypes as $k => $v) {
- if ($k == $field->type) {
- $code_name = (is_array($v)) ? $v[0] : $v;
- break;
- }
- }
- printf("[006] Expecting %d for %s got code %d for %s\n",
- $php_type, $sql_type, $field->type, $code_name);
- return false;
- }
+ if ($field->type != $php_type) {
+ $code_name = 'unknown';
+ foreach ($datatypes as $k => $v) {
+ if ($k == $field->type) {
+ $code_name = (is_array($v)) ? $v[0] : $v;
+ break;
+ }
+ }
+ printf("[006] Expecting %d for %s got code %d for %s\n",
+ $php_type, $sql_type, $field->type, $code_name);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- $datatypes = array(
- MYSQLI_TYPE_TINY => array('TINYINT', 5),
- MYSQLI_TYPE_SHORT => array('SMALLINT', 10),
- MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing',
- MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'),
- MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'),
- MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'),
- MYSQLI_TYPE_LONGLONG => array('BIGINT', 100),
- MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10),
- MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'),
- MYSQLI_TYPE_TIME => array('TIME', '18:41:38'),
- MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'),
- MYSQLI_TYPE_YEAR => array('YEAR', '2007'),
- MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'),
- // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string
- // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob
- // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob
- // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob
- MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("BLOB", 'silly'),
- MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'),
- MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing',
- MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'),
- MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'),
- MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing',
- MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing',
- MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing',
- MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing',
- );
+ $datatypes = array(
+ MYSQLI_TYPE_TINY => array('TINYINT', 5),
+ MYSQLI_TYPE_SHORT => array('SMALLINT', 10),
+ MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing',
+ MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'),
+ MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'),
+ MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'),
+ MYSQLI_TYPE_LONGLONG => array('BIGINT', 100),
+ MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10),
+ MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'),
+ MYSQLI_TYPE_TIME => array('TIME', '18:41:38'),
+ MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'),
+ MYSQLI_TYPE_YEAR => array('YEAR', '2007'),
+ MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'),
+ // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string
+ // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob
+ // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob
+ // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob
+ MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("BLOB", 'silly'),
+ MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'),
+ MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing',
+ MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'),
+ MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'),
+ MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing',
+ MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing',
+ MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing',
+ MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing',
+ );
- if ($IS_MYSQLND) {
- $version = 50007 + 1;
- } else {
- $version = mysqli_get_client_version();
- }
+ if ($IS_MYSQLND) {
+ $version = 50007 + 1;
+ } else {
+ $version = mysqli_get_client_version();
+ }
- if ($version > 50002) {
- $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1');
- $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0);
- } else {
- $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1');
- }
+ if ($version > 50002) {
+ $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1');
+ $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0);
+ } else {
+ $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1');
+ }
- foreach ($datatypes as $php_type => $datatype) {
- if (is_array($datatype))
- mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
- }
+ foreach ($datatypes as $php_type => $datatype) {
+ if (is_array($datatype))
+ mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
+ }
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt
index 8bf1f5ee15..2a74d836a0 100644
--- a/ext/mysqli/tests/mysqli_fetch_fields.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt
@@ -8,58 +8,58 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ if (!is_null($tmp = @mysqli_fetch_fields()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_fields($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- $charsetInfo = mysqli_get_charset($link);
+ $charsetInfo = mysqli_get_charset($link);
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- $fields = mysqli_fetch_fields($res);
- foreach ($fields as $k => $field) {
- var_dump($field);
- switch ($k) {
- case 1:
- /* label column, result set charset */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset,
- $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length,
- $field->max_length);
- }
- break;
- }
- }
+ $fields = mysqli_fetch_fields($res);
+ foreach ($fields as $k => $field) {
+ var_dump($field);
+ switch ($k) {
+ case 1:
+ /* label column, result set charset */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length,
+ $field->max_length);
+ }
+ break;
+ }
+ }
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_fetch_fields($res)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_fetch_fields($res)))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
index aa7d1aaa2d..20150bacba 100644
--- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
@@ -8,35 +8,35 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_null($tmp = @mysqli_fetch_lengths()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_lengths()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_lengths($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_lengths($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- var_dump(mysqli_fetch_lengths($res));
- while ($row = mysqli_fetch_assoc($res))
- var_dump(mysqli_fetch_lengths($res));
- var_dump(mysqli_fetch_lengths($res));
+ var_dump(mysqli_fetch_lengths($res));
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump(mysqli_fetch_lengths($res));
+ var_dump(mysqli_fetch_lengths($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- var_dump(mysqli_fetch_lengths($res));
+ var_dump(mysqli_fetch_lengths($res));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
index ef06436c26..0dd65af682 100644
--- a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
@@ -8,25 +8,25 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect\n");
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect\n");
- require('table.inc');
- if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ require('table.inc');
+ if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- var_dump($res->lengths);
- while ($row = $res->fetch_assoc())
- var_dump($res->lengths);
- var_dump($res->lengths);
+ var_dump($res->lengths);
+ while ($row = $res->fetch_assoc())
+ var_dump($res->lengths);
+ var_dump($res->lengths);
- $res->free_result();
- var_dump($res->lengths);
- $mysqli->close();
- print "done!";
+ $res->free_result();
+ var_dump($res->lengths);
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt
index b6decf9cb8..8839b5f166 100644
--- a/ext/mysqli/tests/mysqli_fetch_object.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object.phpt
@@ -8,137 +8,137 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include_once("connect.inc");
-
- set_error_handler('handle_catchable_fatal');
-
- $tmp = NULL;
- $link = NULL;
+ include_once("connect.inc");
+
+ set_error_handler('handle_catchable_fatal');
+
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_fetch_object()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_object()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_object($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_object($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- $obj = mysqli_fetch_object($res);
- if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
- printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
- class mysqli_fetch_object_test {
-
- public $a = null;
- public $b = null;
-
- public function toString() {
- var_dump($this);
- }
- }
-
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test');
- if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
- printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
-
-
- class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
-
- public function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
-
- }
-
- try {
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());
- if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- try {
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a'));
- if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b'));
- if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
- var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c')));
- var_dump(mysqli_fetch_object($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_free_result($res);
- var_dump(mysqli_fetch_object($res));
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /*
- TODO
- I'm using the procedural interface, this should not throw an exception.
- Also, I did not ask to get exceptions using the mysqli_options()
- */
- try {
- if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
- printf("[011] Should have failed\n");
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test {
-
- private function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
- }
- /*
- TODO
- I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context
- var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2));
- This does not fail.
- */
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b'));
- mysqli_free_result($res);
-
- // Fatal error, script execution will end
- var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist'));
-
-
- mysqli_close($link);
- print "done!";
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ $obj = mysqli_fetch_object($res);
+ if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
+ printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_test {
+
+ public $a = null;
+ public $b = null;
+
+ public function toString() {
+ var_dump($this);
+ }
+ }
+
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test');
+ if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
+ printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+
+
+ class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
+
+ public function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+
+ }
+
+ try {
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());
+ if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ try {
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a'));
+ if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b'));
+ if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+ var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c')));
+ var_dump(mysqli_fetch_object($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ mysqli_free_result($res);
+ var_dump(mysqli_fetch_object($res));
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ /*
+ TODO
+ I'm using the procedural interface, this should not throw an exception.
+ Also, I did not ask to get exceptions using the mysqli_options()
+ */
+ try {
+ if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
+ printf("[011] Should have failed\n");
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test {
+
+ private function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+ }
+ /*
+ TODO
+ I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context
+ var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2));
+ This does not fail.
+ */
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b'));
+ mysqli_free_result($res);
+
+ // Fatal error, script execution will end
+ var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist'));
+
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
index 8967e7e4fe..b7c83358ab 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
@@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- class mysqli_fetch_object_test {
+ class mysqli_fetch_object_test {
- public $a = null;
- public $b = null;
+ public $a = null;
+ public $b = null;
- public function toString() {
- var_dump($this);
- }
- }
+ public function toString() {
+ var_dump($this);
+ }
+ }
- printf("No exception with PHP:\n");
- var_dump($obj = new mysqli_fetch_object_test(1, 2));
+ printf("No exception with PHP:\n");
+ var_dump($obj = new mysqli_fetch_object_test(1, 2));
- printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n");
- try {
- var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2)));
- } catch (Exception $e) {
- printf("Exception: %s\n", $e->getMessage());
- }
+ printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n");
+ try {
+ var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2)));
+ } catch (Exception $e) {
+ printf("Exception: %s\n", $e->getMessage());
+ }
- printf("\nFatal error with PHP (but no exception!):\n");
- var_dump($obj->mysqli_fetch_object_test(1, 2));
+ printf("\nFatal error with PHP (but no exception!):\n");
+ var_dump($obj->mysqli_fetch_object_test(1, 2));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
index 77db2b6340..9df9b60d02 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
@@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- $obj = mysqli_fetch_object($res);
- var_dump(gettype($obj));
- mysqli_close($link);
- print "done!";
+ $obj = mysqli_fetch_object($res);
+ var_dump(gettype($obj));
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
index dffa2a9f2b..ca7f590d05 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
@@ -8,121 +8,121 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- set_error_handler('handle_catchable_fatal');
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_object()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] 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->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!is_null($tmp = @$res->fetch_object($link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- try {
- if (!is_null($tmp = @$res->fetch_object($link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
-
- try {
- if (!is_null($tmp = @$res->fetch_object($link, $link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
- $obj = mysqli_fetch_object($res);
- if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
- printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- class mysqli_fetch_object_test {
-
- public $a = null;
- public $b = null;
-
- public function toString() {
- var_dump($this);
- }
- }
-
- $obj = $res->fetch_object('mysqli_fetch_object_test');
- if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
- printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
-
- public function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
-
- }
-
- try {
- $obj = $res->fetch_object('mysqli_fetch_object_construct', null);
-
- if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- mysqli_fetch_object($res);
- }
-
- try {
- $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a'));
- if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b'));
- if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c')));
- var_dump(mysqli_fetch_object($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- mysqli_free_result($res);
-
- var_dump(mysqli_fetch_object($res));
-
- // Fatal error, script execution will end
- var_dump($res->fetch_object('this_class_does_not_exist'));
-
- $mysqli->close();
- print "done!";
+ require_once("connect.inc");
+ set_error_handler('handle_catchable_fatal');
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $mysqli = new mysqli();
+ $res = @new mysqli_result($mysqli);
+ if (false !== ($tmp = @$res->fetch_object()))
+ printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] 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->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!is_null($tmp = @$res->fetch_object($link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ try {
+ if (!is_null($tmp = @$res->fetch_object($link, $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+
+ try {
+ if (!is_null($tmp = @$res->fetch_object($link, $link, $link)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+ $obj = mysqli_fetch_object($res);
+ if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
+ printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_test {
+
+ public $a = null;
+ public $b = null;
+
+ public function toString() {
+ var_dump($this);
+ }
+ }
+
+ $obj = $res->fetch_object('mysqli_fetch_object_test');
+ if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
+ printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
+
+ public function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+
+ }
+
+ try {
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', null);
+
+ if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ mysqli_fetch_object($res);
+ }
+
+ try {
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a'));
+ if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b'));
+ if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c')));
+ var_dump(mysqli_fetch_object($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ mysqli_free_result($res);
+
+ var_dump(mysqli_fetch_object($res));
+
+ // Fatal error, script execution will end
+ var_dump($res->fetch_object('this_class_does_not_exist'));
+
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt
index 802e214212..86193a8715 100644
--- a/ext/mysqli/tests/mysqli_fetch_row.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_row.phpt
@@ -8,34 +8,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_fetch_row()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_row()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_fetch_row($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_fetch_row($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "[004]\n";
- var_dump(mysqli_fetch_row($res));
+ print "[004]\n";
+ var_dump(mysqli_fetch_row($res));
- print "[005]\n";
- var_dump(mysqli_fetch_row($res));
+ print "[005]\n";
+ var_dump(mysqli_fetch_row($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- var_dump(mysqli_fetch_row($res));
+ var_dump(mysqli_fetch_row($res));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt
index 7817d70aff..4daaa18a7e 100644
--- a/ext/mysqli/tests/mysqli_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_field_count.phpt
@@ -8,44 +8,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_count()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_count($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- var_dump(mysqli_field_count($link));
+ var_dump(mysqli_field_count($link));
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- var_dump(mysqli_field_count($link));
+ var_dump(mysqli_field_count($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($link->field_count);
- var_dump(mysqli_field_count($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($link->field_count);
+ var_dump(mysqli_field_count($link));
- if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_field_count($link));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_field_count($link));
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_field_count($link));
+ var_dump(mysqli_field_count($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt
index 95100d7afb..a94860e860 100644
--- a/ext/mysqli/tests/mysqli_field_seek.phpt
+++ b/ext/mysqli/tests/mysqli_field_seek.phpt
@@ -8,116 +8,116 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- function mysqli_field_seek_flags($flags) {
+ function mysqli_field_seek_flags($flags) {
- $ret = '';
+ $ret = '';
- if ($flags & MYSQLI_NOT_NULL_FLAG)
- $ret .= 'MYSQLI_NOT_NULL_FLAG ';
+ if ($flags & MYSQLI_NOT_NULL_FLAG)
+ $ret .= 'MYSQLI_NOT_NULL_FLAG ';
- if ($flags & MYSQLI_PRI_KEY_FLAG)
- $ret .= 'MYSQLI_PRI_KEY_FLAG ';
+ if ($flags & MYSQLI_PRI_KEY_FLAG)
+ $ret .= 'MYSQLI_PRI_KEY_FLAG ';
- if ($flags & MYSQLI_UNIQUE_KEY_FLAG)
- $ret .= 'MYSQLI_UNIQUE_KEY_FLAG ';
+ if ($flags & MYSQLI_UNIQUE_KEY_FLAG)
+ $ret .= 'MYSQLI_UNIQUE_KEY_FLAG ';
- if ($flags & MYSQLI_MULTIPLE_KEY_FLAG)
- $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG ';
+ if ($flags & MYSQLI_MULTIPLE_KEY_FLAG)
+ $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG ';
- if ($flags & MYSQLI_BLOB_FLAG)
- $ret .= 'MYSQLI_BLOB_FLAG ';
+ if ($flags & MYSQLI_BLOB_FLAG)
+ $ret .= 'MYSQLI_BLOB_FLAG ';
- if ($flags & MYSQLI_UNSIGNED_FLAG)
- $ret .= 'MYSQLI_UNSIGNED_FLAG ';
+ if ($flags & MYSQLI_UNSIGNED_FLAG)
+ $ret .= 'MYSQLI_UNSIGNED_FLAG ';
- if ($flags & MYSQLI_ZEROFILL_FLAG)
- $ret .= 'MYSQLI_ZEROFILL_FLAG ';
+ if ($flags & MYSQLI_ZEROFILL_FLAG)
+ $ret .= 'MYSQLI_ZEROFILL_FLAG ';
- if ($flags & MYSQLI_AUTO_INCREMENT_FLAG)
- $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG ';
+ if ($flags & MYSQLI_AUTO_INCREMENT_FLAG)
+ $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG ';
- if ($flags & MYSQLI_TIMESTAMP_FLAG)
- $ret .= 'MYSQLI_TIMESTAMP_FLAG ';
+ if ($flags & MYSQLI_TIMESTAMP_FLAG)
+ $ret .= 'MYSQLI_TIMESTAMP_FLAG ';
- if ($flags & MYSQLI_SET_FLAG)
- $ret .= 'MYSQLI_SET_FLAG ';
+ if ($flags & MYSQLI_SET_FLAG)
+ $ret .= 'MYSQLI_SET_FLAG ';
- if ($flags & MYSQLI_NUM_FLAG)
- $ret .= 'MYSQLI_NUM_FLAG ';
+ if ($flags & MYSQLI_NUM_FLAG)
+ $ret .= 'MYSQLI_NUM_FLAG ';
- if ($flags & MYSQLI_PART_KEY_FLAG)
- $ret .= 'MYSQLI_PART_KEY_FLAG ';
+ if ($flags & MYSQLI_PART_KEY_FLAG)
+ $ret .= 'MYSQLI_PART_KEY_FLAG ';
- if ($flags & MYSQLI_GROUP_FLAG)
- $ret .= 'MYSQLI_GROUP_FLAG ';
+ if ($flags & MYSQLI_GROUP_FLAG)
+ $ret .= 'MYSQLI_GROUP_FLAG ';
- return $ret;
- }
+ return $ret;
+ }
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_field_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_seek()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_field_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_seek($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- $charsetInfo = mysqli_get_charset($link);
+ $charsetInfo = mysqli_get_charset($link);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- var_dump(mysqli_field_seek($res, -1));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, 1));
+ var_dump(mysqli_field_seek($res, -1));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_seek($res, 1));
- $field = mysqli_fetch_field($res);
- var_dump($field);
- /* label column, result set charset */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $field->max_length);
- }
+ $field = mysqli_fetch_field($res);
+ var_dump($field);
+ /* label column, result set charset */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $field->max_length);
+ }
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek($res, 2));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1));
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, 2));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1));
- if (!is_null($tmp = @mysqli_field_seek($res, 0, "too many")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_seek($res, 0, "too many")))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_fetch_field($res));
+ if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_fetch_field($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_field_seek($res, 0));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt
index 4c461660ce..825f6e51a0 100644
--- a/ext/mysqli/tests/mysqli_field_tell.phpt
+++ b/ext/mysqli/tests/mysqli_field_tell.phpt
@@ -8,51 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_field_tell()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_tell()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_field_tell($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_tell($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek(1));
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek(1));
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_tell($res));
- if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- var_dump(mysqli_field_seek($res, 2));
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, 2));
+ var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek($res, -1));
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, -1));
+ var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_field_tell($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_tell($res));
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fork.phpt b/ext/mysqli/tests/mysqli_fork.phpt
index bb9cc7adf4..cd03a4ef51 100644
--- a/ext/mysqli/tests/mysqli_fork.phpt
+++ b/ext/mysqli/tests/mysqli_fork.phpt
@@ -21,206 +21,206 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("table.inc");
-
- $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message");
- $pid = pcntl_fork();
- switch ($pid) {
- case -1:
- printf("[001] Cannot fork child");
- break;
-
- case 0:
- /* child */
- exit(0);
- break;
-
- default:
- /* parent */
- $status = null;
- $wait_id = pcntl_waitpid($pid, $status);
- if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
- printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
- printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
- printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
- }
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- break;
- }
-
- if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1"))
- printf("[003] Expecting error and closed connection, child exit should have closed connection\n");
- else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link))))
- printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n",
- gettype($errno), $errno, gettype($error), $error);
-
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- /* non trivial tests require a message list for parent-child communication */
- if (!mysqli_query($link, "DROP TABLE IF EXISTS messages"))
- printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- if (!mysqli_query($link, "CREATE TABLE messages(
- msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- msg_time TIMESTAMP,
- pid INT NOT NULL,
- sender ENUM('child', 'parent') NOT NULL,
- msg TEXT) ENGINE = InnoDB"))
- printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- mysqli_autocommit($link, false);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT))
- printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- $pid = pcntl_fork();
-
- switch ($pid) {
- case -1:
- printf("[009] Cannot fork child");
- break;
-
- case 0:
- /* child */
- if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true))
- exit(mysqli_errno($plink));
-
- $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid());
- if (!mysqli_query($plink, sprintf($sql, 'start')))
- exit(mysqli_errno($plink));
-
- $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid());
- $msg_id = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* send row to parent */
- ob_start();
- var_dump($row);
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!mysqli_query($plink, sprintf($sql, $tmp)))
- exit(mysqli_errno($plink));
-
- /* let the parent reply... */
- $start = time();
- do {
- usleep(100);
- if (!$pres = mysqli_query($plink, $parent_sql))
- continue;
- $tmp = mysqli_fetch_assoc($pres);
- mysqli_free_result($pres);
- if (!$tmp || $tmp['msg_id'] == $msg_id)
- /* no new message */
- continue;
- if ($tmp['msg'] == 'stop')
- break 2;
- $msg_id = $tmp['msg_id'];
- break;
- } while ((time() - $start) < 5);
-
- }
-
- if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link))
- exit(mysqli_errno($plink));
- exit(0);
- break;
-
- default:
- /* parent */
- if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- $status = null;
- $start = time();
- $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid);
- $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid());
- $last_msg_id = 0;
- $num_rows = 0;
- do {
- $wait_id = pcntl_waitpid($pid, $status, WNOHANG);
- if ($pres = mysqli_query($plink, $sql)) {
- $row = mysqli_fetch_assoc($pres);
- if ($row && $row['msg_id'] != $last_msg_id) {
- $last_msg_id = $row['msg_id'];
- switch ($row['msg']) {
- case 'start':
- break;
- case 'stop':
- break 2;
- default:
- /* client has started fetching rows */
- $client_row = $row['msg'];
-
- $num_rows++;
- if ($num_rows > 3) {
- printf("[011] Child has fetched more than three rows!\n");
- var_dump($client_row);
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- if (!$parent_row = mysqli_fetch_assoc($res)) {
- printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- ob_start();
- var_dump($parent_row);
- $parent_row = ob_get_contents();
- ob_end_clean();
-
- if ($parent_row != $client_row) {
- printf("[015] Child indicates different results than parent.\n");
- var_dump($client_row);
- var_dump($parent_row);
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) {
- printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break;
- }
- }
- mysqli_free_result($pres);
- }
- usleep(100);
- } while (((time() - $start) < 5) && ($num_rows < 3));
- mysqli_close($plink);
- $wait_id = pcntl_waitpid($pid, $status);
- if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
- printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
- printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
- printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
- }
- break;
- }
- mysqli_free_result($res);
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[018] 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_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC"))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- while ($row = mysqli_fetch_assoc($res))
- printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5));
- mysqli_free_result($res);
-
- print "done!";
+ require_once("table.inc");
+
+ $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message");
+ $pid = pcntl_fork();
+ switch ($pid) {
+ case -1:
+ printf("[001] Cannot fork child");
+ break;
+
+ case 0:
+ /* child */
+ exit(0);
+ break;
+
+ default:
+ /* parent */
+ $status = null;
+ $wait_id = pcntl_waitpid($pid, $status);
+ if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
+ printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
+ printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
+ printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
+ }
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ break;
+ }
+
+ if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1"))
+ printf("[003] Expecting error and closed connection, child exit should have closed connection\n");
+ else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link))))
+ printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n",
+ gettype($errno), $errno, gettype($error), $error);
+
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ /* non trivial tests require a message list for parent-child communication */
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS messages"))
+ printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ if (!mysqli_query($link, "CREATE TABLE messages(
+ msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ msg_time TIMESTAMP,
+ pid INT NOT NULL,
+ sender ENUM('child', 'parent') NOT NULL,
+ msg TEXT) ENGINE = InnoDB"))
+ printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ mysqli_autocommit($link, false);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT))
+ printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ $pid = pcntl_fork();
+
+ switch ($pid) {
+ case -1:
+ printf("[009] Cannot fork child");
+ break;
+
+ case 0:
+ /* child */
+ if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true))
+ exit(mysqli_errno($plink));
+
+ $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid());
+ if (!mysqli_query($plink, sprintf($sql, 'start')))
+ exit(mysqli_errno($plink));
+
+ $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid());
+ $msg_id = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* send row to parent */
+ ob_start();
+ var_dump($row);
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!mysqli_query($plink, sprintf($sql, $tmp)))
+ exit(mysqli_errno($plink));
+
+ /* let the parent reply... */
+ $start = time();
+ do {
+ usleep(100);
+ if (!$pres = mysqli_query($plink, $parent_sql))
+ continue;
+ $tmp = mysqli_fetch_assoc($pres);
+ mysqli_free_result($pres);
+ if (!$tmp || $tmp['msg_id'] == $msg_id)
+ /* no new message */
+ continue;
+ if ($tmp['msg'] == 'stop')
+ break 2;
+ $msg_id = $tmp['msg_id'];
+ break;
+ } while ((time() - $start) < 5);
+
+ }
+
+ if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link))
+ exit(mysqli_errno($plink));
+ exit(0);
+ break;
+
+ default:
+ /* parent */
+ if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ $status = null;
+ $start = time();
+ $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid);
+ $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid());
+ $last_msg_id = 0;
+ $num_rows = 0;
+ do {
+ $wait_id = pcntl_waitpid($pid, $status, WNOHANG);
+ if ($pres = mysqli_query($plink, $sql)) {
+ $row = mysqli_fetch_assoc($pres);
+ if ($row && $row['msg_id'] != $last_msg_id) {
+ $last_msg_id = $row['msg_id'];
+ switch ($row['msg']) {
+ case 'start':
+ break;
+ case 'stop':
+ break 2;
+ default:
+ /* client has started fetching rows */
+ $client_row = $row['msg'];
+
+ $num_rows++;
+ if ($num_rows > 3) {
+ printf("[011] Child has fetched more than three rows!\n");
+ var_dump($client_row);
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ if (!$parent_row = mysqli_fetch_assoc($res)) {
+ printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ ob_start();
+ var_dump($parent_row);
+ $parent_row = ob_get_contents();
+ ob_end_clean();
+
+ if ($parent_row != $client_row) {
+ printf("[015] Child indicates different results than parent.\n");
+ var_dump($client_row);
+ var_dump($parent_row);
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) {
+ printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break;
+ }
+ }
+ mysqli_free_result($pres);
+ }
+ usleep(100);
+ } while (((time() - $start) < 5) && ($num_rows < 3));
+ mysqli_close($plink);
+ $wait_id = pcntl_waitpid($pid, $status);
+ if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
+ printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
+ printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
+ printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
+ }
+ break;
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[018] 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_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC"))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ while ($row = mysqli_fetch_assoc($res))
+ printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5));
+ mysqli_free_result($res);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt
index 45957aae48..5b8fd14f97 100644
--- a/ext/mysqli/tests/mysqli_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_free_result.phpt
@@ -8,47 +8,47 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_free_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_free_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "a\n";
- var_dump(mysqli_free_result($res));
- print "b\n";
- var_dump(mysqli_free_result($res));
+ print "a\n";
+ var_dump(mysqli_free_result($res));
+ print "b\n";
+ var_dump(mysqli_free_result($res));
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "c\n";
- var_dump($res = mysqli_store_result($link));
- var_dump(mysqli_error($link));
- print "[005]\n";
- var_dump(mysqli_free_result($res));
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "c\n";
+ var_dump($res = mysqli_store_result($link));
+ var_dump(mysqli_error($link));
+ print "[005]\n";
+ var_dump(mysqli_free_result($res));
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "d\n";
- var_dump($res = mysqli_use_result($link));
- var_dump(mysqli_error($link));
- print "[007]\n";
- var_dump(mysqli_free_result($res));
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "d\n";
+ var_dump($res = mysqli_use_result($link));
+ var_dump(mysqli_error($link));
+ print "[007]\n";
+ var_dump(mysqli_free_result($res));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt
index 5a55716582..e567458bc4 100644
--- a/ext/mysqli/tests/mysqli_get_charset.phpt
+++ b/ext/mysqli/tests/mysqli_get_charset.phpt
@@ -10,101 +10,101 @@ if (!function_exists('mysqli_get_charset'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_get_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[006] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation']))
- printf("[008] Cannot determine current character set and collation\n");
-
- if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection)))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (empty($tmp))
- printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n");
-
- $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : '';
- $comment = (isset($tmp['Description'])) ? $tmp['Description'] : '';
-
- if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($id = $tmp['Id']))
- printf("[012] Cannot fetch Id/Number, test will fail\n");
-
- if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'")))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($character_sets_dir = $tmp['Value']))
- printf("[014] Cannot fetch character_sets_dir, test will fail\n");
-
- if (!is_object($charset = mysqli_get_charset($link)))
- printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
-
- if (!isset($charset->charset) ||
- !in_array(gettype($charset->charset), array("string", "unicode")) ||
- ($character_set_connection !== $charset->charset))
- printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset);
- if (!isset($charset->collation) ||
- !in_array(gettype($charset->collation), array("string", "unicode")) ||
- ($collation_connection !== $charset->collation))
- printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation);
-
- if (!isset($charset->dir) ||
- !is_string($charset->dir))
- printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir);
-
- if (!isset($charset->min_length) ||
- !(is_int($charset->min_length)) ||
- ($charset->min_length < 0) ||
- ($charset->min_length > $charset->max_length))
- printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length,
- gettype($charset->min_length), $charset->min_length);
-
- if (!isset($charset->number) ||
- !is_int($charset->number) ||
- ($charset->number !== (int)$id))
- printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number);
-
- if (!isset($charset->state) ||
- !is_int($charset->state))
- printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_get_charset($link)))
- printf("[023] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_get_charset()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_charset($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_set_charset($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[006] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation']))
+ printf("[008] Cannot determine current character set and collation\n");
+
+ if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection)))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (empty($tmp))
+ printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n");
+
+ $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : '';
+ $comment = (isset($tmp['Description'])) ? $tmp['Description'] : '';
+
+ if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($id = $tmp['Id']))
+ printf("[012] Cannot fetch Id/Number, test will fail\n");
+
+ if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'")))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($character_sets_dir = $tmp['Value']))
+ printf("[014] Cannot fetch character_sets_dir, test will fail\n");
+
+ if (!is_object($charset = mysqli_get_charset($link)))
+ printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
+
+ if (!isset($charset->charset) ||
+ !in_array(gettype($charset->charset), array("string", "unicode")) ||
+ ($character_set_connection !== $charset->charset))
+ printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset);
+ if (!isset($charset->collation) ||
+ !in_array(gettype($charset->collation), array("string", "unicode")) ||
+ ($collation_connection !== $charset->collation))
+ printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation);
+
+ if (!isset($charset->dir) ||
+ !is_string($charset->dir))
+ printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir);
+
+ if (!isset($charset->min_length) ||
+ !(is_int($charset->min_length)) ||
+ ($charset->min_length < 0) ||
+ ($charset->min_length > $charset->max_length))
+ printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length,
+ gettype($charset->min_length), $charset->min_length);
+
+ if (!isset($charset->number) ||
+ !is_int($charset->number) ||
+ ($charset->number !== (int)$id))
+ printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number);
+
+ if (!isset($charset->state) ||
+ !is_int($charset->state))
+ printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state);
+
+ mysqli_close($link);
+
+ if (false !== ($tmp = mysqli_get_charset($link)))
+ printf("[023] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_client_info.phpt b/ext/mysqli/tests/mysqli_get_client_info.phpt
index 0e8642d35d..41b0870b37 100644
--- a/ext/mysqli/tests/mysqli_get_client_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_info.phpt
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!is_string($info = mysqli_get_client_info()) || ('' === $info))
- printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
+ require_once("connect.inc");
+ if (!is_string($info = mysqli_get_client_info()) || ('' === $info))
+ printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt
index 948212a7e9..2ffa988bac 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt
@@ -926,22 +926,22 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
- printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
- printf("[c004] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c004] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats_"))
- printf("[c005] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c005] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats"))
- printf("[c006] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c006] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP SERVER IF EXISTS myself"))
- printf("[c007] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c007] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
index b945db128f..df5e21bf6f 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
@@ -38,7 +38,7 @@ mysqlnd.collect_memory_statistics=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
BEGINNING: implicit_free_result = %d
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
index edb868054d..62e0d3ffb0 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
@@ -42,7 +42,7 @@ mysqlnd.collect_memory_statistics=0
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
index 214baf8f71..734b13ab4d 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
@@ -91,7 +91,7 @@ mysqlnd.collect_memory_statistics=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
BEGINNING: rows_fetched_from_client_ps_unbuffered = %d
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
index 9eca46e84a..53c480551f 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
@@ -14,37 +14,37 @@ if (!function_exists('mysqli_get_client_stats')) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $num_rows = mysqli_num_rows($res);
- assert($num_rows > 2);
- mysqli_free_result($res);
+ $num_rows = mysqli_num_rows($res);
+ assert($num_rows > 2);
+ mysqli_free_result($res);
- $before = mysqli_get_client_stats();
- printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']);
+ $before = mysqli_get_client_stats();
+ printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']);
- if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* fetch all rows but the last one */
- for ($i = 0; $i < $num_rows - 1; $i++)
- $row = mysqli_fetch_assoc($res);
+ /* fetch all rows but the last one */
+ for ($i = 0; $i < $num_rows - 1; $i++)
+ $row = mysqli_fetch_assoc($res);
- /* enforce implicit cleaning of the wire and skipping the last row */
- mysqli_free_result($res);
- $after = mysqli_get_client_stats();
- printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']);
+ /* enforce implicit cleaning of the wire and skipping the last row */
+ mysqli_free_result($res);
+ $after = mysqli_get_client_stats();
+ printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']);
- if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1)
- printf("Statistics should show an increase of 1 for rows_skipped_normal, ".
- "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']);
+ if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1)
+ printf("Statistics should show an increase of 1 for rows_skipped_normal, ".
+ "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
BEFORE: rows_skipped_normal = %d
diff --git a/ext/mysqli/tests/mysqli_get_client_version.phpt b/ext/mysqli/tests/mysqli_get_client_version.phpt
index dbf5e3004a..88e1e85e15 100644
--- a/ext/mysqli/tests/mysqli_get_client_version.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_version.phpt
@@ -5,10 +5,10 @@ mysqli_get_client_version()
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- if (!is_int($info = mysqli_get_client_version()) || ($info < 100))
- printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if (!is_int($info = mysqli_get_client_version()) || ($info < 100))
+ printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats.phpt b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
index be2dd150e5..cd559afe21 100644
--- a/ext/mysqli/tests/mysqli_get_connection_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
@@ -14,70 +14,70 @@ if (!function_exists('mysqli_get_connection_stats')) {
?>
--FILE--
<?php
- $tmp = $link = null;
- if (!is_null($tmp = @mysqli_get_connection_stats()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = $link = null;
+ if (!is_null($tmp = @mysqli_get_connection_stats()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_connection_stats($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_connection_stats($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require("table.inc");
+ require("table.inc");
- if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
- printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
+ printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
- printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
+ if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
+ printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
- foreach ($info as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
- foreach ($info2 as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
+ foreach ($info as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
+ foreach ($info2 as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
- if ($info !== $info2) {
- printf("[005] The hashes should be identical except of the memory related fields\n");
- var_dump($info);
- var_dump($info2);
- }
+ if ($info !== $info2) {
+ printf("[005] The hashes should be identical except of the memory related fields\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- if (!is_array($info = $link->get_connection_stats()) || empty($info))
- printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if (!is_array($info = $link->get_connection_stats()) || empty($info))
+ printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- foreach ($info as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
+ foreach ($info as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
- if ($info !== $info2) {
- printf("[007] The hashes should be identical except of the memory related fields\n");
- var_dump($info);
- var_dump($info2);
- }
+ if ($info !== $info2) {
+ printf("[007] The hashes should be identical except of the memory related fields\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- mysqli_close($link);
- require("table.inc");
+ mysqli_close($link);
+ require("table.inc");
- if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
- printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
+ printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
- printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
+ if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
+ printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
- // assuming the test is run in a plain-vanilla CLI environment
- if ($info === $info2) {
- printf("[010] The hashes should not be identical\n");
- var_dump($info);
- var_dump($info2);
- }
+ // assuming the test is run in a plain-vanilla CLI environment
+ if ($info === $info2) {
+ printf("[010] The hashes should not be identical\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
index 4124c8c292..e025768e6a 100644
--- a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
+++ b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
@@ -14,40 +14,40 @@ if (!function_exists('mysqli_get_connection_stats')) {
?>
--FILE--
<?php
- // connect and table inc connect to mysql and create tables
- require_once('connect.inc');
+ // connect and table inc connect to mysql and create tables
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $before = mysqli_get_connection_stats($link);
- if (!is_array($before) || empty($before)) {
- printf("[002] Expecting non-empty array, got %s.\n", gettype($before));
- var_dump($before);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $before = mysqli_get_connection_stats($link);
+ if (!is_array($before) || empty($before)) {
+ printf("[002] Expecting non-empty array, got %s.\n", gettype($before));
+ var_dump($before);
+ }
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $after = mysqli_get_connection_stats($link);
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $after = mysqli_get_connection_stats($link);
- if ($before !== $after) {
- printf("[004] Statistics differ!");
- var_dump($before);
- var_dump($after);
- }
+ if ($before !== $after) {
+ printf("[004] Statistics differ!");
+ var_dump($before);
+ var_dump($after);
+ }
- foreach ($after as $k => $v)
- if ($v != 0) {
- printf("[004] Field %s should not have any other value but 0, got %s.\n",
- $k, $v);
- }
+ foreach ($after as $k => $v)
+ if ($v != 0) {
+ printf("[004] Field %s should not have any other value but 0, got %s.\n",
+ $k, $v);
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_host_info.phpt b/ext/mysqli/tests/mysqli_get_host_info.phpt
index c48430ab35..16f5753fc6 100644
--- a/ext/mysqli/tests/mysqli_get_host_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_host_info.phpt
@@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_host_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_host_info()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_host_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_host_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require "table.inc";
- if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info))
- printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
+ require "table.inc";
+ if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info))
+ printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
- /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */
- if (!stristr($info, "TCP/IP"))
- printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info);
- }
- print "done!";
+ if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */
+ if (!stristr($info, "TCP/IP"))
+ printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info);
+ }
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_proto_info.phpt b/ext/mysqli/tests/mysqli_get_proto_info.phpt
index b24ab11fbd..04db0ab466 100644
--- a/ext/mysqli/tests/mysqli_get_proto_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_proto_info.phpt
@@ -8,22 +8,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_proto_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_proto_info()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require "table.inc";
- if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
- printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
+ require "table.inc";
+ if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
+ printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_server_info.phpt b/ext/mysqli/tests/mysqli_get_server_info.phpt
index d56c35062c..8a43ba497b 100644
--- a/ext/mysqli/tests/mysqli_get_server_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_info.phpt
@@ -8,22 +8,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_server_info()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_server_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_server_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require "table.inc";
- if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
- printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
+ require "table.inc";
+ if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
+ printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_server_version.phpt b/ext/mysqli/tests/mysqli_get_server_version.phpt
index ddbf4e73bb..0c766dfb24 100644
--- a/ext/mysqli/tests/mysqli_get_server_version.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_version.phpt
@@ -8,21 +8,21 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_version()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_server_version()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_server_version(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_server_version(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require "table.inc";
- /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
- /* < 30000 = pre 3.2.3, very unlikely! */
- if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000)))
- printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
+ require "table.inc";
+ /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
+ /* < 30000 = pre 3.2.3, very unlikely! */
+ if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000)))
+ printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_warnings.phpt b/ext/mysqli/tests/mysqli_get_warnings.phpt
index 1e57bf2135..6e07f31586 100644
--- a/ext/mysqli/tests/mysqli_get_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_get_warnings.phpt
@@ -11,135 +11,135 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_warnings('')))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings('')))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (false !== ($tmp = mysqli_get_warnings($link))) {
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (false !== ($tmp = mysqli_get_warnings($link))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (!method_exists($warning, 'next'))
- printf("[009] Borked object, method next is missing\n");
+ if (!method_exists($warning, 'next'))
+ printf("[009] Borked object, method next is missing\n");
- $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning)));
- if (!empty($properties))
- printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n");
+ $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning)));
+ if (!empty($properties))
+ printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n");
- if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */
- printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message);
+ if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */
+ printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message);
- if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */
- printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate);
+ if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */
+ printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate);
- if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */
- printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno);
+ if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */
+ printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno);
- if (false !== ($tmp = $warning->next()))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $warning->next()))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (($tmp = mysqli_warning_count($link)) !== 2)
- printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
+ if (($tmp = mysqli_warning_count($link)) !== 2)
+ printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (true !== ($tmp = $warning->next()))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $warning->next()))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $warning->next()))
- printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $warning->next()))
+ printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = new mysqli_warning($mysqli)))
- printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning);
+ if (!is_object($warning = new mysqli_warning($mysqli)))
+ printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning);
- if (!is_string($warning->message) || ('' == $warning->message))
- printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message);
+ if (!is_string($warning->message) || ('' == $warning->message))
+ printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message);
- if (!$mysqli->query("DROP TABLE t1"))
- printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE t1"))
+ printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* Yes, I really want to check if the object property is empty */
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ /* Yes, I really want to check if the object property is empty */
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $warning = new mysqli_warning($mysqli);
- if (false !== ($tmp = $warning->next()))
- printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $warning = new mysqli_warning($mysqli);
+ if (false !== ($tmp = $warning->next()))
+ printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if ('' != ($tmp = $warning->message))
- printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
+ if ('' != ($tmp = $warning->message))
+ printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* out of range, three warnings */
- if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
- printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ /* out of range, three warnings */
+ if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
+ printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $warning = new mysqli_warning($mysqli);
- $i = 1;
- while ($warning->next() && ('' != ($tmp = $warning->message))) {
- $i++;
- }
- if (3 != $i)
- printf("[034] Expecting three warnings, got %d warnings\n", $i);
+ $warning = new mysqli_warning($mysqli);
+ $i = 1;
+ while ($warning->next() && ('' != ($tmp = $warning->message))) {
+ $i++;
+ }
+ if (3 != $i)
+ printf("[034] Expecting three warnings, got %d warnings\n", $i);
- $stmt = mysqli_stmt_init();
- $warning = new mysqli_warning($stmt);
- if (false !== ($tmp = $warning->next()))
- printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init();
+ $warning = new mysqli_warning($stmt);
+ if (false !== ($tmp = $warning->next()))
+ printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
<?php
require_once("connect.inc");
@@ -147,10 +147,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS t1"))
- printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt
index 183775a8a0..fc1207a251 100644
--- a/ext/mysqli/tests/mysqli_info.phpt
+++ b/ext/mysqli/tests/mysqli_info.phpt
@@ -94,7 +94,7 @@ mysqli.allow_local_infile=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_init.phpt b/ext/mysqli/tests/mysqli_init.phpt
index 01e53d5fe8..c8f3ac8ec5 100644
--- a/ext/mysqli/tests/mysqli_init.phpt
+++ b/ext/mysqli/tests/mysqli_init.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- $link = mysqli_init();
+ $link = mysqli_init();
- if (!is_object($link) && false !== $link)
- printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link);
+ if (!is_object($link) && false !== $link)
+ printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link);
- if (is_object($link) && 'mysqli' != get_class($link))
- printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link));
+ if (is_object($link) && 'mysqli' != get_class($link))
+ printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link));
- if ($link)
- mysqli_close($link);
+ if ($link)
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt
index 5c56f3e37e..7cc382b674 100644
--- a/ext/mysqli/tests/mysqli_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_insert_id.phpt
@@ -8,127 +8,127 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
-
- // no auto_increment column
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (($last_id = mysqli_insert_id($link)) <= 0)
- printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id);
-
- if (mysqli_query($link, "LOCK TABLE test WRITE")) {
- /* we need exclusive access for a moment */
- /* let's hope nobody changes auto_increment_increment while this code executes */
- do {
- if (mysqli_get_server_version($link) >= 50000) {
- if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) {
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- mysqli_free_result($res);
- $inc = $row['inc'];
- } else {
- $inc = 1;
- }
-
- if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) {
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (($next_id = mysqli_insert_id($link)) <= $last_id)
- /*
- very likely a bug, but someone could have done something on the server
- between the second last insert and the lock, therefore don't stop just bail
- */
- printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id);
-
- $last_id = $next_id;
- if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- /*
- Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually
- return the AUTO_INCREMENT key from the first of the inserted rows. This allows
- multiple-row inserts to be reproduced correctly on other servers in a replication setup.
- */
- if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) {
- printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id);
- break;
- }
-
- if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) {
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- mysqli_free_result($res);
-
- if ($next_id != $row['last_id']) {
- printf("[019] Something is wrong, check manually. Expecting %s got %s.\n",
- $next_id, $row['last_id']);
- break;
- }
- } while (false);
- mysqli_query($link, "UNLOCK TABLE test");
- }
-
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) {
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (1000 !== ($tmp = mysqli_insert_id($link)))
- printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) {
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (1000 >= ($tmp = mysqli_insert_id($link)))
- printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- var_dump(mysqli_insert_id($link));
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_insert_id()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_insert_id($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
+
+ // no auto_increment column
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (($last_id = mysqli_insert_id($link)) <= 0)
+ printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id);
+
+ if (mysqli_query($link, "LOCK TABLE test WRITE")) {
+ /* we need exclusive access for a moment */
+ /* let's hope nobody changes auto_increment_increment while this code executes */
+ do {
+ if (mysqli_get_server_version($link) >= 50000) {
+ if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) {
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ mysqli_free_result($res);
+ $inc = $row['inc'];
+ } else {
+ $inc = 1;
+ }
+
+ if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) {
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (($next_id = mysqli_insert_id($link)) <= $last_id)
+ /*
+ very likely a bug, but someone could have done something on the server
+ between the second last insert and the lock, therefore don't stop just bail
+ */
+ printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id);
+
+ $last_id = $next_id;
+ if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ /*
+ Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually
+ return the AUTO_INCREMENT key from the first of the inserted rows. This allows
+ multiple-row inserts to be reproduced correctly on other servers in a replication setup.
+ */
+ if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) {
+ printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id);
+ break;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) {
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ mysqli_free_result($res);
+
+ if ($next_id != $row['last_id']) {
+ printf("[019] Something is wrong, check manually. Expecting %s got %s.\n",
+ $next_id, $row['last_id']);
+ break;
+ }
+ } while (false);
+ mysqli_query($link, "UNLOCK TABLE test");
+ }
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) {
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (1000 !== ($tmp = mysqli_insert_id($link)))
+ printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) {
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (1000 >= ($tmp = mysqli_insert_id($link)))
+ printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ var_dump(mysqli_insert_id($link));
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
index 5e9840b910..0cbd23725e 100644
--- a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
+++ b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
@@ -110,7 +110,7 @@ memory_limit=256M
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt
index 5e6d769cef..d453929d9f 100644
--- a/ext/mysqli/tests/mysqli_kill.phpt
+++ b/ext/mysqli/tests/mysqli_kill.phpt
@@ -8,70 +8,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_kill()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_kill($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- // Zend will cast the NULL to 0
- if (!is_bool($tmp = mysqli_kill($link, null)))
- printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$thread_id = mysqli_thread_id($link))
- printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_kill($link, $thread_id);
- if (!is_bool($tmp))
- printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
-
- if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
- pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
-
- var_dump($error = mysqli_error($link));
- if (!is_string($error) || ('' === $error))
- printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
- var_dump($res);
- var_dump($link);
- if ($IS_MYSQLND) {
- if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
- printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
- }
- } else {
- if ($link->info != NULL) {
- printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n");
- }
- }
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_kill()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_kill($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ // Zend will cast the NULL to 0
+ if (!is_bool($tmp = mysqli_kill($link, null)))
+ printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$thread_id = mysqli_thread_id($link))
+ printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_kill($link, $thread_id);
+ if (!is_bool($tmp))
+ printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+
+ if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
+ pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
+
+ var_dump($error = mysqli_error($link));
+ if (!is_string($error) || ('' === $error))
+ printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
+ var_dump($res);
+ var_dump($link);
+ if ($IS_MYSQLND) {
+ if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
+ printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
+ }
+ } else {
+ if ($link->info != NULL) {
+ printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n");
+ }
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_kill($link, -1);
- if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
- (!$tmp = mysqli_fetch_assoc($res))) {
- printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump($tmp);
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_kill($link, -1);
+ if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
+ (!$tmp = mysqli_fetch_assoc($res))) {
+ printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump($tmp);
+ mysqli_free_result($res);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_last_insert_id.phpt b/ext/mysqli/tests/mysqli_last_insert_id.phpt
index 27ec3f3118..0598f29b74 100644
--- a/ext/mysqli/tests/mysqli_last_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_last_insert_id.phpt
@@ -7,172 +7,172 @@ API vs. SQL LAST_INSERT_ID()
?>
--FILE--
<?php
- /*
- CAUTION: the insert_id() API call is not supposed to return
- the same value as a call to the LAST_INSERT_ID() SQL function.
- It is not necessarily a bug if API and SQL function return different
- values. Check the MySQL C API reference manual for details.
- */
- require_once("connect.inc");
-
- function get_sql_id($link) {
- if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- return NULL;
- }
- $row = $res->fetch_assoc();
- $res->close();
-
- return $row['_id'];
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$link->query("DROP TABLE IF EXISTS test") ||
- !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") ||
- !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- printf("API: %d, SQL: %d\n", $api_id, $sql_id);
-
- if ($api_id < 1)
- printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
- if ($api_id != $sql_id)
- printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- // Not an INSERT, API value must become 0
- if (!($res = $link->query("SELECT 1 FROM DUAL")))
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- else
- $res->close();
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- // Insert fails, LAST_INSERT_ID shall not change, API shall return 0
- if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) {
- printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error);
- }
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
-
- if (0 !== $api_id) {
- printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- // Sequence counter pattern...
- if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)"))
- printf("[012] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if ($api_id < 1)
- printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
- if ($api_id != $new_sql_id)
- printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id);
- if ($sql_id == $new_sql_id)
- printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id);
-
- $sql_id = $new_sql_id;
-
- // Not an INSERT (after UPDATE), API value must become 0
- if (!$link->query("SET @myvar=1"))
- printf("[016] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')"))
- printf("[019] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if (!$link->query("INSERT INTO test(label) VALUES ('c')"))
- printf("[021] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
- printf("[023] [%d] %s\n", $link->errno, $link->error);
-
- printf("Dumping table contents before INSERT...SELECT experiments...\n");
- while ($row = $res->fetch_assoc()) {
- printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
- }
- $res->close();
-
- if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC"))
- printf("[024] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC"))
- printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- /* API insert id will be 101 because of UPDATE, SQL unchanged */
- if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) ))
- printf("[029] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if ($api_id != 101)
- printf("[030] API id should be %d got %d\n", $sql_id, $api_id);
- if ($new_sql_id != $sql_id) {
- printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
- printf("[032] [%d] %s\n", $link->errno, $link->error);
-
- printf("Dumping table contents after INSERT...SELECT...\n");
- while ($row = $res->fetch_assoc()) {
- printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
- }
- $res->close();
-
- print "done!";
+ /*
+ CAUTION: the insert_id() API call is not supposed to return
+ the same value as a call to the LAST_INSERT_ID() SQL function.
+ It is not necessarily a bug if API and SQL function return different
+ values. Check the MySQL C API reference manual for details.
+ */
+ require_once("connect.inc");
+
+ function get_sql_id($link) {
+ if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ return NULL;
+ }
+ $row = $res->fetch_assoc();
+ $res->close();
+
+ return $row['_id'];
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$link->query("DROP TABLE IF EXISTS test") ||
+ !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") ||
+ !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ printf("API: %d, SQL: %d\n", $api_id, $sql_id);
+
+ if ($api_id < 1)
+ printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
+ if ($api_id != $sql_id)
+ printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ // Not an INSERT, API value must become 0
+ if (!($res = $link->query("SELECT 1 FROM DUAL")))
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ else
+ $res->close();
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ // Insert fails, LAST_INSERT_ID shall not change, API shall return 0
+ if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) {
+ printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error);
+ }
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+
+ if (0 !== $api_id) {
+ printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ // Sequence counter pattern...
+ if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)"))
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if ($api_id < 1)
+ printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
+ if ($api_id != $new_sql_id)
+ printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id);
+ if ($sql_id == $new_sql_id)
+ printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id);
+
+ $sql_id = $new_sql_id;
+
+ // Not an INSERT (after UPDATE), API value must become 0
+ if (!$link->query("SET @myvar=1"))
+ printf("[016] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')"))
+ printf("[019] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if (!$link->query("INSERT INTO test(label) VALUES ('c')"))
+ printf("[021] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
+ printf("[023] [%d] %s\n", $link->errno, $link->error);
+
+ printf("Dumping table contents before INSERT...SELECT experiments...\n");
+ while ($row = $res->fetch_assoc()) {
+ printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
+ }
+ $res->close();
+
+ if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC"))
+ printf("[024] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC"))
+ printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ /* API insert id will be 101 because of UPDATE, SQL unchanged */
+ if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) ))
+ printf("[029] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if ($api_id != 101)
+ printf("[030] API id should be %d got %d\n", $sql_id, $api_id);
+ if ($new_sql_id != $sql_id) {
+ printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
+ printf("[032] [%d] %s\n", $link->errno, $link->error);
+
+ printf("Dumping table contents after INSERT...SELECT...\n");
+ while ($row = $res->fetch_assoc()) {
+ printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
+ }
+ $res->close();
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_max_links.phpt b/ext/mysqli/tests/mysqli_max_links.phpt
index 25f7eee25d..f7a8ee4870 100644
--- a/ext/mysqli/tests/mysqli_max_links.phpt
+++ b/ext/mysqli/tests/mysqli_max_links.phpt
@@ -38,7 +38,7 @@ mysqli.max_links=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt
index eed4c273cb..977063ef0b 100644
--- a/ext/mysqli/tests/mysqli_more_results.phpt
+++ b/ext/mysqli/tests/mysqli_more_results.phpt
@@ -8,60 +8,60 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_more_results()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_more_results()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_more_results($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_more_results($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- print "[004]\n";
- var_dump(mysqli_more_results($link));
+ print "[004]\n";
+ var_dump(mysqli_more_results($link));
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[006]\n";
- $i = 1;
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[006]\n";
+ $i = 1;
- if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
- do {
- $res = mysqli_store_result($link);
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
- } while (mysqli_next_result($link));
+ if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+ do {
+ $res = mysqli_store_result($link);
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[010]\n";
- $i = 1;
- if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
- printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[010]\n";
+ $i = 1;
+ if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
+ printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
- do {
- $res = mysqli_use_result($link);
- // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function,
- // you must fetch all rows before you can loop to the next result set!
- // See also the MySQL Reference Manual: mysql_use_result()
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
- } while (mysqli_next_result($link));
+ do {
+ $res = mysqli_use_result($link);
+ // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function,
+ // you must fetch all rows before you can loop to the next result set!
+ // See also the MySQL Reference Manual: mysql_use_result()
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_more_results($link));
+ var_dump(mysqli_more_results($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt
index 8b01fbdf88..c0bafe3e44 100644
--- a/ext/mysqli/tests/mysqli_multi_query.phpt
+++ b/ext/mysqli/tests/mysqli_multi_query.phpt
@@ -8,112 +8,112 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_multi_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_multi_query()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_multi_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_multi_query($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = mysqli_multi_query($link, "")))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_multi_query($link, "")))
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $i = 0;
- do {
- $res = mysqli_store_result($link);
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- $i++;
- } while (mysqli_next_result($link));
+ $i = 0;
+ do {
+ $res = mysqli_store_result($link);
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ $i++;
+ } while (mysqli_next_result($link));
- printf("[006] %d\n", $i);
+ printf("[006] %d\n", $i);
- if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $i = 0;
- while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
+ $i = 0;
+ while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- printf("%d/%d\n", $i, mysqli_insert_id($link));
- $i++;
- }
- printf("[008] %d\n", $i);
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ printf("%d/%d\n", $i, mysqli_insert_id($link));
+ $i++;
+ }
+ printf("[008] %d\n", $i);
- if (!mysqli_multi_query($link, "SELECT id, label FROM test"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "SELECT id, label FROM test"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $i = 0;
- while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
- while ($row = mysqli_fetch_array($res))
- $i++;
- mysqli_free_result($res);
- }
- printf("[010] %d\n", $i);
+ $i = 0;
+ while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
+ while ($row = mysqli_fetch_array($res))
+ $i++;
+ mysqli_free_result($res);
+ }
+ printf("[010] %d\n", $i);
- if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $res_num = 1;
- do {
- if (!$res = mysqli_store_result($link)) {
- printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
- continue;
- }
+ $res_num = 1;
+ do {
+ if (!$res = mysqli_store_result($link)) {
+ printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
- $num_rows = 0;
- while ($row = mysqli_fetch_array($res)) {
+ $num_rows = 0;
+ while ($row = mysqli_fetch_array($res)) {
- $num_rows++;
- if ($row['num'] != $res_num)
- printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']);
- if ($row['somechar'] != "a")
- printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']);
+ $num_rows++;
+ if ($row['num'] != $res_num)
+ printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']);
+ if ($row['somechar'] != "a")
+ printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']);
- if (1 == $num_rows) {
- /* simple metadata check */
- if (!($lengths = mysqli_fetch_lengths($res)))
- printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
+ if (1 == $num_rows) {
+ /* simple metadata check */
+ if (!($lengths = mysqli_fetch_lengths($res)))
+ printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
- if (count($lengths) != 2)
- printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths));
+ if (count($lengths) != 2)
+ printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths));
- foreach ($lengths as $k => $length)
- if ($length <= 0)
- printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n",
- $res_num, $k, $length);
- }
- }
+ foreach ($lengths as $k => $length)
+ if ($length <= 0)
+ printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n",
+ $res_num, $k, $length);
+ }
+ }
- if ($num_rows != 1)
- printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows);
+ if ($num_rows != 1)
+ printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows);
- $res_num++;
+ $res_num++;
- mysqli_free_result($res);
+ mysqli_free_result($res);
- } while (mysqli_next_result($link));
+ } while (mysqli_next_result($link));
- if ($res_num != 4)
- printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num);
+ if ($res_num != 4)
+ printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_multi_query($link, "SELECT id, label FROM test"));
+ var_dump(mysqli_multi_query($link, "SELECT id, label FROM test"));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt
index 3afa51b6b5..254bb18279 100644
--- a/ext/mysqli/tests/mysqli_next_result.phpt
+++ b/ext/mysqli/tests/mysqli_next_result.phpt
@@ -8,65 +8,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_next_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_next_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_next_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_next_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $res = mysqli_query($link, "SELECT 1 AS res");
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $res = mysqli_query($link, "SELECT 1 AS res");
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- function func_test_mysqli_next_result($link, $query, $offset, $num_results) {
+ function func_test_mysqli_next_result($link, $query, $offset, $num_results) {
- if (!mysqli_multi_query($link, $query))
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, $query))
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- $i = 0;
- do {
- if ($res = mysqli_store_result($link)) {
- mysqli_free_result($res);
- $i++;
- }
- } while (true === mysqli_next_result($link));
+ $i = 0;
+ do {
+ if ($res = mysqli_store_result($link)) {
+ mysqli_free_result($res);
+ $i++;
+ }
+ } while (true === mysqli_next_result($link));
- if ($i !== $num_results) {
- printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i);
- }
+ if ($i !== $num_results) {
+ printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i);
+ }
- if (mysqli_more_results($link))
- printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3);
+ if (mysqli_more_results($link))
+ printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3);
- if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
- printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
- } else {
- mysqli_free_result($res);
- }
+ if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
+ printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
+ } else {
+ mysqli_free_result($res);
+ }
- }
+ }
- func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3);
- func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2);
- func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1);
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3);
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2);
+ func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_next_result($link));
+ var_dump(mysqli_next_result($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt
index a37e8d1ee9..426afb5e7d 100644
--- a/ext/mysqli/tests/mysqli_num_fields.phpt
+++ b/ext/mysqli/tests/mysqli_num_fields.phpt
@@ -8,45 +8,45 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_num_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_num_fields()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_num_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_num_fields($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) {
+ function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) {
- if (!($res = mysqli_query($link, $query))) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return;
- }
+ if (!($res = mysqli_query($link, $query))) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
- if ($expected !== ($tmp = mysqli_num_fields($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
+ if ($expected !== ($tmp = mysqli_num_fields($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if ($test_free && (false !== ($tmp = mysqli_num_fields($res))))
- printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
- }
+ if ($test_free && (false !== ($tmp = mysqli_num_fields($res))))
+ printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ }
- func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
- func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
- func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
+ func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt
index bd12ffc83b..4cc794db68 100644
--- a/ext/mysqli/tests/mysqli_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_num_rows.phpt
@@ -8,70 +8,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_num_rows()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_num_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) {
+ function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) {
- if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return;
- }
+ if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
- if ($expected !== ($tmp = mysqli_num_rows($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
+ if ($expected !== ($tmp = mysqli_num_rows($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if ($test_free && (false !== ($tmp = mysqli_num_rows($res))))
- printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ if ($test_free && (false !== ($tmp = mysqli_num_rows($res))))
+ printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
- }
+ }
- func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
- func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15);
- func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
+ func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
+ func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15);
+ func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
- if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25);
+ func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25);
- } else {
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
+ if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
- $row = mysqli_fetch_row($res);
- if (0 !== ($tmp = mysqli_num_rows($res)))
- printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
+ $row = mysqli_fetch_row($res);
+ if (0 !== ($tmp = mysqli_num_rows($res)))
+ printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- } else {
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_open_bug74432.phpt b/ext/mysqli/tests/mysqli_open_bug74432.phpt
index 08139081c4..9d529925e9 100644
--- a/ext/mysqli/tests/mysqli_open_bug74432.phpt
+++ b/ext/mysqli/tests/mysqli_open_bug74432.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /* This behavior is undocumented, but might be in use. Until there's no officially
- supported alternative, ensure changes doesn't cause BC breach. Otherwise,
- the test should be removed once the undocumented behavior changes. */
+ /* This behavior is undocumented, but might be in use. Until there's no officially
+ supported alternative, ensure changes doesn't cause BC breach. Otherwise,
+ the test should be removed once the undocumented behavior changes. */
- require_once("connect.inc");
+ require_once("connect.inc");
- $handle = mysqli_connect("$host:$port", $user, $passwd);
+ $handle = mysqli_connect("$host:$port", $user, $passwd);
- var_dump($handle);
+ var_dump($handle);
- if ($handle) {
- mysqli_close($handle);
- }
+ if ($handle) {
+ mysqli_close($handle);
+ }
?>
--EXPECTF--
object(mysqli)#%d (%d) {
diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt
index 6d5247943b..ff9f9ced4b 100644
--- a/ext/mysqli/tests/mysqli_options.phpt
+++ b/ext/mysqli/tests/mysqli_options.phpt
@@ -8,107 +8,107 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $valid_options = array(
- MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP",
- MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE",
- MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT",
- MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE",
- MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND",
- MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME",
- MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
- );
-
- if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
- $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
- if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
- $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE');
- if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'))
- $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_options()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $link = mysqli_init();
-
- /* set it twice, checking if memory for the previous one is correctly freed */
- mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8");
- mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1");
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
-
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] 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_query($link2, 'SELECT version() AS server_version'))
- printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[009] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
- printf("[010] Cannot get list of available character sets, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[] = $row;
- mysqli_free_result($res);
- mysqli_close($link2);
-
- foreach ($charsets as $charset) {
- $k = $charset['Charset'];
- /* The server currently 17.07.2007 can't handle data sent in ucs2 */
- /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
- if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
- continue;
- }
- if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
- printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
- }
- }
-
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
-
- /* mysqli_real_connect() */
- var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
-
- mysqli_close($link);
-
- echo "Link closed";
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
- print "done!";
+ require_once("connect.inc");
+
+ $valid_options = array(
+ MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP",
+ MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE",
+ MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT",
+ MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE",
+ MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND",
+ MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME",
+ MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
+ );
+
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
+ $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
+ $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE');
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'))
+ $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_options()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ $link = mysqli_init();
+
+ /* set it twice, checking if memory for the previous one is correctly freed */
+ mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8");
+ mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1");
+
+ if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
+
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] 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_query($link2, 'SELECT version() AS server_version'))
+ printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[009] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
+ printf("[010] Cannot get list of available character sets, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[] = $row;
+ mysqli_free_result($res);
+ mysqli_close($link2);
+
+ foreach ($charsets as $charset) {
+ $k = $charset['Charset'];
+ /* The server currently 17.07.2007 can't handle data sent in ucs2 */
+ /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+ if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
+ continue;
+ }
+ if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
+ printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
+ }
+ }
+
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+
+ /* mysqli_real_connect() */
+ var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
+
+ mysqli_close($link);
+
+ echo "Link closed";
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
+ print "done!";
?>
--EXPECTF--
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
diff --git a/ext/mysqli/tests/mysqli_options_init_command.phpt b/ext/mysqli/tests/mysqli_options_init_command.phpt
index dd43a42da6..0c554f88ae 100644
--- a/ext/mysqli/tests/mysqli_options_init_command.phpt
+++ b/ext/mysqli/tests/mysqli_options_init_command.phpt
@@ -9,64 +9,64 @@ require_once('skipifconnectfailure.inc');
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- /* see mysqli.c for details */
- require_once("connect.inc");
+ /* see mysqli.c for details */
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* TODO: test more options */
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) ||
- !mysqli_query($link, "INSERT INTO test(id) VALUES (1)"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ /* TODO: test more options */
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) ||
+ !mysqli_query($link, "INSERT INTO test(id) VALUES (1)"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($row['_num_rows'] != 1)
- printf("[003] Expecting 1 got %s\n", $row['_num_rows']);
+ if ($row['_num_rows'] != 1)
+ printf("[003] Expecting 1 got %s\n", $row['_num_rows']);
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[005] 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_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($row['_num_rows'] != 2)
- printf("[007] Expecting 1 got %s\n", $row['_num_rows']);
+ if ($row['_num_rows'] != 2)
+ printf("[007] Expecting 1 got %s\n", $row['_num_rows']);
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
index a4f468a9bf..a9f09f6326 100644
--- a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
+++ b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
@@ -12,94 +12,94 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once("connect.inc");
-
-
- $types = array(
- 'BIT' => array('BIT(8)', 0),
- 'TINYINT' => array('TINYINT', 120),
- 'BOOL' => array('BOOL', 0),
- 'BOOLEAN' => array('BOOLEAN', 1),
- 'SMALLINT' => array('SMALLINT', 32000),
- 'MEDIUMINT' => array('MEDIUMINT', 999),
- 'INT' => array('INT', 999),
- 'BIGINT' => array('BIGINT', 999),
- 'FLOAT' => array('FLOAT', 1.3),
- 'DOUBLE' => array('DOUBLE', -1.3),
- );
-
- foreach ($types as $name => $data) {
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- continue;
- }
-
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
- printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!$res = mysqli_query($link, "SELECT id FROM test")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if ($row['id'] !== $data[1]) {
- printf("[007] Expecting %s - %s/%s got %s/%s\n",
- $name,
- $data[1], gettype($data[1]), $row['id'], gettype($row['id']));
- }
- mysqli_close($link);
-
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- continue;
- }
-
- if (!$res = mysqli_query($link, "SELECT id FROM test")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if (!is_string($row['id']) || ($row['id'] != $data[1])) {
- printf("[011] Expecting %s - %s/string got %s/%s\n",
- $name,
- $data[1], $row['id'], gettype($row['id']));
- }
- mysqli_close($link);
-
- }
-
- print "done!";
+ require_once("connect.inc");
+
+
+ $types = array(
+ 'BIT' => array('BIT(8)', 0),
+ 'TINYINT' => array('TINYINT', 120),
+ 'BOOL' => array('BOOL', 0),
+ 'BOOLEAN' => array('BOOLEAN', 1),
+ 'SMALLINT' => array('SMALLINT', 32000),
+ 'MEDIUMINT' => array('MEDIUMINT', 999),
+ 'INT' => array('INT', 999),
+ 'BIGINT' => array('BIGINT', 999),
+ 'FLOAT' => array('FLOAT', 1.3),
+ 'DOUBLE' => array('DOUBLE', -1.3),
+ );
+
+ foreach ($types as $name => $data) {
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ continue;
+ }
+
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
+ printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if ($row['id'] !== $data[1]) {
+ printf("[007] Expecting %s - %s/%s got %s/%s\n",
+ $name,
+ $data[1], gettype($data[1]), $row['id'], gettype($row['id']));
+ }
+ mysqli_close($link);
+
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if (!is_string($row['id']) || ($row['id'] != $data[1])) {
+ printf("[011] Expecting %s - %s/string got %s/%s\n",
+ $name,
+ $data[1], $row['id'], gettype($row['id']));
+ }
+ mysqli_close($link);
+
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_options_openbasedir.phpt b/ext/mysqli/tests/mysqli_options_openbasedir.phpt
index d7b4b6b13e..52dc03296d 100644
--- a/ext/mysqli/tests/mysqli_options_openbasedir.phpt
+++ b/ext/mysqli/tests/mysqli_options_openbasedir.phpt
@@ -11,15 +11,15 @@ require_once('skipifconnectfailure.inc');
require_once('connect.inc');
ini_set("open_basedir", __DIR__);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if ($IS_MYSQLND) {
- if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
- printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
+ if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
+ printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
} else {
- if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
- printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
+ if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
+ printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
}
mysqli_close($link);
diff --git a/ext/mysqli/tests/mysqli_pam_sha256.phpt b/ext/mysqli/tests/mysqli_pam_sha256.phpt
index c85ede53f2..e4c2d3e850 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256.phpt
@@ -79,29 +79,29 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, "shatest", $db, $port, $socket);
- } else {
+ if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, "shatest", $db, $port, $socket);
+ } else {
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
+ if ($row['id'] != 1) {
+ printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
- $res->close();
- $link->close();
- }
+ $res->close();
+ $link->close();
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
index e19fbb1aaf..69c1036765 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
@@ -116,11 +116,11 @@ mysqlnd.sha256_server_public_key="test_sha256_ini"
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
- $link->query('DROP USER shatest');
- $link->query('DROP USER shatest@localhost');
- $file = "test_sha256_ini";
- @unlink($file);
+ require_once("clean_table.inc");
+ $link->query('DROP USER shatest');
+ $link->query('DROP USER shatest@localhost');
+ $file = "test_sha256_ini";
+ @unlink($file);
?>
--EXPECTF--
Warning: mysqli::__construct(): (HY000/1045): %s in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
index 0ed6ac6dd2..a99f0c2598 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
@@ -89,36 +89,36 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
- if (file_exists($file) && is_readable($file)) {
+ $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+ if (file_exists($file) && is_readable($file)) {
- $link = mysqli_init();
- if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
- printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error);
- }
+ $link = mysqli_init();
+ if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
+ printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error);
- }
+ if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error);
+ }
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
+ if ($row['id'] != 1) {
+ printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
- $res->close();
- $link->close();
- }
+ $res->close();
+ $link->close();
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
index 37b8207e97..8cba560d4a 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
@@ -89,80 +89,80 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function sha_connect($offset, $host, $db, $port, $socket, $file) {
-
- $link = mysqli_init();
- if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
- printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error);
- return false;
- }
-
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
-
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if ($row['id'] != 1) {
- printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']);
- return false;
- }
-
- $res->close();
- $link->close();
- return true;
- }
-
- $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
- if (file_exists($file) && is_readable($file)) {
-
- /* valid key */
- sha_connect(100, $host, $db, $port, $socket, $file);
-
- /* invalid key */
- $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
-
- $key = file_get_contents($file);
- $key = str_replace("A", "a", $key);
- $key = str_replace("M", "m", $key);
- @unlink($file_wrong);
- if (!($fp = fopen($file_wrong, "w"))) {
- printf("[002] Can't write public key file.");
- } else {
- fwrite($fp, $key);
- fclose($fp);
- sha_connect(200, $host, $db, $port, $socket, $file_wrong);
- }
-
- /* empty file */
- @unlink($file_wrong);
- if (!($fp = fopen($file_wrong, "w"))) {
- printf("[003] Can't write public key file.");
- } else {
- fwrite($fp, "");
- fclose($fp);
- sha_connect(300, $host, $db, $port, $socket, $file_wrong);
- }
-
- /* file does not exist */
- @unlink($file_wrong);
- sha_connect(400, $host, $db, $port, $socket, $file_wrong);
-
- } else {
- printf("[001] Cannot read public key file.");
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ function sha_connect($offset, $host, $db, $port, $socket, $file) {
+
+ $link = mysqli_init();
+ if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
+ printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error);
+ return false;
+ }
+
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if ($row['id'] != 1) {
+ printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']);
+ return false;
+ }
+
+ $res->close();
+ $link->close();
+ return true;
+ }
+
+ $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+ if (file_exists($file) && is_readable($file)) {
+
+ /* valid key */
+ sha_connect(100, $host, $db, $port, $socket, $file);
+
+ /* invalid key */
+ $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
+
+ $key = file_get_contents($file);
+ $key = str_replace("A", "a", $key);
+ $key = str_replace("M", "m", $key);
+ @unlink($file_wrong);
+ if (!($fp = fopen($file_wrong, "w"))) {
+ printf("[002] Can't write public key file.");
+ } else {
+ fwrite($fp, $key);
+ fclose($fp);
+ sha_connect(200, $host, $db, $port, $socket, $file_wrong);
+ }
+
+ /* empty file */
+ @unlink($file_wrong);
+ if (!($fp = fopen($file_wrong, "w"))) {
+ printf("[003] Can't write public key file.");
+ } else {
+ fwrite($fp, "");
+ fclose($fp);
+ sha_connect(300, $host, $db, $port, $socket, $file_wrong);
+ }
+
+ /* file does not exist */
+ @unlink($file_wrong);
+ sha_connect(400, $host, $db, $port, $socket, $file_wrong);
+
+ } else {
+ printf("[001] Cannot read public key file.");
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pconn_kill.phpt b/ext/mysqli/tests/mysqli_pconn_kill.phpt
index 5fd719cf2d..af1207bb1a 100644
--- a/ext/mysqli/tests/mysqli_pconn_kill.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_kill.phpt
@@ -89,7 +89,7 @@ mysqli.max_persistent=2
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_pconn_limits.phpt b/ext/mysqli/tests/mysqli_pconn_limits.phpt
index b00b99883a..2a4c25542d 100644
--- a/ext/mysqli/tests/mysqli_pconn_limits.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_limits.phpt
@@ -87,7 +87,7 @@ mysqli.max_links=-1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
Regular connection 1 - 'works..'
diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt
index a01a78a03c..9a0a7fce66 100644
--- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt
@@ -194,7 +194,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost');
diff --git a/ext/mysqli/tests/mysqli_pconnect.phpt b/ext/mysqli/tests/mysqli_pconnect.phpt
index 3fb14d25d9..16fbb27e31 100644
--- a/ext/mysqli/tests/mysqli_pconnect.phpt
+++ b/ext/mysqli/tests/mysqli_pconnect.phpt
@@ -8,65 +8,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $host = 'p:' . $host;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ $host = 'p:' . $host;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- mysqli_close($link);
+ mysqli_close($link);
- $num = 20;
- $connections = array();
- for ($i = 0; $i < $num; $i++) {
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $connections[] = $link;
- }
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
+ $num = 20;
+ $connections = array();
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $connections[] = $link;
+ }
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
- $connections = array();
- $num = 20;
- for ($i = 0; $i < $num; $i++) {
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $connections[] = $link;
- }
- $left = $num;
+ $connections = array();
+ $num = 20;
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $connections[] = $link;
+ }
+ $left = $num;
- while (count($connections) && $left > 0) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]) && $left > 0);
- if (mt_rand(0, 1) > 0) {
- $left--;
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- } else {
- $left--;
- if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- flush();
- }
+ while (count($connections) && $left > 0) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]) && $left > 0);
+ if (mt_rand(0, 1) > 0) {
+ $left--;
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ } else {
+ $left--;
+ if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ flush();
+ }
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_phpinfo.phpt b/ext/mysqli/tests/mysqli_phpinfo.phpt
index 4f856f2b65..d1ecdea796 100644
--- a/ext/mysqli/tests/mysqli_phpinfo.phpt
+++ b/ext/mysqli/tests/mysqli_phpinfo.phpt
@@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include("connect.inc");
+ include("connect.inc");
- @ob_clean();
- ob_start();
- phpinfo();
- $phpinfo = ob_get_contents();
- ob_end_clean();
+ @ob_clean();
+ ob_start();
+ phpinfo();
+ $phpinfo = ob_get_contents();
+ ob_end_clean();
- /* all versions should at least dump this minimum information */
- if (!stristr($phpinfo, "mysqli support"))
- printf("[001] ext/mysqli should have exposed itself.\n");
+ /* all versions should at least dump this minimum information */
+ if (!stristr($phpinfo, "mysqli support"))
+ printf("[001] ext/mysqli should have exposed itself.\n");
- if (!stristr($phpinfo, "client api library version"))
- printf("[002] ext/mysqli should have exposed the library version.\n");
+ if (!stristr($phpinfo, "client api library version"))
+ printf("[002] ext/mysqli should have exposed the library version.\n");
- if (!stristr($phpinfo, "mysqli.default_host"))
- printf("[003] php.ini setting mysqli.default_host not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_host"))
+ printf("[003] php.ini setting mysqli.default_host not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_port"))
- printf("[004] php.ini setting mysqli.default_port not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_port"))
+ printf("[004] php.ini setting mysqli.default_port not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_pw"))
- printf("[005] php.ini setting mysqli.default_pw not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_pw"))
+ printf("[005] php.ini setting mysqli.default_pw not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_socket"))
- printf("[006] php.ini setting mysqli.default_socket not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_socket"))
+ printf("[006] php.ini setting mysqli.default_socket not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_user"))
- printf("[007] php.ini setting mysqli.default_user not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_user"))
+ printf("[007] php.ini setting mysqli.default_user not shown.\n");
- if (!stristr($phpinfo, "mysqli.max_links"))
- printf("[008] php.ini setting mysqli.max_links not shown.\n");
+ if (!stristr($phpinfo, "mysqli.max_links"))
+ printf("[008] php.ini setting mysqli.max_links not shown.\n");
- if (!stristr($phpinfo, "mysqli.reconnect"))
- printf("[009] php.ini setting mysqli.reconnect not shown.\n");
+ if (!stristr($phpinfo, "mysqli.reconnect"))
+ printf("[009] php.ini setting mysqli.reconnect not shown.\n");
- if ($IS_MYSQLND) {
- $expected = array(
- 'size',
- 'mysqli.allow_local_infile',
- 'mysqli.allow_persistent', 'mysqli.max_persistent'
- );
- foreach ($expected as $k => $entry)
- if (!stristr($phpinfo, $entry))
- printf("[010] Could not find entry for '%s'\n", $entry);
- }
+ if ($IS_MYSQLND) {
+ $expected = array(
+ 'size',
+ 'mysqli.allow_local_infile',
+ 'mysqli.allow_persistent', 'mysqli.max_persistent'
+ );
+ foreach ($expected as $k => $entry)
+ if (!stristr($phpinfo, $entry))
+ printf("[010] Could not find entry for '%s'\n", $entry);
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt
index 6ddb29efef..9fa3ac8cae 100644
--- a/ext/mysqli/tests/mysqli_ping.phpt
+++ b/ext/mysqli/tests/mysqli_ping.phpt
@@ -8,36 +8,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_ping()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ping()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_null($tmp = @mysqli_ping($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ping($link, $link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- var_dump(mysqli_ping($link));
+ var_dump(mysqli_ping($link));
- // provoke an error to check if mysqli_ping resets it
- $res = mysqli_query($link, 'SELECT * FROM unknown_table');
- if (!($errno = mysqli_errno($link)))
- printf("[003] Statement should have caused an error\n");
+ // provoke an error to check if mysqli_ping resets it
+ $res = mysqli_query($link, 'SELECT * FROM unknown_table');
+ if (!($errno = mysqli_errno($link)))
+ printf("[003] Statement should have caused an error\n");
- var_dump(mysqli_ping($link));
- if ($errno === mysqli_errno($link))
- printf("[004] Error codes should have been reset\n");
+ var_dump(mysqli_ping($link));
+ if ($errno === mysqli_errno($link))
+ printf("[004] Error codes should have been reset\n");
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_ping($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_ping($link)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt
index 00be1c4bcb..9ffeb8b935 100644
--- a/ext/mysqli/tests/mysqli_poll.phpt
+++ b/ext/mysqli/tests/mysqli_poll.phpt
@@ -12,126 +12,126 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- if (!$link = get_connection())
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (NULL !== ($tmp = @mysqli_poll()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_poll($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n, $n)))
- printf("[005] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1)))
- printf("[007] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1)))
- printf("[008] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
- printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1))))
- printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1))))
- printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
-
- if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
- printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
- $exp_ready, $tmp);
-
- foreach ($links as $mysqli) {
- if ($use_oo_syntax) {
- $res = $mysqli->reap_async_query();
- } else {
- $res = mysqli_reap_async_query($mysqli);
- }
- if (is_object($res)) {
- printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset);
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[%03d + 3] Error indicated through links array: %d/%s",
- $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
- } else {
- printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
- }
- }
-
- foreach ($errors as $mysqli)
- printf("[%03d + 5] Error on %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- foreach ($reject as $mysqli)
- printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- }
-
- // Connections on which no query has been send - 1
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(12, $link, $links, $errors, $reject, 0, false);
- mysqli_close($link);
-
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(13, $link, $links, $errors, $reject, 0, true);
- mysqli_close($link);
-
- // Connections on which no query has been send - 2
- // Difference: pass $links twice
- $link = get_connection();
- $links = array($link, $link);
- $errors = array($link, $link);
- $reject = array();
- poll_async(14, $link, $links, $errors, $reject, 0, false);
-
- // Connections on which no query has been send - 3
- // Difference: pass two connections
- $link = get_connection();
- $links = array($link, get_connection());
- $errors = array($link, $link);
- $reject = array();
- poll_async(15, $link, $links, $errors, $reject, 0, false);
-
- // Reference mess...
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $ref_errors =& $errors;
- $reject = array();
- poll_async(16, $link, $links, $ref_errors, $reject, 0, false);
-
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ if (!$link = get_connection())
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (NULL !== ($tmp = @mysqli_poll()))
+ printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
+
+ $l = array($link);
+ if (NULL !== ($tmp = @mysqli_poll($l)))
+ printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
+
+ $l = array($link); $n = NULL;
+ if (NULL !== ($tmp = @mysqli_poll($l, $n)))
+ printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
+
+ $l = array($link); $n = NULL;
+ if (NULL !== ($tmp = @mysqli_poll($l, $n, $n)))
+ printf("[005] Expecting NULL got %s\n", var_export($tmp, true));
+
+ $l = array($link); $e = NULL; $r = NULL;
+ if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1)))
+ printf("[007] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $l = array($link); $e = NULL; $r = NULL;
+ if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1)))
+ printf("[008] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $read = $error = $reject = array($link);
+ if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
+ printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $read = $error = $reject = array($link);
+ if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1))))
+ printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $read = $error = $reject = array($link);
+ if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1))))
+ printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
+
+ if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $exp_ready, $tmp);
+
+ foreach ($links as $mysqli) {
+ if ($use_oo_syntax) {
+ $res = $mysqli->reap_async_query();
+ } else {
+ $res = mysqli_reap_async_query($mysqli);
+ }
+ if (is_object($res)) {
+ printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset);
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[%03d + 3] Error indicated through links array: %d/%s",
+ $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
+ } else {
+ printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
+ }
+ }
+
+ foreach ($errors as $mysqli)
+ printf("[%03d + 5] Error on %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ foreach ($reject as $mysqli)
+ printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ }
+
+ // Connections on which no query has been send - 1
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(12, $link, $links, $errors, $reject, 0, false);
+ mysqli_close($link);
+
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(13, $link, $links, $errors, $reject, 0, true);
+ mysqli_close($link);
+
+ // Connections on which no query has been send - 2
+ // Difference: pass $links twice
+ $link = get_connection();
+ $links = array($link, $link);
+ $errors = array($link, $link);
+ $reject = array();
+ poll_async(14, $link, $links, $errors, $reject, 0, false);
+
+ // Connections on which no query has been send - 3
+ // Difference: pass two connections
+ $link = get_connection();
+ $links = array($link, get_connection());
+ $errors = array($link, $link);
+ $reject = array();
+ poll_async(15, $link, $links, $errors, $reject, 0, false);
+
+ // Reference mess...
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $ref_errors =& $errors;
+ $reject = array();
+ poll_async(16, $link, $links, $ref_errors, $reject, 0, false);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_poll(): Negative values passed for sec and/or usec in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_poll_kill.phpt b/ext/mysqli/tests/mysqli_poll_kill.phpt
index 26dd85be01..31307e8481 100644
--- a/ext/mysqli/tests/mysqli_poll_kill.phpt
+++ b/ext/mysqli/tests/mysqli_poll_kill.phpt
@@ -12,175 +12,175 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- // Killing connection - 1
-
- $link = get_connection();
- if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- // Sleep 0.1s - the asynchronous query should have been processed after the wait period
- usleep(100000);
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
-
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
-
- // Yes, 1 - the asynchronous query should have been processed
- if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
- printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- if (!is_array($links) || empty($links))
- printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
- else
- foreach ($links as $link) {
- if (is_object($res = mysqli_reap_async_query($link))) {
- // Yes, you can fetch a result - the query has been processed
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- } else if ($link->errno > 0) {
- printf("[005] Error: %d\n", $link->errno);
- }
- }
-
- // No error!
- if (!is_array($errors) || !empty($errors))
- printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
-
- if (!is_array($reject) || !empty($reject))
- printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
-
- // Lets pass a dead connection
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1)))
- printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n",
- gettype($tmp), var_export($tmp, true));
-
- if (!empty($errors))
- printf("[009] There should be no errors but one rejected connection\n");
-
- foreach ($reject as $mysqli)
- if (mysqli_thread_id($mysqli) != $thread_id) {
- printf("[010] Rejected thread %d should have rejected thread %d\n",
- mysqli_thread_id($mysqli), $thread_id);
- }
-
- // Killing connection - 2
-
- $link = get_connection();
- if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- usleep(100000);
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
-
- // Yes, 1 - fetch OK packet of kill!
- $processed = 0;
- $begin = microtime(true);
- do {
- $links = array($link, $link);
- $errors = array($link, $link);
- $reject = array($link, $link);
- $ready = mysqli_poll($links, $errors, $reject, 1);
-
- if (!empty($errors)) {
- foreach ($errors as $mysqli) {
- printf("[012] Error on thread %d: %s/%s\n",
- mysqli_thread_id($mysqli),
- mysqli_errno($mysqli),
- mysqli_error($mysqli));
- }
- break;
- }
-
- if (FALSE === $ready) {
- printf("[013] MySQLi indicates some error\n");
- break;
- }
-
- if (!empty($reject)) {
- foreach ($reject as $mysqli) {
- printf("[014] Rejecting thread %d: %s/%s\n",
- mysqli_thread_id($mysqli),
- mysqli_errno($mysqli),
- mysqli_error($mysqli));
- }
- $processed += count($reject);
- }
-
- foreach ($links as $mysqli) {
- if (is_object($res = mysqli_reap_async_query($mysqli))) {
- printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli));
- var_dump(mysqli_fetch_assoc($res));
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli));
- }
- $processed++;
- }
-
- if ((microtime(true) - $begin) > 5) {
- printf("[016] Pulling the emergency break after 5s, something is wrong...\n");
- break;
- }
-
- } while ($processed < 2);
-
-
- // Killing connection - 3
-
- $link = get_connection();
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
- // Sleep 0.1s to ensure the KILL gets recognized
- usleep(100000);
- if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
-
- if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
- printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- if (!is_array($links) || empty($links))
- printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
- else
- foreach ($links as $link) {
- if (is_object($res = mysqli_reap_async_query($link))) {
- // No, you cannot fetch the result
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- } else if ($link->errno > 0) {
- // But you are supposed to handle the error the way its shown here!
- printf("[020] Error: %d/%s\n", $link->errno, $link->error);
- }
- }
-
- // None of these will indicate an error, check errno on the list of returned connections!
- if (!is_array($errors) || !empty($errors))
- printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
-
- if (!is_array($reject) || !empty($reject))
- printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
-
-
- mysqli_close($link);
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ // Killing connection - 1
+
+ $link = get_connection();
+ if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ // Sleep 0.1s - the asynchronous query should have been processed after the wait period
+ usleep(100000);
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+
+ // Yes, 1 - the asynchronous query should have been processed
+ if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
+ printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ if (!is_array($links) || empty($links))
+ printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
+ else
+ foreach ($links as $link) {
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // Yes, you can fetch a result - the query has been processed
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ } else if ($link->errno > 0) {
+ printf("[005] Error: %d\n", $link->errno);
+ }
+ }
+
+ // No error!
+ if (!is_array($errors) || !empty($errors))
+ printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
+
+ if (!is_array($reject) || !empty($reject))
+ printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
+
+ // Lets pass a dead connection
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1)))
+ printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n",
+ gettype($tmp), var_export($tmp, true));
+
+ if (!empty($errors))
+ printf("[009] There should be no errors but one rejected connection\n");
+
+ foreach ($reject as $mysqli)
+ if (mysqli_thread_id($mysqli) != $thread_id) {
+ printf("[010] Rejected thread %d should have rejected thread %d\n",
+ mysqli_thread_id($mysqli), $thread_id);
+ }
+
+ // Killing connection - 2
+
+ $link = get_connection();
+ if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ usleep(100000);
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+
+ // Yes, 1 - fetch OK packet of kill!
+ $processed = 0;
+ $begin = microtime(true);
+ do {
+ $links = array($link, $link);
+ $errors = array($link, $link);
+ $reject = array($link, $link);
+ $ready = mysqli_poll($links, $errors, $reject, 1);
+
+ if (!empty($errors)) {
+ foreach ($errors as $mysqli) {
+ printf("[012] Error on thread %d: %s/%s\n",
+ mysqli_thread_id($mysqli),
+ mysqli_errno($mysqli),
+ mysqli_error($mysqli));
+ }
+ break;
+ }
+
+ if (FALSE === $ready) {
+ printf("[013] MySQLi indicates some error\n");
+ break;
+ }
+
+ if (!empty($reject)) {
+ foreach ($reject as $mysqli) {
+ printf("[014] Rejecting thread %d: %s/%s\n",
+ mysqli_thread_id($mysqli),
+ mysqli_errno($mysqli),
+ mysqli_error($mysqli));
+ }
+ $processed += count($reject);
+ }
+
+ foreach ($links as $mysqli) {
+ if (is_object($res = mysqli_reap_async_query($mysqli))) {
+ printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli));
+ var_dump(mysqli_fetch_assoc($res));
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli));
+ }
+ $processed++;
+ }
+
+ if ((microtime(true) - $begin) > 5) {
+ printf("[016] Pulling the emergency break after 5s, something is wrong...\n");
+ break;
+ }
+
+ } while ($processed < 2);
+
+
+ // Killing connection - 3
+
+ $link = get_connection();
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+ // Sleep 0.1s to ensure the KILL gets recognized
+ usleep(100000);
+ if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+
+ if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
+ printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ if (!is_array($links) || empty($links))
+ printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
+ else
+ foreach ($links as $link) {
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // No, you cannot fetch the result
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ } else if ($link->errno > 0) {
+ // But you are supposed to handle the error the way its shown here!
+ printf("[020] Error: %d/%s\n", $link->errno, $link->error);
+ }
+ }
+
+ // None of these will indicate an error, check errno on the list of returned connections!
+ if (!is_array($errors) || !empty($errors))
+ printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
+
+ if (!is_array($reject) || !empty($reject))
+ printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
+
+
+ mysqli_close($link);
+ print "done!";
?>
--XFAIL--
To be fixed later. Minor issue about fetching error message from killed line
diff --git a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
index 95ddd48688..b340d1a3dd 100644
--- a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
+++ b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
@@ -12,152 +12,152 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('table.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
-
- // Note: some queries will fail! They are supposed to fail.
- $queries = array(
- 'CREATE TABLE IF NOT EXISTS bogus(id INT)',
- 'SET @a = 1',
- 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
- "INSERT INTO test(id, label) VALUES (100, 'z')",
- 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
- 'SELECT',
- 'UPDATE test SET id = 101 WHERE id > 3',
- 'UPDATE_FIX test SET id = 101 WHERE id > 3',
- 'DROP TABLE IF EXISTS bogus',
- 'DELETE FROM test WHERE id = @a',
- 'DELETE FROM test WHERE id = 1',
- );
-
- $link = get_connection();
- $have_proc = false;
- mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p");
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- $have_proc = true;
- $queries[] = "CALL p('myversion', @version)";
- }
- mysqli_close($link);
-
- $links = array();
- for ($i = 0; $i < count($queries); $i++) {
-
- $link = get_connection();
-
- if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- // WARNING KLUDGE NOTE
- // Add a tiny delay to ensure that queries get executed in a certain order
- // If your MySQL server is very slow the test may randomly fail!
- usleep(20000);
-
- $links[mysqli_thread_id($link)] = array(
- 'query' => $queries[$i],
- 'link' => $link,
- 'processed' => false,
- );
- }
-
- $saved_errors = array();
- do {
- $poll_links = $poll_errors = $poll_reject = array();
- foreach ($links as $thread_id => $link) {
- if (!$link['processed']) {
- $poll_links[] = $link['link'];
- $poll_errors[] = $link['link'];
- $poll_reject[] = $link['link'];
- }
- }
- if (0 == count($poll_links))
- break;
-
- if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000)))
- continue;
-
- if (!empty($poll_errors)) {
- die(var_dump($poll_errors));
- }
-
- if (FALSE === $num_ready) {
- die("Some mysqli indicated error");
- }
-
- foreach ($poll_links as $link) {
- $thread_id = mysqli_thread_id($link);
- $links[$thread_id]['processed'] = true;
-
- if (is_object($res = mysqli_reap_async_query($link))) {
- // result set object
- while ($row = mysqli_fetch_assoc($res)) {
- // eat up all results
- ;
- }
- mysqli_free_result($res);
- } else {
- // either there is no result (no SELECT) or there is an error
- if (mysqli_errno($link) > 0) {
- $saved_errors[$thread_id] = mysqli_errno($link);
- }
- }
- }
-
- } while (true);
-
- // Checking if all lines are still usable
- foreach ($links as $thread_id => $link) {
- if (isset($saved_errors[$thread_id])) {
+ require_once('table.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+
+ // Note: some queries will fail! They are supposed to fail.
+ $queries = array(
+ 'CREATE TABLE IF NOT EXISTS bogus(id INT)',
+ 'SET @a = 1',
+ 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
+ "INSERT INTO test(id, label) VALUES (100, 'z')",
+ 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
+ 'SELECT',
+ 'UPDATE test SET id = 101 WHERE id > 3',
+ 'UPDATE_FIX test SET id = 101 WHERE id > 3',
+ 'DROP TABLE IF EXISTS bogus',
+ 'DELETE FROM test WHERE id = @a',
+ 'DELETE FROM test WHERE id = 1',
+ );
+
+ $link = get_connection();
+ $have_proc = false;
+ mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p");
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ $have_proc = true;
+ $queries[] = "CALL p('myversion', @version)";
+ }
+ mysqli_close($link);
+
+ $links = array();
+ for ($i = 0; $i < count($queries); $i++) {
+
+ $link = get_connection();
+
+ if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ // WARNING KLUDGE NOTE
+ // Add a tiny delay to ensure that queries get executed in a certain order
+ // If your MySQL server is very slow the test may randomly fail!
+ usleep(20000);
+
+ $links[mysqli_thread_id($link)] = array(
+ 'query' => $queries[$i],
+ 'link' => $link,
+ 'processed' => false,
+ );
+ }
+
+ $saved_errors = array();
+ do {
+ $poll_links = $poll_errors = $poll_reject = array();
+ foreach ($links as $thread_id => $link) {
+ if (!$link['processed']) {
+ $poll_links[] = $link['link'];
+ $poll_errors[] = $link['link'];
+ $poll_reject[] = $link['link'];
+ }
+ }
+ if (0 == count($poll_links))
+ break;
+
+ if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000)))
+ continue;
+
+ if (!empty($poll_errors)) {
+ die(var_dump($poll_errors));
+ }
+
+ if (FALSE === $num_ready) {
+ die("Some mysqli indicated error");
+ }
+
+ foreach ($poll_links as $link) {
+ $thread_id = mysqli_thread_id($link);
+ $links[$thread_id]['processed'] = true;
+
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // result set object
+ while ($row = mysqli_fetch_assoc($res)) {
+ // eat up all results
+ ;
+ }
+ mysqli_free_result($res);
+ } else {
+ // either there is no result (no SELECT) or there is an error
+ if (mysqli_errno($link) > 0) {
+ $saved_errors[$thread_id] = mysqli_errno($link);
+ }
+ }
+ }
+
+ } while (true);
+
+ // Checking if all lines are still usable
+ foreach ($links as $thread_id => $link) {
+ if (isset($saved_errors[$thread_id])) {
printf("[003] '%s' caused %d\n",
$links[$thread_id]['query'], $saved_errors[$thread_id]);
- if ($saved_errors[$thread_id] != mysqli_errno($link['link'])) {
+ if ($saved_errors[$thread_id] != mysqli_errno($link['link'])) {
printf("[004] Error state not saved for query '%s', %d != %d\n", $link['query'],
$saved_errors[$thread_id], mysqli_errno($link['link']));
}
- }
+ }
- if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100'))
- printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
- if (!$row = mysqli_fetch_row($res))
- printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+ if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100'))
+ printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+ if (!$row = mysqli_fetch_row($res))
+ printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
- mysqli_free_result($res);
- }
+ mysqli_free_result($res);
+ }
- if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) {
- $row = mysqli_fetch_assoc($res);
- var_dump($row);
- mysqli_free_result($res);
- }
+ if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) {
+ $row = mysqli_fetch_assoc($res);
+ var_dump($row);
+ mysqli_free_result($res);
+ }
- if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) {
- $row = mysqli_fetch_assoc($res);
- if ($row['_version'] != 'myversion') {
- printf("[007] Check procedures\n");
- }
- mysqli_free_result($res);
- }
+ if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) {
+ $row = mysqli_fetch_assoc($res);
+ if ($row['_version'] != 'myversion') {
+ printf("[007] Check procedures\n");
+ }
+ mysqli_free_result($res);
+ }
- foreach ($links as $link)
- mysqli_close($link['link']);
+ foreach ($links as $link)
+ mysqli_close($link['link']);
- $link = get_connection();
- if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = get_connection();
+ if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_poll_reference.phpt b/ext/mysqli/tests/mysqli_poll_reference.phpt
index f039546221..71c84a4457 100644
--- a/ext/mysqli/tests/mysqli_poll_reference.phpt
+++ b/ext/mysqli/tests/mysqli_poll_reference.phpt
@@ -19,189 +19,189 @@ if (mysqli_get_server_version($link) < 50012)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[002] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- // The behaviour is in line with stream_select(). Be warned, be careful.
- $links = $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
-
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[003] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- $links = $errors = array($mysqli1, $mysqli2);
- $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[004] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- $links = array($mysqli1, $mysqli2);
- $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- // This is bogus code and bogus usage - OK to throw no errors!
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- $thread_id = mysqli_thread_id($mysqli2);
- printf("Connection %d should be rejected...\n", $thread_id);
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[005] The queries should have finished already\n");
- break;
- }
- $links = $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- // WARNING: Due to the reference issue none of these should ever fire!
- foreach ($reject as $link) {
- printf("Connection %d was rejected...\n", mysqli_thread_id($link));
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[002] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ // The behaviour is in line with stream_select(). Be warned, be careful.
+ $links = $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[003] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ $links = $errors = array($mysqli1, $mysqli2);
+ $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[004] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ $links = array($mysqli1, $mysqli2);
+ $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ // This is bogus code and bogus usage - OK to throw no errors!
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ $thread_id = mysqli_thread_id($mysqli2);
+ printf("Connection %d should be rejected...\n", $thread_id);
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[005] The queries should have finished already\n");
+ break;
+ }
+ $links = $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ // WARNING: Due to the reference issue none of these should ever fire!
+ foreach ($reject as $link) {
+ printf("Connection %d was rejected...\n", mysqli_thread_id($link));
if (mysqli_thread_id($link) != $thread_id) {
printf("[006] Connector %d should have been rejected. But also %d has been rejected.",
$thread_id, mysqli_thread_id($link));
}
- $processed++;
- }
- foreach ($errors as $link) {
- printf("Connection %d has an error...\n", mysqli_thread_id($link));
- $processed++;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- $processed++;
- }
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- $all = array($mysqli1, $mysqli2);
- do {
- $loops++;
- if ($loops > 10) {
- printf("[006] The queries should have finished already\n");
- break;
- }
- $links = $errors = $reject = $all;
- ob_start();
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if ($tmp != '') {
- printf("Expected error:\n%s\n", $tmp);
- break;
- }
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- $ready = mysqli_poll($links, $errors, $reject, 0, 50000);
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- print "done!";
+ $processed++;
+ }
+ foreach ($errors as $link) {
+ printf("Connection %d has an error...\n", mysqli_thread_id($link));
+ $processed++;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ $processed++;
+ }
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ $all = array($mysqli1, $mysqli2);
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[006] The queries should have finished already\n");
+ break;
+ }
+ $links = $errors = $reject = $all;
+ ob_start();
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if ($tmp != '') {
+ printf("Expected error:\n%s\n", $tmp);
+ break;
+ }
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ $ready = mysqli_poll($links, $errors, $reject, 0, 50000);
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ print "done!";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_prepare.phpt b/ext/mysqli/tests/mysqli_prepare.phpt
index 28a8f4e48b..b9893da9bb 100644
--- a/ext/mysqli/tests/mysqli_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_prepare.phpt
@@ -8,113 +8,113 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_prepare()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_prepare($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = @mysqli_prepare($link, false)))
- printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
+ if (false !== ($tmp = @mysqli_prepare($link, false)))
+ printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
- if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
- printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
+ printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
- printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
+ printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt))
- printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt))
+ printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = 2;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $id = 2;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?'))))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?'))))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = 3;
- $where = 2;
- if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $id = 3;
+ $where = 2;
+ if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $where = 3;
- if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $where = 3;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $testvar = 'testvar';
- if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $testvar = 'testvar';
+ if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)"))))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)"))))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = $testvar = null;
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- while (mysqli_stmt_fetch($stmt)) {
- if (('testvar' !== $testvar) || (1 !== $id))
- printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
- $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ $id = $testvar = null;
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ while (mysqli_stmt_fetch($stmt)) {
+ if (('testvar' !== $testvar) || (1 !== $id))
+ printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
+ $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
+ var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
+ printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
- printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
+ printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_prepare_no_object.phpt b/ext/mysqli/tests/mysqli_prepare_no_object.phpt
index 0a1d22d756..2b6a07d2ac 100644
--- a/ext/mysqli/tests/mysqli_prepare_no_object.phpt
+++ b/ext/mysqli/tests/mysqli_prepare_no_object.phpt
@@ -8,31 +8,31 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = mysqli_prepare($link, false)))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_prepare($link, false)))
+ printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_prepare($link, '')))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_prepare($link, '')))
+ printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = $mysqli->prepare(false)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (false !== ($tmp = $mysqli->prepare(false)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (false !== ($tmp = $mysqli->prepare('')))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (false !== ($tmp = $mysqli->prepare('')))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_ps_select_union.phpt b/ext/mysqli/tests/mysqli_ps_select_union.phpt
index cb5699fc1e..8467690776 100644
--- a/ext/mysqli/tests/mysqli_ps_select_union.phpt
+++ b/ext/mysqli/tests/mysqli_ps_select_union.phpt
@@ -8,248 +8,248 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
-
- // Regular (non-prepared) queries
- print "Using CAST('somestring' AS CHAR)...\n";
- if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- var_dump($row['column1']);
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[004] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /*
- Advantage mysqlnd -
- The metadata mysqlnd has available after prepare is better than
- the one made available by the MySQL Client Library (libmysql).
- "libmysql" will give wrong results and that is OK -
- http://bugs.mysql.com/bug.php?id=47483
- */
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- /* Note: bind_result before execute */
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[007] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- // Regular (non-prepared) queries
- print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n";
- if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[008] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[009] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[011] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- var_dump($column1);
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above... */
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[012] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[013] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[014] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Using integer only...\n";
- if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[015] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[016] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[017] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[018] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- var_dump($column1);
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[019] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[020] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[021] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Testing bind_param(), strings only...\n";
- $two = 'two';
- $three = 'three';
- if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
- printf("[022] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
- printf("[023] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- $data = array();
- while ($stmt->fetch()) {
- $data[$index++] = $column1;
- var_dump($column1);
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- $two = 'two';
- $three = 'three';
- if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
- printf("[024] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
- printf("[025] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[26] Row %d, expecting %s/%s, got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Testing bind_param(), strings only, with CAST AS CHAR...\n";
- $two = 'two';
- $three = 'three beers are more than enough';
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
- printf("[027] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
- printf("[028] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- $data = array();
- while ($stmt->fetch()) {
- $data[$index++] = $column1;
- var_dump($column1);
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- $two = 'two';
- $three = 'three beers are more than enough';
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
- printf("[029] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
- printf("[030] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[31] Row %d, expecting %s/%s, got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- $link->close();
-
- print "done!";
+ require_once("connect.inc");
+ require_once("table.inc");
+
+ // Regular (non-prepared) queries
+ print "Using CAST('somestring' AS CHAR)...\n";
+ if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ var_dump($row['column1']);
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[004] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /*
+ Advantage mysqlnd -
+ The metadata mysqlnd has available after prepare is better than
+ the one made available by the MySQL Client Library (libmysql).
+ "libmysql" will give wrong results and that is OK -
+ http://bugs.mysql.com/bug.php?id=47483
+ */
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ /* Note: bind_result before execute */
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[007] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ // Regular (non-prepared) queries
+ print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n";
+ if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[008] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[009] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[011] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ var_dump($column1);
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above... */
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[013] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[014] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Using integer only...\n";
+ if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[015] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[016] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[017] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[018] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ var_dump($column1);
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[019] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[020] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[021] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Testing bind_param(), strings only...\n";
+ $two = 'two';
+ $three = 'three';
+ if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
+ printf("[022] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[023] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ $data = array();
+ while ($stmt->fetch()) {
+ $data[$index++] = $column1;
+ var_dump($column1);
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ $two = 'two';
+ $three = 'three';
+ if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
+ printf("[024] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[025] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[26] Row %d, expecting %s/%s, got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Testing bind_param(), strings only, with CAST AS CHAR...\n";
+ $two = 'two';
+ $three = 'three beers are more than enough';
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
+ printf("[027] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[028] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ $data = array();
+ while ($stmt->fetch()) {
+ $data[$index++] = $column1;
+ var_dump($column1);
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ $two = 'two';
+ $three = 'three beers are more than enough';
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
+ printf("[029] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[030] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[31] Row %d, expecting %s/%s, got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ $link->close();
+
+ print "done!";
?>
--EXPECT--
Using CAST('somestring' AS CHAR)...
diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt
index d35ac3dae9..3477268b6d 100644
--- a/ext/mysqli/tests/mysqli_query.phpt
+++ b/ext/mysqli/tests/mysqli_query.phpt
@@ -8,104 +8,104 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_query()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_query($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = @mysqli_query($link, '')))
- printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_query($link, '')))
+ printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 'a' AS ''"))
- printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT 'a' AS ''"))
+ printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp = mysqli_fetch_assoc($res));
- var_dump($tmp[""]);
- mysqli_free_result($res);
+ var_dump($tmp = mysqli_fetch_assoc($res));
+ var_dump($tmp[""]);
+ mysqli_free_result($res);
- if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES')))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES')))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
- if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- $res = mysqli_query($link, 'CALL p(@version)');
- $res = mysqli_query($link, 'SELECT @version AS p_version');
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
+ if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ $res = mysqli_query($link, 'CALL p(@version)');
+ $res = mysqli_query($link, 'SELECT @version AS p_version');
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_query($link, 'DROP FUNCTION IF EXISTS f');
- if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) {
- $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version');
+ mysqli_query($link, 'DROP FUNCTION IF EXISTS f');
+ if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) {
+ $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version');
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234)))
- printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n",
- gettype($res), (is_object($res)) ? 'object' : $res,
- mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234)))
+ printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n",
+ gettype($res), (is_object($res)) ? 'object' : $res,
+ mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_query_iterators.phpt b/ext/mysqli/tests/mysqli_query_iterators.phpt
index 23021ee215..a4ffbf2761 100644
--- a/ext/mysqli/tests/mysqli_query_iterators.phpt
+++ b/ext/mysqli/tests/mysqli_query_iterators.phpt
@@ -8,60 +8,60 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- echo "--- Testing default ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id")))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- foreach ($res as $row) {
- var_dump($row);
- }
- }
- echo "--- Testing USE_RESULT ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- }
+ echo "--- Testing default ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id")))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ }
+ echo "--- Testing USE_RESULT ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ }
- echo "--- Testing STORE_RESULT ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- }
+ echo "--- Testing STORE_RESULT ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ }
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_query_stored_proc.phpt b/ext/mysqli/tests/mysqli_query_stored_proc.phpt
index 1f7e88f754..566dc9dc27 100644
--- a/ext/mysqli/tests/mysqli_query_stored_proc.phpt
+++ b/ext/mysqli/tests/mysqli_query_stored_proc.phpt
@@ -14,141 +14,141 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC;
+ if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC;
END;')) {
- /* stored proc which returns one result set */
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_use_result($link)) {
- // skip results, don't fetch all from server
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- while (mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- } else {
- printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) {
- /* stored proc which returns two result sets */
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- } else {
- printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- /* no result set, just output parameter */
- if (!mysqli_query($link, 'CALL p(@version)'))
- printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "SET @version = 'unknown'"))
- printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'CALL p(@version)'))
- printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
- printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res) ||
- $row['_vers'] == 'unknown')
- printf("[015] Results seem wrong, got %s, [%d] %s\n",
- $row['_vers'],
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- } else {
- printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- /* no result set, one input, one output parameter */
- if (!mysqli_query($link, "CALL p('myversion', @version)"))
- printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "SET @version = 'unknown'"))
- printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "CALL p('myversion', @version)"))
- printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
- printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res) ||
- $row['_vers'] == 'myversion')
- printf("[022] Results seem wrong, got %s, [%d] %s\n",
- $row['_vers'],
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- } else {
- printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_close($link);
- print "done!";
+ /* stored proc which returns one result set */
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_use_result($link)) {
+ // skip results, don't fetch all from server
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ while (mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ } else {
+ printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) {
+ /* stored proc which returns two result sets */
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ } else {
+ printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ /* no result set, just output parameter */
+ if (!mysqli_query($link, 'CALL p(@version)'))
+ printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET @version = 'unknown'"))
+ printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'CALL p(@version)'))
+ printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
+ printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res) ||
+ $row['_vers'] == 'unknown')
+ printf("[015] Results seem wrong, got %s, [%d] %s\n",
+ $row['_vers'],
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ } else {
+ printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ /* no result set, one input, one output parameter */
+ if (!mysqli_query($link, "CALL p('myversion', @version)"))
+ printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET @version = 'unknown'"))
+ printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CALL p('myversion', @version)"))
+ printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
+ printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res) ||
+ $row['_vers'] == 'myversion')
+ printf("[022] Results seem wrong, got %s, [%d] %s\n",
+ $row['_vers'],
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ } else {
+ printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt
index ec7846b77d..e7ca2dee0a 100644
--- a/ext/mysqli/tests/mysqli_query_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_query_unicode.phpt
@@ -14,83 +14,83 @@ mysqli_close($link);
?>
--FILE--
<?php
- include_once("connect.inc");
+ include_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_query()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_query($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require_once('table.inc');
+ require_once('table.inc');
- if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8")))
- printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp);
+ if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8")))
+ printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS колона", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS колона", MYSQLI_USE_RESULT, "foo")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES")))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES")))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка');
- if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) {
- $res = mysqli_query($link, 'CALL процедурка(@version)');
- $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ');
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка');
+ if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) {
+ $res = mysqli_query($link, 'CALL процедурка(@version)');
+ $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ');
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка');
- if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) {
- $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ');
+ mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка');
+ if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) {
+ $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ');
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
+ printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt
index 1b0d26e7a3..922c3c9f56 100644
--- a/ext/mysqli/tests/mysqli_real_connect.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect.phpt
@@ -174,7 +174,7 @@ mysqli.allow_local_infile=1
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
Warning: mysqli_real_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
index 4c1bfc58fa..e36d5bac98 100644
--- a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
@@ -149,7 +149,7 @@ mysqli.max_persistent=10
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
Warning: mysqli_real_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt
index 05588cac63..a5c8b06ef5 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt
@@ -8,50 +8,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_real_escape_string()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
+ if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
+ printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- /* Make sure that the function alias exists */
- if (NULL !== ($tmp = @mysqli_escape_string()))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Make sure that the function alias exists */
+ if (NULL !== ($tmp = @mysqli_escape_string()))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
index 71707510d1..c92029d417 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
@@ -18,57 +18,57 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=big5")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "big5"));
+ var_dump(mysqli_set_charset($link, "big5"));
- if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
+ if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
'§ä¨ì¥H¤U¤º®e\\§ä¨ì¥H¤U¤º®e')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
+ if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
'§ä¨ì¥H¤U¤º®e"§ä¨ì¥H¤U¤º®e')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e'§ä¨ì¥H¤U¤º®e")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e\n§ä¨ì¥H¤U¤º®e")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e\r§ä¨ì¥H¤U¤º®e")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e"
+ if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e"
. chr(0) . "§ä¨ì¥H¤U¤º®e")))
- printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp);
+ printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100,
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100,
'§ä')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
index a93405e862..d3fc3eca9a 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
@@ -20,48 +20,48 @@ mysqli_close($link);
<?php
require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=eucjpms")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "eucjpms"));
+ var_dump(mysqli_set_charset($link, "eucjpms"));
- if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
index 97c6161b25..87e6627504 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
@@ -18,49 +18,49 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=euckr")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "euckr"));
+ var_dump(mysqli_set_charset($link, "euckr"));
- if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º")))
- printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp);
+ if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º")))
+ printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
index 2b46fa6f8c..bc1a57baa2 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
@@ -19,49 +19,49 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gb2312")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "gb2312"));
+ var_dump(mysqli_set_charset($link, "gb2312"));
- if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ")))
- printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp);
+ if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ")))
+ printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
index 510621aea8..63e77d80f0 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
@@ -19,49 +19,49 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "gbk"));
+ var_dump(mysqli_set_charset($link, "gbk"));
- if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾")))
- printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp);
+ if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾")))
+ printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
index d4e43243fa..b8e48ccf8f 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
@@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"'))
- printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"'))
+ printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[002] Expecting \\, got %s\n", $tmp);
+ if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[002] Expecting \\, got %s\n", $tmp);
- if ('"' !== ($tmp = mysqli_real_escape_string($link, '"')))
- printf("[003] Expecting \", got %s\n", $tmp);
+ if ('"' !== ($tmp = mysqli_real_escape_string($link, '"')))
+ printf("[003] Expecting \", got %s\n", $tmp);
- if ("''" !== ($tmp = mysqli_real_escape_string($link, "'")))
- printf("[004] Expecting '', got %s\n", $tmp);
+ if ("''" !== ($tmp = mysqli_real_escape_string($link, "'")))
+ printf("[004] Expecting '', got %s\n", $tmp);
- if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
- printf("[005] Expecting \\n, got %s\n", $tmp);
+ if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
+ printf("[005] Expecting \\n, got %s\n", $tmp);
- if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
- printf("[006] Expecting \\r, got %s\n", $tmp);
+ if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
+ printf("[006] Expecting \\r, got %s\n", $tmp);
- assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar");
- if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
+ assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar");
+ if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
- if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")',
- mysqli_real_escape_string($link, "\\"))))
- printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")',
+ mysqli_real_escape_string($link, "\\"))))
+ printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'SET @@sql_mode=""'))
- printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @@sql_mode=""'))
+ printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[012] Expecting \\, got %s\n", $tmp);
+ if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[012] Expecting \\, got %s\n", $tmp);
- if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
+ if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
index 4ab50b8311..0d5136622f 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
@@ -18,33 +18,33 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- var_dump(mysqli_set_charset($link, "sjis"));
+ var_dump(mysqli_set_charset($link, "sjis"));
- if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??")))
- printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp);
+ if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??")))
+ printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
index be21cae80b..ff996ff2b3 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
@@ -8,76 +8,76 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_real_escape_string()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "фуу", "бар")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp =@mysqli_real_escape_string($link, "фуу", "бар")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар')))
- printf("[004] Expecting фу\\\\бар, got %s\n", $tmp);
+ if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар')))
+ printf("[004] Expecting фу\\\\бар, got %s\n", $tmp);
- if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ')))
- printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp);
+ if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ')))
+ printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp);
- if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали")))
- printf("[006] Expecting лала'лали, got %s\n", $tmp);
+ if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали")))
+ printf("[006] Expecting лала'лали, got %s\n", $tmp);
- if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра")))
- printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp);
+ if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра")))
+ printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp);
- if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху")))
- printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp);
+ if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху")))
+ printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp);
- if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !==
- ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м")))
- {
- printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
- }
+ if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !==
+ ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м")))
+ {
+ printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
+ }
- if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§')))
- printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp);
+ if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§')))
+ printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp);
- if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš')))
- printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp);
+ if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš')))
+ printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp);
- if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图")))
- printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp);
+ if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图")))
+ printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp);
- if ("阿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\nè½»")))
- printf("[014] Expecting 阿åœæ‹‰\\nè½», got %s\n", $tmp);
+ if ("阿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\nè½»")))
+ printf("[014] Expecting 阿åœæ‹‰\\nè½», got %s\n", $tmp);
- if ("张明安\\r在" !== ($tmp = mysqli_real_escape_string($link, "张明安\r在")))
- printf("[015] Expecting 张明安\\r在, got %s\n", $tmp);
+ if ("张明安\\r在" !== ($tmp = mysqli_real_escape_string($link, "张明安\r在")))
+ printf("[015] Expecting 张明安\\r在, got %s\n", $tmp);
- if ("竺å¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "竺å¯æ¡¢" . chr(0) . "空调器")))
- printf("[016] Expecting %s, got %s\n", "竺å¯æ¡¢\\0空调器", $tmp);
+ if ("竺å¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "竺å¯æ¡¢" . chr(0) . "空调器")))
+ printf("[016] Expecting %s, got %s\n", "竺å¯æ¡¢\\0空调器", $tmp);
- if (($exp='阿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !==
- ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³")))
- {
- printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
- }
+ if (($exp='阿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !==
+ ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³")))
+ {
+ printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt
index a8deec7833..2fb9ee2bc0 100644
--- a/ext/mysqli/tests/mysqli_real_query.phpt
+++ b/ext/mysqli/tests/mysqli_real_query.phpt
@@ -7,87 +7,87 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_real_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_real_query()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_real_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_real_query($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (NULL !== ($tmp = @mysqli_real_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_real_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($res = mysqli_use_result($link)))
- printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES")))
- printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res,
- mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES")))
+ printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res,
+ mysqli_errno($link), mysqli_error($link));
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param;
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param;
END;')) {
- mysqli_real_query($link, 'CALL p(@version)');
- mysqli_real_query($link, 'SELECT @version AS p_version');
- $res = mysqli_store_result($link);
-
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
-
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f');
- if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN
+ mysqli_real_query($link, 'CALL p(@version)');
+ mysqli_real_query($link, 'SELECT @version AS p_version');
+ $res = mysqli_store_result($link);
+
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f');
+ if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN
ver_param;')) {
- mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version');
- $res = mysqli_store_result($link);
+ mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version');
+ $res = mysqli_store_result($link);
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_real_query($link, "SELECT id FROM test")))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_query($link, "SELECT id FROM test")))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt
index 63afa87654..665e46305f 100644
--- a/ext/mysqli/tests/mysqli_reap_async_query.phpt
+++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt
@@ -12,80 +12,80 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- if (!$link = get_connection())
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (NULL !== ($tmp = @mysqli_reap_async_query()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_reap_async_query($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- if (NULL !== ($tmp = @mysqli_reap_async_query($link, $link)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
-
- function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
-
- if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000)))
- printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
- $offset, $exp_ready, $tmp);
-
- foreach ($links as $mysqli) {
- if ($use_oo_syntax) {
- $res = $mysqli->reap_async_query();
- } else {
- $res = mysqli_reap_async_query($mysqli);
- }
- if (is_object($res)) {
- printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[%03d + 3] Error indicated through links array: %d/%s",
- $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
- } else {
- printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
- }
- }
-
- foreach ($errors as $mysqli)
- printf("[%03d + 5] Error on %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- foreach ($reject as $mysqli)
- printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- }
-
- // Connections on which no query has been send - 1
- $link = get_connection();
- $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT);
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(12, $link, $links, $errors, $reject, 1, false);
- mysqli_close($link);
-
- $link = get_connection();
- $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT);
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(13, $link, $links, $errors, $reject, 1, true);
- mysqli_close($link);
-
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ if (!$link = get_connection())
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (NULL !== ($tmp = @mysqli_reap_async_query()))
+ printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
+
+ $l = array($link);
+ if (NULL !== ($tmp = @mysqli_reap_async_query($l)))
+ printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
+
+ if (NULL !== ($tmp = @mysqli_reap_async_query($link, $link)))
+ printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
+
+
+ function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
+
+ if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $offset, $exp_ready, $tmp);
+
+ foreach ($links as $mysqli) {
+ if ($use_oo_syntax) {
+ $res = $mysqli->reap_async_query();
+ } else {
+ $res = mysqli_reap_async_query($mysqli);
+ }
+ if (is_object($res)) {
+ printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[%03d + 3] Error indicated through links array: %d/%s",
+ $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
+ } else {
+ printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
+ }
+ }
+
+ foreach ($errors as $mysqli)
+ printf("[%03d + 5] Error on %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ foreach ($reject as $mysqli)
+ printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ }
+
+ // Connections on which no query has been send - 1
+ $link = get_connection();
+ $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT);
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(12, $link, $links, $errors, $reject, 1, false);
+ mysqli_close($link);
+
+ $link = get_connection();
+ $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT);
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(13, $link, $links, $errors, $reject, 1, true);
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECT--
[012 + 2] array (
diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt
index af2f5740a1..75e99e7f7b 100644
--- a/ext/mysqli/tests/mysqli_release_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt
@@ -15,61 +15,61 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_release_savepoint(object link, string name) */
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_release_savepoint(object link, string name) */
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_release_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_release_savepoint()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_release_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_release_savepoint($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $name = array();
- if (!is_null($tmp = @mysqli_release_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $name = array();
+ if (!is_null($tmp = @mysqli_release_savepoint($link, $name)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_release_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_release_savepoint($link, 'foo', $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_release_savepoint($link, '')))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_release_savepoint($link, '')))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- /* note that there is no savepoint my... */
- if (false !== ($tmp = mysqli_release_savepoint($link, 'my')))
- printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+ /* note that there is no savepoint my... */
+ if (false !== ($tmp = mysqli_release_savepoint($link, 'my')))
+ printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_commit($link);
- if ($tmp !== true)
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_commit($link);
+ if ($tmp !== true)
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_savepoint($link, 'my')))
- printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_savepoint($link, 'my')))
+ printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- $res = mysqli_query($link, "SELECT * FROM test");
- var_dump($res->fetch_assoc());
+ $res = mysqli_query($link, "SELECT * FROM test");
+ var_dump($res->fetch_assoc());
- if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
- printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
+ printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_report_new.phpt b/ext/mysqli/tests/mysqli_report_new.phpt
index 2b8a22fc4b..de3b84d685 100644
--- a/ext/mysqli/tests/mysqli_report_new.phpt
+++ b/ext/mysqli/tests/mysqli_report_new.phpt
@@ -16,29 +16,29 @@ if (mysqli_get_server_version($link) < 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- /*
- Internal macro MYSQL_REPORT_ERROR
- */
- mysqli_report(MYSQLI_REPORT_ERROR);
+ /*
+ Internal macro MYSQL_REPORT_ERROR
+ */
+ mysqli_report(MYSQLI_REPORT_ERROR);
- mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
+ mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
- mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_OFF);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_report_wo_ps.phpt b/ext/mysqli/tests/mysqli_report_wo_ps.phpt
index 9cd9254d73..2c54f9887e 100644
--- a/ext/mysqli/tests/mysqli_report_wo_ps.phpt
+++ b/ext/mysqli/tests/mysqli_report_wo_ps.phpt
@@ -15,86 +15,86 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (true !== ($tmp = mysqli_report(-1)))
- printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(-1)))
+ printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
- printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
+ printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
- printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
+ printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
- printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
+ printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- /*
- Internal macro MYSQL_REPORT_ERROR
- */
- mysqli_report(MYSQLI_REPORT_ERROR);
+ /*
+ Internal macro MYSQL_REPORT_ERROR
+ */
+ mysqli_report(MYSQLI_REPORT_ERROR);
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
- mysqli_kill($link, -1);
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
+ mysqli_kill($link, -1);
- // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
- mysqli_real_query($link, "FOO");
- if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
- printf("[009] select_db should have failed\n");
- // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
+ // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
+ mysqli_real_query($link, "FOO");
+ if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
+ printf("[009] select_db should have failed\n");
+ // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
- // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
- // not have been set. If that would be the case, the test would be broken.
- mysqli_report(MYSQLI_REPORT_OFF);
+ // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
+ // not have been set. If that would be the case, the test would be broken.
+ mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
- mysqli_kill($link, -1);
- mysqli_real_query($link, "FOO");
- mysqli_select_db($link, "Oh lord, let this be an unknown database name");
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
+ mysqli_kill($link, -1);
+ mysqli_real_query($link, "FOO");
+ mysqli_select_db($link, "Oh lord, let this be an unknown database name");
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
- try {
+ try {
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("[011] %s\n", $e->getMessage());
- }
+ } catch (mysqli_sql_exception $e) {
+ printf("[011] %s\n", $e->getMessage());
+ }
- try {
- if (!$link = mysqli_init())
- printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ try {
+ if (!$link = mysqli_init())
+ printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("[014] %s\n", $e->getMessage());
- }
+ if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("[014] %s\n", $e->getMessage());
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
index 7649973f9a..94dde8f720 100644
--- a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
+++ b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
+ require('connect.inc');
+ require('table.inc');
- $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
- do {
- $mode = mt_rand(-1000, 1000);
- } while (in_array($mode, $valid));
+ $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
+ do {
+ $mode = mt_rand(-1000, 1000);
+ } while (in_array($mode, $valid));
- if (!is_object($res = new mysqli_result($link, $mode)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = new mysqli_result($link, $mode)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt
index dce3930fe5..a538bfa400 100644
--- a/ext/mysqli/tests/mysqli_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_result_references.phpt
@@ -8,73 +8,73 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- $references = array();
+ $references = array();
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_store_result($link)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_store_result($link)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $idx = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies */
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx++]['id'] += 0;
- }
+ $idx = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies */
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx++]['id'] += 0;
+ }
- mysqli_close($link);
+ mysqli_close($link);
- mysqli_data_seek($res, 0);
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies */
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx++]['id'] += 0;
- }
+ mysqli_data_seek($res, 0);
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies */
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx++]['id'] += 0;
+ }
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_use_result($link)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies*/
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx]['id2'] = &$references[$idx]['id'];
- $references[$idx]['id'] += 1;
- $references[$idx++]['id2'] += 1;
- }
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies*/
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx]['id2'] = &$references[$idx]['id'];
+ $references[$idx]['id'] += 1;
+ $references[$idx++]['id2'] += 1;
+ }
- $references[$idx++] = &$res;
- mysqli_free_result($res);
- debug_zval_dump($references);
+ $references[$idx++] = &$res;
+ mysqli_free_result($res);
+ debug_zval_dump($references);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
- !($res = mysqli_use_result($link)))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = array();
- while ($row = mysqli_fetch_assoc($res)) {
- $tmp[] = $row;
- }
- $tmp = unserialize(serialize($tmp));
- debug_zval_dump($tmp);
- mysqli_free_result($res);
+ $tmp = array();
+ while ($row = mysqli_fetch_assoc($res)) {
+ $tmp[] = $row;
+ }
+ $tmp = unserialize(serialize($tmp));
+ debug_zval_dump($tmp);
+ mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
index 85a3699175..36b3879c66 100644
--- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
@@ -12,45 +12,45 @@ if (!$IS_MYSQLND)
require_once('skipifemb.inc'); ?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- $references = array();
+ $references = array();
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
- !($res = mysqli_store_result($link)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
+ !($res = mysqli_store_result($link)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $idx = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* will overwrite itself */
- $references[$idx]['row_ref'] = &$row;
- $references[$idx]['row_copy'] = $row;
- $references[$idx]['id_ref'] = &$row['id'];
- $references[$idx++]['id_copy'] = $row['id'];
- }
+ $idx = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* will overwrite itself */
+ $references[$idx]['row_ref'] = &$row;
+ $references[$idx]['row_copy'] = $row;
+ $references[$idx]['id_ref'] = &$row['id'];
+ $references[$idx++]['id_copy'] = $row['id'];
+ }
- debug_zval_dump($references);
- mysqli_free_result($res);
+ debug_zval_dump($references);
+ mysqli_free_result($res);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_use_result($link)))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rows = array();
- for ($i = 0; $i < 2; $i++) {
- $rows[$i] = mysqli_fetch_assoc($res);
- $references[$idx]['row_ref'] = &$rows[$i];
- $references[$idx]['row_copy'] = $rows[$i];
- $references[$idx]['id_ref'] = &$rows[$i]['id'];
- $references[$idx]['id_copy'] = $rows[$i]['id'];
- /* enforce separation */
- $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
- }
- mysqli_free_result($res);
+ $rows = array();
+ for ($i = 0; $i < 2; $i++) {
+ $rows[$i] = mysqli_fetch_assoc($res);
+ $references[$idx]['row_ref'] = &$rows[$i];
+ $references[$idx]['row_copy'] = $rows[$i];
+ $references[$idx]['id_ref'] = &$rows[$i]['id'];
+ $references[$idx]['id_copy'] = $rows[$i]['id'];
+ /* enforce separation */
+ $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
+ }
+ mysqli_free_result($res);
- debug_zval_dump($references);
- print "done!";
+ debug_zval_dump($references);
+ print "done!";
?>
--EXPECTF--
array(1) refcount(%d){
diff --git a/ext/mysqli/tests/mysqli_result_unclonable.phpt b/ext/mysqli/tests/mysqli_result_unclonable.phpt
index 6eff412a1d..06f7d5899d 100644
--- a/ext/mysqli/tests/mysqli_result_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_result_unclonable.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] 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_query($link, "SELECT 'good' AS morning")))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'good' AS morning")))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $res_clone = clone $res;
- print "done!";
+ $res_clone = clone $res;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_result in %s:%d
diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt
index c1db61830a..485c1448d5 100644
--- a/ext/mysqli/tests/mysqli_rollback.phpt
+++ b/ext/mysqli/tests/mysqli_rollback.phpt
@@ -15,56 +15,56 @@ mysqli_rollback()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_rollback()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_rollback()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_rollback($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_rollback($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_rollback($link, 'foo')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_rollback($link, 'foo')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (0 != $tmp['num'])
- printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (0 != $tmp['num'])
+ printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_rollback($link)))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_rollback($link)))
+ printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!\n";
+ print "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt
index edf8d48601..29c939cb76 100644
--- a/ext/mysqli/tests/mysqli_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_savepoint.phpt
@@ -15,52 +15,52 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_savepoint(object link, string name) */
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_savepoint(object link, string name) */
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_savepoint()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_savepoint($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $name = array();
- if (!is_null($tmp = @mysqli_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $name = array();
+ if (!is_null($tmp = @mysqli_savepoint($link, $name)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_savepoint($link, 'foo', $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_savepoint($link, '')))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_savepoint($link, '')))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- /* overrule autocommit */
- if (true !== ($tmp = mysqli_savepoint($link, 'my')))
- printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+ /* overrule autocommit */
+ if (true !== ($tmp = mysqli_savepoint($link, 'my')))
+ printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt
index 041b7fbb22..b148a0ee05 100644
--- a/ext/mysqli/tests/mysqli_select_db.phpt
+++ b/ext/mysqli/tests/mysqli_select_db.phpt
@@ -8,102 +8,102 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
+ require_once("connect.inc");
+ require_once("table.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_select_db()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_select_db()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_select_db($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_select_db($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_select_db($link, $db, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_select_db($link, $db, "foo")))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- /* does not make too much sense, unless we have access to at least one more database than $db */
- if (!mysqli_select_db($link, $db))
- printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link));
+ /* does not make too much sense, unless we have access to at least one more database than $db */
+ if (!mysqli_select_db($link, $db))
+ printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['dbname'] !== (string)$db)
- printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']);
- mysqli_free_result($res);
+ if ($row['dbname'] !== (string)$db)
+ printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']);
+ mysqli_free_result($res);
- if (mysqli_select_db($link, 'mysql')) {
- // Yippie, a second database to play with - that's great because mysqli_select_db
- // ($db) was done by mysqli__connect() already and the previous test
- // was quite useless
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_select_db($link, 'mysql')) {
+ // Yippie, a second database to play with - that's great because mysqli_select_db
+ // ($db) was done by mysqli__connect() already and the previous test
+ // was quite useless
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (strtolower($row['dbname']) !== 'mysql')
- printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']);
- mysqli_free_result($res);
- }
+ if (strtolower($row['dbname']) !== 'mysql')
+ printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']);
+ mysqli_free_result($res);
+ }
- if (!$link->select_db($db))
- printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error);
+ if (!$link->select_db($db))
+ printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error);
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $current_db = $row['dbname'];
+ $current_db = $row['dbname'];
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_select_db($link, 'I can not imagine that this database exists');
- mysqli_report(MYSQLI_REPORT_ERROR);
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_select_db($link, 'I can not imagine that this database exists');
+ mysqli_report(MYSQLI_REPORT_ERROR);
- ob_start();
- mysqli_select_db($link, 'I can not imagine that this database exists');
- $output = ob_get_contents();
- ob_end_clean();
- if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) {
- /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */
- /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */
- /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */
- echo $output;
- }
+ ob_start();
+ mysqli_select_db($link, 'I can not imagine that this database exists');
+ $output = ob_get_contents();
+ ob_end_clean();
+ if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) {
+ /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */
+ /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */
+ /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */
+ echo $output;
+ }
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (strtolower($row['dbname']) != strtolower($current_db))
- printf("[017] Current DB should not change if set fails\n");
+ if (strtolower($row['dbname']) != strtolower($current_db))
+ printf("[017] Current DB should not change if set fails\n");
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[018] [%d] %s\n");
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[018] [%d] %s\n");
- $row = $res->fetch_assoc();
- $res->free();
+ $row = $res->fetch_assoc();
+ $res->free();
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_select_db($link, $db)))
- printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_select_db($link, $db)))
+ printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!\n";
+ print "done!\n";
?>
--CLEAN--
<?php require_once("clean_table.inc"); ?>
diff --git a/ext/mysqli/tests/mysqli_send_query.phpt b/ext/mysqli/tests/mysqli_send_query.phpt
index f03125bd2f..e88696bc4a 100644
--- a/ext/mysqli/tests/mysqli_send_query.phpt
+++ b/ext/mysqli/tests/mysqli_send_query.phpt
@@ -14,36 +14,36 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
- require_once("connect.inc");
+ /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_send_query()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_send_query()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_send_query($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_send_query($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- $query = array();
- if (NULL !== ($tmp = @mysqli_send_query($link, $query)))
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $query = array();
+ if (NULL !== ($tmp = @mysqli_send_query($link, $query)))
+ printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1')))
- printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1')))
+ printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = mysqli_send_query($link, 'SELECT 1')))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_send_query($link, 'SELECT 1')))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_send_query(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt
index b213d8e05a..0f31c7e827 100644
--- a/ext/mysqli/tests/mysqli_set_charset.phpt
+++ b/ext/mysqli/tests/mysqli_set_charset.phpt
@@ -46,80 +46,80 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_set_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_charset()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_set_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_charset($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_charset($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$character_set_connection = $tmp['charset'])
- printf("[008] Cannot determine current character set and collation\n");
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$character_set_connection = $tmp['charset'])
+ printf("[008] Cannot determine current character set and collation\n");
- $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1';
- if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1';
+ if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_num_rows($res) == 0)
- printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset);
+ if (mysqli_num_rows($res) == 0)
+ printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset);
- if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set")))
- printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret);
+ if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set")))
+ printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret);
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (true !== ($ret = mysqli_set_charset($link, $new_charset)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if ($new_charset !== $tmp['charset'])
- printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']);
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
- printf("[016] Cannot get list of character sets\n");
-
- while ($tmp = mysqli_fetch_assoc($res)) {
- if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset'])
- continue;
-
- /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
- if (!@mysqli_set_charset($link, $tmp['Charset'])) {
- printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'],
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
- if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset']))))
- printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link));
- }
- mysqli_free_result($res);
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (true !== ($ret = mysqli_set_charset($link, $new_charset)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if ($new_charset !== $tmp['charset'])
+ printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']);
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
+ printf("[016] Cannot get list of character sets\n");
+
+ while ($tmp = mysqli_fetch_assoc($res)) {
+ if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset'])
+ continue;
+
+ /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
+ if (!@mysqli_set_charset($link, $tmp['Charset'])) {
+ printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'],
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
+ if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset']))))
+ printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link));
+ }
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_set_charset($link, $new_charset)))
- printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_set_charset($link, $new_charset)))
+ printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt
index 757b8490b7..513b145784 100644
--- a/ext/mysqli/tests/mysqli_set_opt.phpt
+++ b/ext/mysqli/tests/mysqli_set_opt.phpt
@@ -8,47 +8,47 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_set_opt()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_opt()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_set_opt($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_opt($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $link = mysqli_init();
+ $link = mysqli_init();
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
- var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
- var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));
+ // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+ var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+ var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
+ var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
- print "done!";
+ print "done!";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt
index bb2a9201b8..b56f78778e 100644
--- a/ext/mysqli/tests/mysqli_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_sqlstate.phpt
@@ -8,32 +8,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_sqlstate()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_sqlstate($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- var_dump(@mysqli_sqlstate($link, "foo"));
+ var_dump(@mysqli_sqlstate($link, "foo"));
- var_dump(mysqli_sqlstate($link));
- mysqli_query($link, "SELECT unknown_column FROM test");
- var_dump(mysqli_sqlstate($link));
- mysqli_free_result(mysqli_query($link, "SELECT id FROM test"));
- var_dump(mysqli_sqlstate($link));
+ var_dump(mysqli_sqlstate($link));
+ mysqli_query($link, "SELECT unknown_column FROM test");
+ var_dump(mysqli_sqlstate($link));
+ mysqli_free_result(mysqli_query($link, "SELECT id FROM test"));
+ var_dump(mysqli_sqlstate($link));
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_sqlstate($link));
+ var_dump(mysqli_sqlstate($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_ssl_set.phpt b/ext/mysqli/tests/mysqli_ssl_set.phpt
index 17274cc430..36363634ad 100644
--- a/ext/mysqli/tests/mysqli_ssl_set.phpt
+++ b/ext/mysqli/tests/mysqli_ssl_set.phpt
@@ -10,52 +10,52 @@ if (!function_exists('mysqli_ssl_set'))
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_ssl_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link, $link)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- /*
- This function always returns TRUE value.
+ /*
+ This function always returns TRUE value.
- $link = mysqli_init();
- if (NULL !== ($tmp = @mysqli_ssl_set(
- $link,
- 'The path name to the key file.',
- 'The path name to the certificate file.',
- 'The path name to the certificate authority file.',
- 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.',
- 'A list of allowable ciphers to use for SSL encryption.')))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $link = mysqli_init();
+ if (NULL !== ($tmp = @mysqli_ssl_set(
+ $link,
+ 'The path name to the key file.',
+ 'The path name to the certificate file.',
+ 'The path name to the certificate authority file.',
+ 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.',
+ 'A list of allowable ciphers to use for SSL encryption.')))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- If SSL setup is incorrect my_mysqli_real_connect()
- will return an error when you attempt to connect.
+ If SSL setup is incorrect my_mysqli_real_connect()
+ will return an error when you attempt to connect.
- ... and the above SSL setup should be always incorrect.
+ ... and the above SSL setup should be always incorrect.
- if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- */
- print "done!\n";
+ if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ */
+ print "done!\n";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt
index 2507a4c8f8..83fd41b4fd 100644
--- a/ext/mysqli/tests/mysqli_stat.phpt
+++ b/ext/mysqli/tests/mysqli_stat.phpt
@@ -8,32 +8,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stat()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stat()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stat($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stat($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stat($link, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stat($link, "foo")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
- printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
+ if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
+ printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_stat($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stat($link)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stat(): Couldn't fetch mysqli in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
index 33f1b896c8..2f83fc2530 100644
--- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
@@ -8,238 +8,238 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_affected_rows()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_affected_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $stmt = mysqli_stmt_init($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') ||
- !mysqli_stmt_execute($stmt)) {
- printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) ||
- !mysqli_stmt_execute($stmt)) {
- printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- // NOTE: the error message varies with the MySQL Server version, dump only the error code!
- printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ // NOTE: the error message varies with the MySQL Server version, dump only the error code!
+ printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt));
- /* an error occurred: affected rows should return -1 */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ /* an error occurred: affected rows should return -1 */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") ||
- !mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") ||
- !mysqli_stmt_execute($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") ||
- !mysqli_stmt_execute($stmt))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) ||
- !($tmp = mysqli_fetch_assoc($res)))
- printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link));
- $num = (int)$tmp['num'];
- mysqli_free_result($res);
+ if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) ||
+ !($tmp = mysqli_fetch_assoc($res)))
+ printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link));
+ $num = (int)$tmp['num'];
+ mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp);
+ if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") ||
- !mysqli_stmt_execute($stmt))
- printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") ||
- !mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") ||
- !mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') ||
- !mysqli_stmt_execute($stmt))
- printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* use it like num_rows */
- /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ /* use it like num_rows */
+ /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_store_result($stmt))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (1 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') ||
- !mysqli_stmt_execute($stmt))
- printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* use it like num_rows */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ /* use it like num_rows */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- /* try to use stmt_affected_rows like stmt_num_rows */
- /* stmt_affected_rows is not really meant for SELECT! */
- if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') ||
- mysqli_stmt_execute($stmt))
- printf("[041] The invalid SELECT statement is issued on purpose\n");
+ /* try to use stmt_affected_rows like stmt_num_rows */
+ /* stmt_affected_rows is not really meant for SELECT! */
+ if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') ||
+ mysqli_stmt_execute($stmt))
+ printf("[041] The invalid SELECT statement is issued on purpose\n");
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if ($IS_MYSQLND) {
- if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp);
- } else {
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
- }
+ if ($IS_MYSQLND) {
+ if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp);
+ } else {
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
+ }
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") ||
- !mysqli_stmt_execute($stmt))
- printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[047] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[047] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
index f2da9d190c..d8b7137ba8 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
@@ -8,59 +8,59 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_attr_get()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_attr_get()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_attr_get($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_attr_get($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if (mysqli_get_client_version() > 50003)
- $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+ $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if (mysqli_get_client_version() > 50003)
+ $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
- if ($IS_MYSQLND && mysqli_get_client_version() > 50007)
- $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
+ if ($IS_MYSQLND && mysqli_get_client_version() > 50007)
+ $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
- do {
- $invalid_attr = mt_rand(0, 10000);
- } while (in_array($invalid_attr, $valid_attr));
+ do {
+ $invalid_attr = mt_rand(0, 10000);
+ } while (in_array($invalid_attr, $valid_attr));
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
- if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $invalid_attr)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
+ if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $invalid_attr)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- foreach ($valid_attr as $k => $attr) {
- if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) {
- printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- }
+ foreach ($valid_attr as $k => $attr) {
+ if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) {
+ printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n",
+ gettype($tmp), $tmp, $k, $attr);
+ }
+ }
- $stmt->close();
+ $stmt->close();
- foreach ($valid_attr as $k => $attr) {
- if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $attr))) {
- printf("[007] Expecting false, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- }
+ foreach ($valid_attr as $k => $attr) {
+ if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $attr))) {
+ printf("[007] Expecting false, got %s/%s for attribute %s/%s\n",
+ gettype($tmp), $tmp, $k, $attr);
+ }
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
index 5cb6cd0ac2..21f1db79c0 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
@@ -9,17 +9,17 @@ die("SKIP: prefetch isn't supported at the moment");
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
- if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) {
- printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- $stmt->close();
- mysqli_close($link);
- print "done!";
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
+ if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) {
+ printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n",
+ gettype($tmp), $tmp, $k, $attr);
+ }
+ $stmt->close();
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
index aa13198775..6885ce9fc2 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
@@ -8,266 +8,266 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_attr_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) {
- $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE;
- }
-
- if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND)
- $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
-
-
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->prepare("SELECT * FROM test");
-
- mt_srand(microtime(true));
-
- for ($i = -100; $i < 1000; $i++) {
- if (in_array($i, $valid_attr))
- continue;
- $invalid_attr = $i;
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
- printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
- }
- }
-
- for ($i = 0; $i < 2; $i++) {
- do {
- $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
- } while (in_array($invalid_attr, $valid_attr));
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
- printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
- }
- }
- $stmt->close();
-
- //
- // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
- //
-
-
- // expecting max_length not to be set and be 0 in all cases
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length to _be_ set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
- $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ($res !== 1)
- printf("[007.1] max_length should be 1, got %s\n", $res);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length === 0)
- printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length not to be set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
- $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ($res !== 0)
- printf("[008.1] max_length should be 0, got %s\n", $res);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- //
- // Cursors
- //
-
- if (mysqli_get_client_version() > 50003) {
-
- $cursor_types = array(
- MYSQLI_CURSOR_TYPE_NO_CURSOR,
- MYSQLI_CURSOR_TYPE_READ_ONLY,
- MYSQLI_CURSOR_TYPE_FOR_UPDATE,
- MYSQLI_CURSOR_TYPE_SCROLLABLE
- );
- do {
- $invalid_cursor_type = mt_rand(-1000, 1000);
- } while (in_array($invalid_cursor_type, $cursor_types));
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
-
- if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
- printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[015] Results should not be empty, subsequent tests will probably fail!\n");
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[017] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[019] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
-
- }
-
-
- //
- // MYSQLI_STMT_ATTR_PREFETCH_ROWS
- //
-
- if (mysqli_get_client_version() > 50007) {
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
- printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[021] Results should not be empty, subsequent tests will probably fail!\n");
-
- /* prefetch is not supported
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
- printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX)))
- printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
- printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[025] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
- */
-
- }
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) {
+ $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE;
+ }
+
+ if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND)
+ $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
+
+
+ $stmt = mysqli_stmt_init($link);
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ $stmt->prepare("SELECT * FROM test");
+
+ mt_srand(microtime(true));
+
+ for ($i = -100; $i < 1000; $i++) {
+ if (in_array($i, $valid_attr))
+ continue;
+ $invalid_attr = $i;
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
+ printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
+ }
+ }
+
+ for ($i = 0; $i < 2; $i++) {
+ do {
+ $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
+ } while (in_array($invalid_attr, $valid_attr));
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
+ printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
+ }
+ }
+ $stmt->close();
+
+ //
+ // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
+ //
+
+
+ // expecting max_length not to be set and be 0 in all cases
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length to _be_ set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
+ $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ($res !== 1)
+ printf("[007.1] max_length should be 1, got %s\n", $res);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length === 0)
+ printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length not to be set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
+ $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ($res !== 0)
+ printf("[008.1] max_length should be 0, got %s\n", $res);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ //
+ // Cursors
+ //
+
+ if (mysqli_get_client_version() > 50003) {
+
+ $cursor_types = array(
+ MYSQLI_CURSOR_TYPE_NO_CURSOR,
+ MYSQLI_CURSOR_TYPE_READ_ONLY,
+ MYSQLI_CURSOR_TYPE_FOR_UPDATE,
+ MYSQLI_CURSOR_TYPE_SCROLLABLE
+ );
+ do {
+ $invalid_cursor_type = mt_rand(-1000, 1000);
+ } while (in_array($invalid_cursor_type, $cursor_types));
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+
+ if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
+ printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[015] Results should not be empty, subsequent tests will probably fail!\n");
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[017] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[019] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ }
+
+
+ //
+ // MYSQLI_STMT_ATTR_PREFETCH_ROWS
+ //
+
+ if (mysqli_get_client_version() > 50007) {
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
+ printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[021] Results should not be empty, subsequent tests will probably fail!\n");
+
+ /* prefetch is not supported
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
+ printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX)))
+ printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
+ printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[025] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+ */
+
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
index b427944852..48d433ef0f 100644
--- a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
@@ -8,39 +8,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- $cleanupIds = range(1000, 3007);
- $model = 50;
+ $cleanupIds = range(1000, 3007);
+ $model = 50;
- $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
+ $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
- /* create a prepared statement */
- if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) {
+ /* create a prepared statement */
+ if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) {
- $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]);
+ $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]);
- /* execute query */
- $stmt->execute();
+ /* execute query */
+ $stmt->execute();
- /* close statement */
- $stmt->close();
- }
+ /* close statement */
+ $stmt->close();
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
index 0b1d41a176..44ab45c257 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
@@ -8,108 +8,108 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function bind_many($offset, $link, $num_params, $rows, $eval = true) {
-
- $drop = "DROP TABLE IF EXISTS test";
- $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, ";
- $insert = "INSERT INTO test";
- $columns = "";
- $values = "";
- $stmt_params = "";
- $params = array();
- for ($i = 0; $i < $num_params; $i++) {
- $create .= "col" . $i . " INT, ";
- $columns .= "col" . $i . ", ";
- $values .= "?, ";
- $stmt_params .= '$params[' . $i . '], ';
- for ($j = 0; $j < $rows; $j++)
- $params[($j * $rows) + $i] = $i;
- }
- $create = substr($create, 0, -2) . ")";
-
- $stmt_types = str_repeat("i", $num_params * $rows);
- $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2);
- $values = substr($values, 0, -2);
- $insert .= "(" . substr($columns, 0, -2) . ") VALUES ";
- $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2);
-
- $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');';
-
- printf("Testing %d columns with %d rows...\n", $num_params, $rows);
-
- if (!$link->query($drop) || !$link->query($create)) {
- printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
- printf("... table created\n");
-
- if (!$stmt = $link->prepare($insert)) {
- printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
- if ($stmt->param_count != $num_params * $rows) {
- printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
- return false;
- }
- printf("... statement with %d parameters prepared\n", $stmt->param_count);
-
- if ($eval) {
- if (!eval($stmt_bind_param)) {
- printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- } else {
- $param_ref = array($stmt_types);
- for ($i = 0; $i < $rows; $i++)
- for ($j = 0; $j < $num_params; $j++)
- $param_ref[] = &$params[($i * $rows) + $j];
-
- if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) {
- printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- }
- if ($stmt->param_count != $num_params * $rows) {
- printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
- return false;
- }
-
- if (!$stmt->execute()) {
- printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- printf("Statement done\n");
-
- $stmt->close();
-
- if (!($res = $link->query("SELECT * FROM test"))) {
- printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- $row = $res->fetch_row();
- $res->close();
-
- for ($i = 0; $i < $num_params; $i++) {
- if ($row[$i + 1] != $i) {
- printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error);
- }
- }
-
- return true;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- var_dump(bind_many(10, $link, 273, 240, true));
- var_dump(bind_many(20, $link, 273, 240, false));
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ function bind_many($offset, $link, $num_params, $rows, $eval = true) {
+
+ $drop = "DROP TABLE IF EXISTS test";
+ $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, ";
+ $insert = "INSERT INTO test";
+ $columns = "";
+ $values = "";
+ $stmt_params = "";
+ $params = array();
+ for ($i = 0; $i < $num_params; $i++) {
+ $create .= "col" . $i . " INT, ";
+ $columns .= "col" . $i . ", ";
+ $values .= "?, ";
+ $stmt_params .= '$params[' . $i . '], ';
+ for ($j = 0; $j < $rows; $j++)
+ $params[($j * $rows) + $i] = $i;
+ }
+ $create = substr($create, 0, -2) . ")";
+
+ $stmt_types = str_repeat("i", $num_params * $rows);
+ $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2);
+ $values = substr($values, 0, -2);
+ $insert .= "(" . substr($columns, 0, -2) . ") VALUES ";
+ $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2);
+
+ $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');';
+
+ printf("Testing %d columns with %d rows...\n", $num_params, $rows);
+
+ if (!$link->query($drop) || !$link->query($create)) {
+ printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+ printf("... table created\n");
+
+ if (!$stmt = $link->prepare($insert)) {
+ printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+ if ($stmt->param_count != $num_params * $rows) {
+ printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
+ return false;
+ }
+ printf("... statement with %d parameters prepared\n", $stmt->param_count);
+
+ if ($eval) {
+ if (!eval($stmt_bind_param)) {
+ printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ } else {
+ $param_ref = array($stmt_types);
+ for ($i = 0; $i < $rows; $i++)
+ for ($j = 0; $j < $num_params; $j++)
+ $param_ref[] = &$params[($i * $rows) + $j];
+
+ if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) {
+ printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ }
+ if ($stmt->param_count != $num_params * $rows) {
+ printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
+ return false;
+ }
+
+ if (!$stmt->execute()) {
+ printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ printf("Statement done\n");
+
+ $stmt->close();
+
+ if (!($res = $link->query("SELECT * FROM test"))) {
+ printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ $row = $res->fetch_row();
+ $res->close();
+
+ for ($i = 0; $i < $num_params; $i++) {
+ if ($row[$i + 1] != $i) {
+ printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error);
+ }
+ }
+
+ return true;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ var_dump(bind_many(10, $link, 273, 240, true));
+ var_dump(bind_many(20, $link, 273, 240, false));
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
index 3b8b7f2bf2..353fd3b774 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
@@ -8,382 +8,382 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- The way we test the INSERT and data types overlaps with
- the mysqli_stmt_bind_result test in large parts. There is only
- one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
- fetch the inserted values. This way we test
- mysqli_query()/mysqli_fetch_assoc() for all possible data types
- in this file and we test mysqli_stmt_bind_result() in the other
- test -- therefore the "duplicate" makes some sense to me.
- */
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- $label = null;
-
- /*
- libmysql gives a less descriptive error message but mysqlnd,
- we did not unify the error messages but ignore this slight difference silently
- */
- if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
- printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
- printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- /* TODO: somehwhat undocumented syntax! */
- $param = array($id);
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
- printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- $param = array($id, $label, $id);
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
- printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label)))
- printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (function_exists("memory_get_usage")) {
- $mem = memory_get_usage();
- for ($i = 0; $i < 20000; $i++) {
- if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- }
- if (($tmp = (memory_get_usage() - $mem)) > 600)
- printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp);
- }
-
- $id = 100;
- $label = "z";
- if (!mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
- if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- if (($row['id'] != $id) || ($row['label'] != $label))
- printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']);
- mysqli_free_result($res);
-
- function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - it might be that the server does not support the data type
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) {
- printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- mysqli_stmt_close($stmt);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($alternative) {
- if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) {
- printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n",
- $offset + 6, $bind_type, $sql_type,
- $id, $bind_value, gettype($bind_value), $row['id'], $row['label']);
- return false;
- }
- } else {
- if (($row['id'] != $id) || ($row['label'] != $bind_value)) {
- printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n",
- $offset + 6, $bind_type, $sql_type,
- $id, $bind_value, $row['id'], $row['label']);
- return false;
- }
- }
-
- mysqli_free_result($res);
- return true;
- }
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900);
- // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920);
+ /*
+ The way we test the INSERT and data types overlaps with
+ the mysqli_stmt_bind_result test in large parts. There is only
+ one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
+ fetch the inserted values. This way we test
+ mysqli_query()/mysqli_fetch_assoc() for all possible data types
+ in this file and we test mysqli_stmt_bind_result() in the other
+ test -- therefore the "duplicate" makes some sense to me.
+ */
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_bind_param()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_bind_param($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ $label = null;
+
+ /*
+ libmysql gives a less descriptive error message but mysqlnd,
+ we did not unify the error messages but ignore this slight difference silently
+ */
+ if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
+ printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
+ printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* TODO: somehwhat undocumented syntax! */
+ $param = array($id);
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
+ printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ $param = array($id, $label, $id);
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
+ printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label)))
+ printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (function_exists("memory_get_usage")) {
+ $mem = memory_get_usage();
+ for ($i = 0; $i < 20000; $i++) {
+ if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ }
+ if (($tmp = (memory_get_usage() - $mem)) > 600)
+ printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp);
+ }
+
+ $id = 100;
+ $label = "z";
+ if (!mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+
+ if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_assoc($res);
+ if (($row['id'] != $id) || ($row['label'] != $label))
+ printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']);
+ mysqli_free_result($res);
+
+ function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - it might be that the server does not support the data type
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) {
+ printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($alternative) {
+ if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) {
+ printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n",
+ $offset + 6, $bind_type, $sql_type,
+ $id, $bind_value, gettype($bind_value), $row['id'], $row['label']);
+ return false;
+ }
+ } else {
+ if (($row['id'] != $id) || ($row['label'] != $bind_value)) {
+ printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n",
+ $offset + 6, $bind_type, $sql_type,
+ $id, $bind_value, $row['id'], $row['label']);
+ return false;
+ }
+ }
+
+ mysqli_free_result($res);
+ return true;
+ }
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900);
+ // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920);
/*
- ??
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320);
- */
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330);
- if (2147483647 == PHP_INT_MAX) {
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09');
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09');
- }
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18');
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19');
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
-
- /*
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
- */
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780);
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880);
-
- if (mysqli_get_server_version($link) >= 50600)
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34");
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- $label = null;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_execute($stmt);
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
- include("table.inc");
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (true !== ($tmp = $stmt->bind_param('is', $id, $label)))
- printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $stmt->errno, $stmt->error);
-
- $id = 100; $label = 'z';
- if (!$stmt->execute())
- printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
- printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if ($row['id'] != 100 || $row['label'] != 'z') {
- printf("[2009] Row seems wrong, dumping record\n");
- var_dump($row);
- }
- mysqli_free_result($res);
-
- $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ ??
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320);
+ */
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330);
+ if (2147483647 == PHP_INT_MAX) {
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09');
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09');
+ }
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18');
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19');
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
+
+ /*
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
+ */
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780);
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880);
+
+ if (mysqli_get_server_version($link) >= 50600)
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34");
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ $label = null;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_execute($stmt);
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+ include("table.inc");
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (true !== ($tmp = $stmt->bind_param('is', $id, $label)))
+ printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ $stmt->errno, $stmt->error);
+
+ $id = 100; $label = 'z';
+ if (!$stmt->execute())
+ printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
+ printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if ($row['id'] != 100 || $row['label'] != 'z') {
+ printf("[2009] Row seems wrong, dumping record\n");
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+
+ $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
foreach ($value_list as $k => $values) {
- if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) {
- printf("[2011] bind_param() failed for id = %d, [%d] %s\n",
- $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- continue;
- }
- if (!$stmt->execute())
- printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n",
- $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id'])))
- printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[2014] Cannot find row id = %d\n", $values['id']);
- else if (isset($row['label']) && ($values['label'] != $row['label']))
- printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']);
-
- mysqli_free_result($res);
- }
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) {
+ printf("[2011] bind_param() failed for id = %d, [%d] %s\n",
+ $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ continue;
+ }
+ if (!$stmt->execute())
+ printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n",
+ $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id'])))
+ printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[2014] Cannot find row id = %d\n", $values['id']);
+ else if (isset($row['label']) && ($values['label'] != $row['label']))
+ printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']);
+
+ mysqli_free_result($res);
+ }
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_bind_param()))
+ printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
index 198f6e98ff..6bdabd74a2 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
@@ -8,321 +8,321 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) ||
- !mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Regular, procedural, using variables\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$stmt,
- 1 => &$types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for everything\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$types,
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using references for everything\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $types,
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using variable for types. using references for bound parameter\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => 'i',
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using constant for types. using references for bound parameter\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for everything but using variable for types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => 'i',
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id)))
- printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n";
- var_dump($id);
- var_dump($label);
-
- //
- // Any of those shall fail - see also bugs.php.net/43568
- //
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => 'i',
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => 'i',
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Regular, procedural, using variables\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$stmt,
+ 1 => &$types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for everything\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$types,
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using references for everything\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $types,
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using variable for types. using references for bound parameter\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => 'i',
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using constant for types. using references for bound parameter\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for everything but using variable for types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => 'i',
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id)))
+ printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n";
+ var_dump($id);
+ var_dump($label);
+
+ //
+ // Any of those shall fail - see also bugs.php.net/43568
+ //
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => 'i',
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => 'i',
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
index 2c43621ff9..b5ad6c2cf1 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
@@ -8,59 +8,59 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
- $link->set_charset('latin1');
+ require('table.inc');
+ $link->set_charset('latin1');
- class foo {
- // @var $bar string
- public $bar;
- }
+ class foo {
+ // @var $bar string
+ public $bar;
+ }
- $foo = new foo;
- $foo->bar = "фубар";
+ $foo = new foo;
+ $foo->bar = "фубар";
- echo "Test 1:\n";
- $stmt = $link->prepare("SELECT ? FOO");
- var_dump($foo); // here you can see the bar member var being a string
- $stmt->bind_param("s", $foo->bar);
- var_dump($foo); // this will show $foo->bar being a reference string
- $stmt->bind_result($one);
- $stmt->execute();
- $stmt->fetch();
- $stmt->free_result();
- echo("$one\n\n");
+ echo "Test 1:\n";
+ $stmt = $link->prepare("SELECT ? FOO");
+ var_dump($foo); // here you can see the bar member var being a string
+ $stmt->bind_param("s", $foo->bar);
+ var_dump($foo); // this will show $foo->bar being a reference string
+ $stmt->bind_result($one);
+ $stmt->execute();
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one\n\n");
- // it is getting worse. Binding the same var twice with different
- // types you can get unexpected results (e.g. binary trash for the
- // string and misc data for the integer. See next 2 tests.
+ // it is getting worse. Binding the same var twice with different
+ // types you can get unexpected results (e.g. binary trash for the
+ // string and misc data for the integer. See next 2 tests.
- echo "Test 2:\n";
- $stmt = $link->prepare("SELECT ? FOO, ? BAR");
- var_dump($foo);
- $stmt->bind_param("si", $foo->bar, $foo->bar);
- echo "---\n";
- var_dump($foo);
- echo "---\n";
- $stmt->execute();
- var_dump($foo);
- echo "---\n";
- $stmt->bind_result($one, $two);
- $stmt->fetch();
- $stmt->free_result();
- echo("$one - $two\n\n");
+ echo "Test 2:\n";
+ $stmt = $link->prepare("SELECT ? FOO, ? BAR");
+ var_dump($foo);
+ $stmt->bind_param("si", $foo->bar, $foo->bar);
+ echo "---\n";
+ var_dump($foo);
+ echo "---\n";
+ $stmt->execute();
+ var_dump($foo);
+ echo "---\n";
+ $stmt->bind_result($one, $two);
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one - $two\n\n");
- echo "Test 3:\n";
- $stmt = $link->prepare("SELECT ? FOO, ? BAR");
- var_dump($foo);
- $stmt->bind_param("is", $foo->bar, $foo->bar);
- var_dump($foo);
- $stmt->bind_result($one, $two);
- $stmt->execute();
- $stmt->fetch();
- $stmt->free_result();
- echo("$one - $two\n\n");
- echo "done!";
+ echo "Test 3:\n";
+ $stmt = $link->prepare("SELECT ? FOO, ? BAR");
+ var_dump($foo);
+ $stmt->bind_param("is", $foo->bar, $foo->bar);
+ var_dump($foo);
+ $stmt->bind_result($one, $two);
+ $stmt->execute();
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one - $two\n\n");
+ echo "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
index efe86972d9..8e716f17e6 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
@@ -94,7 +94,7 @@ memory_limit=256M
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
int(%d)
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
index 28dcf71da1..3ed24f19b9 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
@@ -8,196 +8,196 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function findRow($offset, $link, $id, $label) {
-
- $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'",
- $id, $label);
- if (!$res = mysqli_query($link, $sql)) {
- printf("[%03d + 1] %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d + 2] fetch for %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- mysqli_free_result($res);
- if ($row['id'] != $id) {
- printf("[%03d + 3] Expecting %s/%s got %s/%s\n",
- $offset, gettype($id), $id,
- gettype($row['id']), $row['id']
- );
- return false;
- }
-
- if ($row['label'] != $label) {
- printf("[%03d + 4] Expecting %s/%s got %s/%s\n",
- $offset, gettype($label), $label,
- gettype($row['label']), $row['label']
- );
- return false;
- }
-
- $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'",
- $id, $label);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d + 5] %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- return true;
- }
- // or we will get dups around [28]
- mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY");
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 100;
- $label = 'v';
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // no need to check the return value, will bail and make EXPECTF fail if need be
- findRow(4, $link, $id, $label);
-
- $id++;
- $label_ref = &$label;
- $label = 'w';
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(7, $link, $id, $label_ref);
-
- $id++;
- $label_ref_ref = &$label_ref;
- $label = 'x';
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(9, $link, $id, $label_ref_ref);
-
- $id = 9;
- $label = $id;
- $label_num = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(12, $link, $id, $label_num);
-
- $label_num = &$id;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
- printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(15, $link, $id, $label_num);
-
- $label = 9;
- $id = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(17, $link, $id, $label);
-
- $base = 9;
- $id = &$base;
- $label = &$id;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(20, $link, $id, $label);
-
- $id_ref = &$id;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
- printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(23, $link, $id_ref, $label_ref);
-
- $id_ref_ref = &$GLOBALS['id_ref'];
- $label_ref_ref = &$GLOBALS['label_ref_ref'];
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref)))
- printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(26, $link, $id_ref_ref, $label_ref_ref);
-
- unset($id);
- unset($label);
- $id = 102;
- $label = new stdClass();
- $label->label = 'y';
- $id_ref = &$GLOBALS['id'];
- $label_ref = &$label->label;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
- printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== @mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(29, $link, $id_ref, $label_ref);
-
- $id = 103;
- $label_a = &$label_b;
- $label_b = &$label_a;
- $label_a = 'z';
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b)))
- printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(32, $link, $id, $label_b);
-
- class foo {
- public $foo;
- function __construct() {
- $this->foo = &$this->bar;
- }
- }
- class bar extends foo {
- public $bar = 'v';
- }
- $bar = new bar();
- $id++;
- $label = &$GLOBALS['bar']->foo;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(35, $link, $id, $label);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ require('table.inc');
+
+ function findRow($offset, $link, $id, $label) {
+
+ $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'",
+ $id, $label);
+ if (!$res = mysqli_query($link, $sql)) {
+ printf("[%03d + 1] %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d + 2] fetch for %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ mysqli_free_result($res);
+ if ($row['id'] != $id) {
+ printf("[%03d + 3] Expecting %s/%s got %s/%s\n",
+ $offset, gettype($id), $id,
+ gettype($row['id']), $row['id']
+ );
+ return false;
+ }
+
+ if ($row['label'] != $label) {
+ printf("[%03d + 4] Expecting %s/%s got %s/%s\n",
+ $offset, gettype($label), $label,
+ gettype($row['label']), $row['label']
+ );
+ return false;
+ }
+
+ $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'",
+ $id, $label);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d + 5] %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ return true;
+ }
+ // or we will get dups around [28]
+ mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY");
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 100;
+ $label = 'v';
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ // no need to check the return value, will bail and make EXPECTF fail if need be
+ findRow(4, $link, $id, $label);
+
+ $id++;
+ $label_ref = &$label;
+ $label = 'w';
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(7, $link, $id, $label_ref);
+
+ $id++;
+ $label_ref_ref = &$label_ref;
+ $label = 'x';
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(9, $link, $id, $label_ref_ref);
+
+ $id = 9;
+ $label = $id;
+ $label_num = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(12, $link, $id, $label_num);
+
+ $label_num = &$id;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
+ printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(15, $link, $id, $label_num);
+
+ $label = 9;
+ $id = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(17, $link, $id, $label);
+
+ $base = 9;
+ $id = &$base;
+ $label = &$id;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(20, $link, $id, $label);
+
+ $id_ref = &$id;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
+ printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(23, $link, $id_ref, $label_ref);
+
+ $id_ref_ref = &$GLOBALS['id_ref'];
+ $label_ref_ref = &$GLOBALS['label_ref_ref'];
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref)))
+ printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(26, $link, $id_ref_ref, $label_ref_ref);
+
+ unset($id);
+ unset($label);
+ $id = 102;
+ $label = new stdClass();
+ $label->label = 'y';
+ $id_ref = &$GLOBALS['id'];
+ $label_ref = &$label->label;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
+ printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== @mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(29, $link, $id_ref, $label_ref);
+
+ $id = 103;
+ $label_a = &$label_b;
+ $label_b = &$label_a;
+ $label_a = 'z';
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b)))
+ printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(32, $link, $id, $label_b);
+
+ class foo {
+ public $foo;
+ function __construct() {
+ $this->foo = &$this->bar;
+ }
+ }
+ class bar extends foo {
+ public $bar = 'v';
+ }
+ $bar = new bar();
+ $id++;
+ $label = &$GLOBALS['bar']->foo;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(35, $link, $id, $label);
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
index 13bf7d4ac9..0070c02dd8 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
@@ -8,116 +8,116 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- mysqli_autocommit($link, true);
-
- $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) {
- printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
- printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
- printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- mysqli_stmt_close($stmt);
- if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) {
- printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (2 !== ($tmp = mysqli_num_rows($res))) {
- printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
- }
-
- $row = mysqli_fetch_assoc($res);
- if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) {
- printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
- $offset, $bind_value1, $bind_value1,
- $row['col1'], $row['col2'],
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- $row = mysqli_fetch_assoc($res);
- if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) {
- printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
- $offset, $bind_value1, $bind_value2,
- $row['col1'], $row['col2'],
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
- mysqli_free_result($res);
- return true;
- }
-
- bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10);
- bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20);
- bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30);
-
- /* type juggling - note that int->char works */
- bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40);
- /* type juggling - note that string->integer works */
- bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50);
- /* type juggling - note that string->float works*/
- bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60);
-
- /* now, let's have two columns of different type and do type juggling */
- /*
- what the test will do is:
- 1) col1 INT, col2 CHAR(1)
+ require('table.inc');
+
+ function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ mysqli_autocommit($link, true);
+
+ $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) {
+ printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
+ printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
+ printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ mysqli_stmt_close($stmt);
+ if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) {
+ printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (2 !== ($tmp = mysqli_num_rows($res))) {
+ printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) {
+ printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
+ $offset, $bind_value1, $bind_value1,
+ $row['col1'], $row['col2'],
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) {
+ printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
+ $offset, $bind_value1, $bind_value2,
+ $row['col1'], $row['col2'],
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ mysqli_free_result($res);
+ return true;
+ }
+
+ bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10);
+ bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20);
+ bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30);
+
+ /* type juggling - note that int->char works */
+ bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40);
+ /* type juggling - note that string->integer works */
+ bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50);
+ /* type juggling - note that string->float works*/
+ bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60);
+
+ /* now, let's have two columns of different type and do type juggling */
+ /*
+ what the test will do is:
+ 1) col1 INT, col2 CHAR(1)
2) bind_param('is', 1, 1)
3) execute()
- 4) bind_param('is', 1, 'a')
- 5) execute()
+ 4) bind_param('is', 1, 'a')
+ 5) execute()
- col1 INT, col2 INT
+ col1 INT, col2 INT
bind_param('ii', '1', '2') --> OK (int column, string value)
- bind_param('ii', 1, 2) --> OK (int column, int value)
+ bind_param('ii', 1, 2) --> OK (int column, int value)
col1 CHAR(1), col2 CHAR(2)
bind_param('ss', 1, 2) --> OK (string column, int value)
- So, what about:
- col1 INT, COL2 CHAR(1)
- bind_param('is', 1, 1) ---> ??
- */
- bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70);
+ So, what about:
+ col1 INT, COL2 CHAR(1)
+ bind_param('is', 1, 1) ---> ??
+ */
+ bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
index 8a43c449a0..ec0034a68f 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
@@ -8,310 +8,310 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_bind_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_bind_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_bind_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_null($tmp = mysqli_stmt_bind_result($stmt)))
- printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
-
- $id = null;
- $label = null;
- $foo = null;
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- while (mysqli_stmt_fetch($stmt)) {
- var_dump($id);
- var_dump($label);
- }
- mysqli_stmt_close($stmt);
-
-
- function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = null;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_stmt_init($link);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
-
- $bind_res = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- $num = 0;
- $fields = mysqli_fetch_fields($result);
-
- while (mysqli_stmt_fetch($stmt)) {
- if (!gettype($bind_res)=="unicode") {
- if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
- printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
- $offset + 10, $num,
- gettype($bind_value), $bind_value, $type_hint,
- gettype($bind_res), $bind_res);
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_stmt_close($stmt);
- return false;
- }
-
- mysqli_stmt_close($stmt);
- return true;
- }
-
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
-
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
-
- /* test is broken too: we bind "integer" but value is a float
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
- */
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
-
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
-
- // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020);
-
- $tmp = intval(@date('Y'));
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580);
- func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
- func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
-
- /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
- if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) {
- /* NOTE: the MySQL Client Library - not mysqlnd - will allocate
- a hugge max_length(type) = 4GB bind buffer */
- func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660);
- func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
- }
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
-
- if (mysqli_get_server_version($link) >= 50600)
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34");
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
- printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- if (false !== @mysqli_stmt_bind_result($stmt, $id))
- printf("[3002] Bind result should not be allowed");
-
- mysqli_stmt_close($stmt);
-
- mysqli_close($link);
- print "done!";
+ if (!is_null($tmp = mysqli_stmt_bind_result($stmt)))
+ printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
+
+ $id = null;
+ $label = null;
+ $foo = null;
+
+ if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
+ printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ while (mysqli_stmt_fetch($stmt)) {
+ var_dump($id);
+ var_dump($label);
+ }
+ mysqli_stmt_close($stmt);
+
+
+ function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = null;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ mysqli_stmt_close($stmt);
+
+ $stmt = mysqli_stmt_init($link);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+
+ $bind_res = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ $num = 0;
+ $fields = mysqli_fetch_fields($result);
+
+ while (mysqli_stmt_fetch($stmt)) {
+ if (!gettype($bind_res)=="unicode") {
+ if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
+ printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
+ $offset + 10, $num,
+ gettype($bind_value), $bind_value, $type_hint,
+ gettype($bind_res), $bind_res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
+
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
+
+ /* test is broken too: we bind "integer" but value is a float
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
+ */
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
+
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
+
+ // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020);
+
+ $tmp = intval(@date('Y'));
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
+
+ /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
+ if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) {
+ /* NOTE: the MySQL Client Library - not mysqlnd - will allocate
+ a hugge max_length(type) = 4GB bind buffer */
+ func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
+ }
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
+
+ if (mysqli_get_server_version($link) >= 50600)
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34");
+
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_bind_result()))
+ printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
+ printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ if (false !== @mysqli_stmt_bind_result($stmt, $id))
+ printf("[3002] Bind result should not be allowed");
+
+ mysqli_stmt_close($stmt);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
index ee36837407..ef2a046c2c 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
@@ -8,148 +8,148 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function dec32bin($dec, $bits) {
-
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
-
- if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$link_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- for ($bits = 1; $bits <= 46; $bits++) {
-
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
-
- if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) {
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
- }
-
- if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- continue;
- }
- if (!$stmt_ins = mysqli_stmt_init($link_ins)) {
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
- continue;
- }
-
- if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) {
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
-
- if (!($stmt_sel = mysqli_stmt_init($link_sel))) {
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
-
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
-
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
-
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
-
- if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) {
- printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
- if (!mysqli_stmt_execute($stmt_ins)) {
- printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- break;
- }
- $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value);
- if ((!mysqli_stmt_prepare($stmt_sel, $sql)) ||
- (!mysqli_stmt_execute($stmt_sel))) {
- printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
- break;
- }
-
- $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1);
- if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) {
- printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
- break;
- }
-
- if (!($ret = mysqli_stmt_fetch($stmt_sel))) {
- printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n",
- $bits, $bits,
- gettype($ret), $ret,
- mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel),
- mysqli_errno($link_sel), mysqli_errno($link_sel)
- );
- break;
- }
-
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
-
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
-
- }
-
- mysqli_stmt_close($stmt_ins);
- mysqli_stmt_close($stmt_sel);
- }
-
- mysqli_close($link_ins);
- mysqli_close($link_sel);
- print "done!";
+ require_once("connect.inc");
+
+ function dec32bin($dec, $bits) {
+
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
+
+ if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$link_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ for ($bits = 1; $bits <= 46; $bits++) {
+
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+
+ if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) {
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
+ }
+
+ if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ continue;
+ }
+ if (!$stmt_ins = mysqli_stmt_init($link_ins)) {
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
+ continue;
+ }
+
+ if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) {
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+
+ if (!($stmt_sel = mysqli_stmt_init($link_sel))) {
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
+
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
+
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
+
+ if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) {
+ printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+ if (!mysqli_stmt_execute($stmt_ins)) {
+ printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ break;
+ }
+ $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value);
+ if ((!mysqli_stmt_prepare($stmt_sel, $sql)) ||
+ (!mysqli_stmt_execute($stmt_sel))) {
+ printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
+ break;
+ }
+
+ $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1);
+ if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) {
+ printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
+ break;
+ }
+
+ if (!($ret = mysqli_stmt_fetch($stmt_sel))) {
+ printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n",
+ $bits, $bits,
+ gettype($ret), $ret,
+ mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel),
+ mysqli_errno($link_sel), mysqli_errno($link_sel)
+ );
+ break;
+ }
+
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
+
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+
+ }
+
+ mysqli_stmt_close($stmt_ins);
+ mysqli_stmt_close($stmt_sel);
+ }
+
+ mysqli_close($link_ins);
+ mysqli_close($link_sel);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
index 62a3e499ae..cb0aee6f05 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
@@ -335,7 +335,7 @@ memory_limit=83886080
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
index 4b12285333..464e201c78 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
@@ -8,238 +8,238 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- print "plain vanilla...\n";
- unset($id); unset($label);
- $id = $label = null;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ print "plain vanilla...\n";
+ unset($id); unset($label);
+ $id = $label = null;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
- var_dump($label);
+ var_dump($id);
+ var_dump($label);
- print "reference, one level...\n";
- unset($id); unset($id_ref); unset($label); unset($label_ref);
- $id = null;
- $id_ref = &$id;
- $label = null;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
-
- print "reference, two levels...\n";
- unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref);
- $id = null;
- $id_ref = &$id;
- $id_ref_ref = &$id_ref;
- $label = null;
- $label_ref = &$label;
- $label_ref_ref = &$label_ref;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref_ref);
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref_ref);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, \$GLOBALS...\n";
- unset($id); unset($id_ref); unset($label); unset($label_ref);
- $id = 100;
- $id_ref = &$GLOBALS['id'];
- $label = null;
- $label_ref = &$GLOBALS['label'];
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, same target...\n";
- $id = null;
- $label = &$id;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($label);
-
- print "reference, simple object...\n";
- unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($obj->label);
-
-
- print "reference, simple object w reference...\n";
- unset($id); unset($label); unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
- $id = &$obj->id;
- $label = &$obj->label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($obj->label);
-
- print "reference, simple object w reference, change after bind...\n";
- unset($id); unset($label); unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
- $id = &$obj->id;
- $label = &$obj->label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $label = &$obj->id;
- $id = null;
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($id);
- var_dump($obj->label);
- var_dump($label);
-
- print "reference, one level, change after bind...\n";
- unset($id); unset($label); unset($id_ref); unset($label_ref);
- $id = null;
- $id_ref = &$id;
- $label = null;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $id_ref = 1;
- $label_ref = 1;
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, circle...\n";
- unset($id); unset($label_a); unset($label_b);
- $id = null;
- $label_a = &$label_b;
- $label_b = &$label_a;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a)))
- printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($label_a);
- var_dump($label_b);
-
- print "reference, object, forward declaration...\n";
- unset($bar); unset($id); unset($label_ref);
- class foo {
- public $foo;
- public function __construct() {
- $this->foo = &$this->bar;
- }
- }
- class bar extends foo {
- public $bar = null;
- }
- $bar = new bar();
- $id = null;
- $label_ref = &$bar->bar;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref)))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($bar);
- var_dump($label_ref);
-
- print "references, object, private...\n";
- unset($bar); unset($id); unset($label);
- class mega_bar extends bar {
- private $id;
- public $id_ref;
- public function __construct() {
- parent::__construct();
- $this->id_ref = &$this->id;
- }
- }
- $bar = new mega_bar();
- $id = &$bar->id_ref;
- $label = &$bar->foo;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
- var_dump($label);
- var_dump($bar);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- print "done!";
+ print "reference, one level...\n";
+ unset($id); unset($id_ref); unset($label); unset($label_ref);
+ $id = null;
+ $id_ref = &$id;
+ $label = null;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+
+ print "reference, two levels...\n";
+ unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref);
+ $id = null;
+ $id_ref = &$id;
+ $id_ref_ref = &$id_ref;
+ $label = null;
+ $label_ref = &$label;
+ $label_ref_ref = &$label_ref;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref_ref);
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref_ref);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, \$GLOBALS...\n";
+ unset($id); unset($id_ref); unset($label); unset($label_ref);
+ $id = 100;
+ $id_ref = &$GLOBALS['id'];
+ $label = null;
+ $label_ref = &$GLOBALS['label'];
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, same target...\n";
+ $id = null;
+ $label = &$id;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($label);
+
+ print "reference, simple object...\n";
+ unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($obj->label);
+
+
+ print "reference, simple object w reference...\n";
+ unset($id); unset($label); unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+ $id = &$obj->id;
+ $label = &$obj->label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($obj->label);
+
+ print "reference, simple object w reference, change after bind...\n";
+ unset($id); unset($label); unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+ $id = &$obj->id;
+ $label = &$obj->label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $label = &$obj->id;
+ $id = null;
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($id);
+ var_dump($obj->label);
+ var_dump($label);
+
+ print "reference, one level, change after bind...\n";
+ unset($id); unset($label); unset($id_ref); unset($label_ref);
+ $id = null;
+ $id_ref = &$id;
+ $label = null;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $id_ref = 1;
+ $label_ref = 1;
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, circle...\n";
+ unset($id); unset($label_a); unset($label_b);
+ $id = null;
+ $label_a = &$label_b;
+ $label_b = &$label_a;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a)))
+ printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($label_a);
+ var_dump($label_b);
+
+ print "reference, object, forward declaration...\n";
+ unset($bar); unset($id); unset($label_ref);
+ class foo {
+ public $foo;
+ public function __construct() {
+ $this->foo = &$this->bar;
+ }
+ }
+ class bar extends foo {
+ public $bar = null;
+ }
+ $bar = new bar();
+ $id = null;
+ $label_ref = &$bar->bar;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref)))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($bar);
+ var_dump($label_ref);
+
+ print "references, object, private...\n";
+ unset($bar); unset($id); unset($label);
+ class mega_bar extends bar {
+ private $id;
+ public $id_ref;
+ public function __construct() {
+ parent::__construct();
+ $this->id_ref = &$this->id;
+ }
+ }
+ $bar = new mega_bar();
+ $id = &$bar->id_ref;
+ $label = &$bar->foo;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id);
+ var_dump($label);
+ var_dump($bar);
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
index bc623de753..d9b0a67ac0 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
@@ -8,86 +8,86 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function zerofill($offset, $link, $datatype, $insert = 1) {
+ function zerofill($offset, $link, $datatype, $insert = 1) {
- mysqli_query($link, 'ALTER TABLE test DROP zero');
- $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
- if (!mysqli_query($link, $sql)) {
- // no worries - server might not support it
- return true;
- }
+ mysqli_query($link, 'ALTER TABLE test DROP zero');
+ $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
+ if (!mysqli_query($link, $sql)) {
+ // no worries - server might not support it
+ return true;
+ }
- if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
- printf("[%03d] UPDATE failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
+ printf("[%03d] UPDATE failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) {
- printf("[%03d] SELECT failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) {
+ printf("[%03d] SELECT failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $result = null;
- if (!mysqli_stmt_bind_result($stmt, $result)) {
- printf("[%03d] Bind failed, [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
+ $result = null;
+ if (!mysqli_stmt_bind_result($stmt, $result)) {
+ printf("[%03d] Bind failed, [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) {
- printf("[%03d] Execute or fetch failed, [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) {
+ printf("[%03d] Execute or fetch failed, [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
- $res = mysqli_stmt_result_metadata($stmt);
- $meta = mysqli_fetch_fields($res);
- mysqli_stmt_free_result($stmt);
+ $res = mysqli_stmt_result_metadata($stmt);
+ $meta = mysqli_fetch_fields($res);
+ mysqli_stmt_free_result($stmt);
- $meta = $meta[0];
- $length = $meta->length;
- if ($length > strlen($insert)) {
+ $meta = $meta[0];
+ $length = $meta->length;
+ if ($length > strlen($insert)) {
- $expected = str_repeat('0', $length - strlen($insert));
- $expected .= $insert;
- if ($expected !== $result) {
- printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result);
- return false;
- }
+ $expected = str_repeat('0', $length - strlen($insert));
+ $expected .= $insert;
+ if ($expected !== $result) {
+ printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result);
+ return false;
+ }
- } else if ($length <= 1) {
- printf("[%03d] Length reported is too small to run test\n", $offset);
- return false;
- }
+ } else if ($length <= 1) {
+ printf("[%03d] Length reported is too small to run test\n", $offset);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- /*
- We map those to PHP numeric types -
- no padding/filling done. Neither with libmysql nor with mysqlnd.
- zerofill(2, $link, 'TINYINT');
- zerofill(3, $link, 'SMALLINT');
- zerofill(4, $link, 'MEDIUMINT');
- zerofill(5, $link, 'INT');
- zerofill(6, $link, 'INTEGER');
- zerofill(7, $link, 'BIGINT');
- zerofill(8, $link, 'FLOAT');
- zerofill(9, $link, 'DOUBLE');
- zerofill(10, $link, 'DOUBLE PRECISION');
- */
- zerofill(11, $link, 'DECIMAL');
- zerofill(12, $link, 'DEC');
+ /*
+ We map those to PHP numeric types -
+ no padding/filling done. Neither with libmysql nor with mysqlnd.
+ zerofill(2, $link, 'TINYINT');
+ zerofill(3, $link, 'SMALLINT');
+ zerofill(4, $link, 'MEDIUMINT');
+ zerofill(5, $link, 'INT');
+ zerofill(6, $link, 'INTEGER');
+ zerofill(7, $link, 'BIGINT');
+ zerofill(8, $link, 'FLOAT');
+ zerofill(9, $link, 'DOUBLE');
+ zerofill(10, $link, 'DOUBLE PRECISION');
+ */
+ zerofill(11, $link, 'DECIMAL');
+ zerofill(12, $link, 'DEC');
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt
index 4bf67c253c..4cfa78607b 100644
--- a/ext/mysqli/tests/mysqli_stmt_close.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_close.phpt
@@ -8,76 +8,76 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_close()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_close($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // Yes, amazing, eh? AFAIK a work around of a constructor bug...
- if (false !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Yes, amazing, eh? AFAIK a work around of a constructor bug...
+ if (false !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 100; $label = 'z';
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 100; $label = 'z';
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ require('table.inc');
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
index 4a5f99dac4..abb6626889 100644
--- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
@@ -8,78 +8,78 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_data_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_data_seek()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 1)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 1)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
- printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
+ printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_fetch($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
- printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
+ printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_fetch($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (mysqli_stmt_fetch($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
- printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
+ printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
+ printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
index 5043364a66..d35fd437bc 100644
--- a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
@@ -8,51 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
- if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
+ require_once("connect.inc");
+ if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
+ if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
- $c1->query("use $db");
- $c2->query("use $db");
- $c1->query("drop table if exists type_change");
- $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine);
- $c1->query("insert into type_change values (1, 'one'), (2, 'two')");
- $s1 = $c1->prepare("select a from type_change order by a");
- var_dump($s1->execute(), $s1->bind_result($col1));
- echo "---- Row 1\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 2\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 3\n";
- var_dump($s1->fetch());
- echo "----\n";
+ $c1->query("use $db");
+ $c2->query("use $db");
+ $c1->query("drop table if exists type_change");
+ $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine);
+ $c1->query("insert into type_change values (1, 'one'), (2, 'two')");
+ $s1 = $c1->prepare("select a from type_change order by a");
+ var_dump($s1->execute(), $s1->bind_result($col1));
+ echo "---- Row 1\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 2\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 3\n";
+ var_dump($s1->fetch());
+ echo "----\n";
- echo "ALTER\n";
- var_dump($c2->query("alter table type_change drop a"));
- var_dump($s1->execute());
- var_dump($c1->error);
+ echo "ALTER\n";
+ var_dump($c2->query("alter table type_change drop a"));
+ var_dump($s1->execute());
+ var_dump($c1->error);
- echo "---- Row 1\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 2\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 3\n";
- var_dump($s1->fetch());
- echo "----\n";
+ echo "---- Row 1\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 2\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 3\n";
+ var_dump($s1->fetch());
+ echo "----\n";
- echo "done!";
+ echo "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt
index ac992bd058..f80378fd16 100644
--- a/ext/mysqli/tests/mysqli_stmt_errno.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt
@@ -8,56 +8,56 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_errno()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_errno($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // properly initialized?
- if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ // properly initialized?
+ if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- // set after error server?
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+ // set after error server?
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // reset after error & success
- if (0 != ($tmp = mysqli_stmt_errno($stmt)))
- printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
+ // reset after error & success
+ if (0 != ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- // set after client error
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[010] Execting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+ // set after client error
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[010] Execting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt
index 9d22ddc877..606e6153b7 100644
--- a/ext/mysqli/tests/mysqli_stmt_error.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_error.phpt
@@ -8,56 +8,56 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_error()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_error($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // properly initialized?
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ // properly initialized?
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- // set after error server?
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
+ // set after error server?
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
- // reset after error & success
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
+ // reset after error & success
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- // set after client error
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[010] Execting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
+ // set after client error
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[010] Execting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt
index f657810321..1ed0fed7fd 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt
@@ -14,123 +14,123 @@ if (mysqli_get_server_version($link) <= 40100) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_execute()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_execute()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_execute($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_execute($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt));
- // no input variables bound
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ // no input variables bound
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $id = 100;
- $label = "z";
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 100;
+ $label = "z";
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // calling reset between executions
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // calling reset between executions
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?"))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?"))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $limit = 1;
- if (!mysqli_stmt_bind_param($stmt, "i", $limit))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $limit = 1;
+ if (!mysqli_stmt_bind_param($stmt, "i", $limit))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($id !== 1)
- printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id);
+ if ($id !== 1)
+ printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id);
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- if (!mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($id !== 1)
- printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id);
+ if ($id !== 1)
+ printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id);
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump(mysqli_stmt_execute($stmt));
- var_dump(mysqli_stmt_fetch($stmt));
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump(mysqli_stmt_fetch($stmt));
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[028] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[028] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
index 5e421b078d..b26c16f98a 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
@@ -14,172 +14,172 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- /* no result set, one output parameter */
- if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
- printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ /* no result set, one output parameter */
+ if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
+ printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* yes, I really want to call it twice! */
- if (!mysqli_stmt_execute($stmt))
- printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ /* yes, I really want to call it twice! */
+ if (!mysqli_stmt_execute($stmt))
+ printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($version == "unknown") || ($version == ""))
- printf("[018] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (($version == "unknown") || ($version == ""))
+ printf("[018] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (function_exists('mysqli_stmt_get_result')) {
+ if (function_exists('mysqli_stmt_get_result')) {
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- // no result set, one output parameter
- if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
- printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ // no result set, one output parameter
+ if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
+ printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_stmt_get_result($stmt))
- printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$res = mysqli_stmt_get_result($stmt))
+ printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == ""))
- printf("[026] Results seem wrong, got %s, [%d] %s\n",
- $row['_version'],
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == ""))
+ printf("[026] Results seem wrong, got %s, [%d] %s\n",
+ $row['_version'],
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- }
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- // no result set, one input parameter, output parameter
- // yes, I really do not want to bind input values...
- if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)"))
- printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ // no result set, one input parameter, output parameter
+ // yes, I really do not want to bind input values...
+ if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)"))
+ printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version != "myversion")
- printf("[035] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version != "myversion")
+ printf("[035] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- // no result set, one input parameter, output parameter
- // yes, I really do not want to bind input values...
- if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)'))
- printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ // no result set, one input parameter, output parameter
+ // yes, I really do not want to bind input values...
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)'))
+ printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[045] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[045] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
index 78483649c6..86a703c641 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
@@ -14,104 +14,104 @@ if (mysqli_get_server_version($link) < 50503) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) {
- // one result set
- if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
- printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) {
+ // one result set
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
+ printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[009] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[009] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
+ mysqli_stmt_free_result($stmt);
- printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no");
- printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no");
+ printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no");
+ printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no");
- if (!mysqli_stmt_close($stmt))
- printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$link->query("SELECT 1"))
- printf("[013] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1"))
+ printf("[013] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) {
- // two result sets
- if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
- printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) {
+ // two result sets
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
+ printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = NULL;
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = NULL;
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[019] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[019] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_more_results($link) || !mysqli_next_result($link))
- printf("[020] [%d] %s\n", $link->errno, $link->error);
+ if (!mysqli_more_results($link) || !mysqli_next_result($link))
+ printf("[020] [%d] %s\n", $link->errno, $link->error);
- $more = NULL;
- if (!mysqli_stmt_bind_result($stmt, $more) ||
- !mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $more = NULL;
+ if (!mysqli_stmt_bind_result($stmt, $more) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($more !== 1)
- printf("[022] Results seem wrong, got %s, [%d] %s\n",
- $more,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($more !== 1)
+ printf("[022] Results seem wrong, got %s, [%d] %s\n",
+ $more,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$link->query("SELECT 1"))
- printf("[024] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1"))
+ printf("[024] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
index 52c551ffce..d3aea7d7c7 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
@@ -19,49 +19,49 @@ if ($IS_MYSQLND) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)'))
- printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)'))
+ printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $ver_in = 'myversion';
- $ver_out = '';
- if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out))
- printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $ver_in = 'myversion';
+ $ver_out = '';
+ if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out))
+ printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no"));
- printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no"));
+ printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no"));
+ printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no"));
- if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ("myversion" !== $ver_out)
- printf("[011] Results seem wrong got '%s'\n", $ver_out);
+ if ("myversion" !== $ver_out)
+ printf("[011] Results seem wrong got '%s'\n", $ver_out);
- if (!mysqli_stmt_close($stmt))
- printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = $link->query("SELECT 1"))
- printf("[013] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT 1"))
+ printf("[013] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
index d1d5b56965..4ba881a77e 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
@@ -8,82 +8,82 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_fetch()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_fetch($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_fetch($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
- printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
+ printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = NULL;
- $label = NULL;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $id = NULL;
+ $label = NULL;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_kill($link, mysqli_thread_id($link)))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_kill($link, mysqli_thread_id($link)))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[016] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[016] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_fetch()))
+ printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
index 787f7eadd0..6eab51edd8 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
@@ -16,57 +16,57 @@ Fetching BIT column values using the PS API
?>
--FILE--
<?php
- require('connect.inc');
+ require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* NOTE: works only for up to 31 bits! This limitation should be documented. */
- for ($bits = 1; $bits < 32; $bits++) {
- $max_value = pow(2, $bits) - 1;
- $tests = 0;
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+ /* NOTE: works only for up to 31 bits! This limitation should be documented. */
+ for ($bits = 1; $bits < 32; $bits++) {
+ $max_value = pow(2, $bits) - 1;
+ $tests = 0;
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- while ($tests < min($max_value, 20)) {
- $tests++;
- $value = mt_rand(0, $max_value);
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value));
+ while ($tests < min($max_value, 20)) {
+ $tests++;
+ $value = mt_rand(0, $max_value);
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value));
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $_label0 = $label = null;
- $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value);
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt) ||
- !mysqli_stmt_bind_result($stmt, $id, $_label0, $label))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $_label0 = $label = null;
+ $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value);
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt) ||
+ !mysqli_stmt_bind_result($stmt, $id, $_label0, $label))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_fetch($stmt))
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($id !== $_label0) || ($value !== $_label0)) {
- printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label);
- }
- if ($value != $label) {
- printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n",
- $bits, $value, $id, $_label0, $label);
- }
- }
+ if (($id !== $_label0) || ($value !== $_label0)) {
+ printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label);
+ }
+ if ($value != $label) {
+ printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n",
+ $bits, $value, $id, $_label0, $label);
+ }
+ }
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- }
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
index 47d0ac9355..5aaa199383 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
@@ -8,43 +8,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- $bind_res = $id = null;
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
- !mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
- !($fields = mysqli_fetch_fields($result))) {
- printf("FAIL 1\n");
- }
- while (mysqli_stmt_fetch($stmt)) {
- ;
- }
- mysqli_free_result($result);
- mysqli_stmt_close($stmt);
+ $bind_res = $id = null;
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
+ !mysqli_stmt_execute($stmt) ||
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
+ !($fields = mysqli_fetch_fields($result))) {
+ printf("FAIL 1\n");
+ }
+ while (mysqli_stmt_fetch($stmt)) {
+ ;
+ }
+ mysqli_free_result($result);
+ mysqli_stmt_close($stmt);
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
- !mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("FAIL 2\n");
- }
- print "OK: 1\n";
- if (!($fields = mysqli_fetch_fields($result)))
- printf("Aua 3\n");
- print "OK: 2\n";
- while (mysqli_stmt_fetch($stmt)) {
- ;
- }
- mysqli_free_result($result);
- mysqli_stmt_close($stmt);
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
+ !mysqli_stmt_execute($stmt) ||
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("FAIL 2\n");
+ }
+ print "OK: 1\n";
+ if (!($fields = mysqli_fetch_fields($result)))
+ printf("Aua 3\n");
+ print "OK: 2\n";
+ while (mysqli_stmt_fetch($stmt)) {
+ ;
+ }
+ mysqli_free_result($result);
+ mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
index be74f47ce4..8980a91255 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
@@ -11,128 +11,128 @@ mysqli_stmt_fetch - geometry / spatial types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) {
-
- 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
- if (!mysqli_query($link, $sql)) {
- printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
- }
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
- $fields = mysqli_fetch_fields($result);
- if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
- printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
- }
-
- $num = 0;
- $rows = array();
- while (true === @mysqli_stmt_fetch($stmt)) {
- $rows[] = array('id' => $id, 'label' => $bind_res);
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- return false;
- }
- mysqli_stmt_close($stmt);
-
- foreach ($rows as $row) {
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $new_id = $row['id'] + 10;
- if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) {
- printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- mysqli_stmt_close($stmt);
-
- if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
- $new_id))) {
- printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
- printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($row_normal['label'] != $row['label']) {
- printf("[%04d] PS and non-PS return different data.\n", $offset + 16);
- return false;
- }
- mysqli_free_result($res_normal);
- }
-
- return true;
- }
-
- $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
- func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
- func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
- func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
- func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
- func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) {
+
+ 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+ $fields = mysqli_fetch_fields($result);
+ if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
+ printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
+ }
+
+ $num = 0;
+ $rows = array();
+ while (true === @mysqli_stmt_fetch($stmt)) {
+ $rows[] = array('id' => $id, 'label' => $bind_res);
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ foreach ($rows as $row) {
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $new_id = $row['id'] + 10;
+ if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) {
+ printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
+ $new_id))) {
+ printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
+ printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($row_normal['label'] != $row['label']) {
+ printf("[%04d] PS and non-PS return different data.\n", $offset + 16);
+ return false;
+ }
+ mysqli_free_result($res_normal);
+ }
+
+ return true;
+ }
+
+ $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
+ func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
+ func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
+ func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
+ func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
+ func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
index 9dfded6a31..588d94d2ba 100644
--- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
@@ -8,80 +8,80 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_field_count()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_field_count($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init($link);
+ if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_prepare($stmt, ''))
- printf("[004] Prepare should fail for an empty statement\n");
+ if (mysqli_stmt_prepare($stmt, ''))
+ printf("[004] Prepare should fail for an empty statement\n");
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- $label = null;
- if (mysqli_stmt_bind_param($stmt, "s", $label))
- printf("[014] expected error - got ok\n");
- while (mysqli_stmt_fetch($stmt))
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ $label = null;
+ if (mysqli_stmt_bind_param($stmt, "s", $label))
+ printf("[014] expected error - got ok\n");
+ while (mysqli_stmt_fetch($stmt))
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
- printf("[020] Prepare should fail, statement has been closed\n");
+ if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
+ printf("[020] Prepare should fail, statement has been closed\n");
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
index 09016bf8a5..2c7ca6f28d 100644
--- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
@@ -8,71 +8,71 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_free_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_free_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
index e4cf8f8cf6..712537a10b 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
@@ -11,118 +11,118 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_get_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_get_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
- printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
+ printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (is_object($tmp = mysqli_stmt_store_result($stmt)))
- printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (is_object($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
- printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
+ printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
- printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- mysqli_free_result($tmp);
- mysqli_stmt_close($stmt);
+ mysqli_free_result($tmp);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // stmt object status test
+ if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_execute($stmt))
- printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
- printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) {
- printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
- printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- }
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) {
+ printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
+ printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ }
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = NULL;
- $label = NULL;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ $id = NULL;
+ $label = NULL;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
// get_result cannot be used in PS cursor mode
if (!$stmt = mysqli_stmt_init($link))
@@ -185,20 +185,20 @@ if (!function_exists('mysqli_stmt_get_result'))
}
mysqli_free_result($result);
- if (!mysqli_kill($link, mysqli_thread_id($link)))
- printf("[042] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_kill($link, mysqli_thread_id($link)))
+ printf("[042] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[043] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[043] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[044] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[044] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
index 2d9339e032..ff66018712 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
@@ -10,146 +10,146 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_null($tmp = @mysqli_stmt_get_result($stmt, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[008] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_execute($stmt);
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[013] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $row = mysqli_fetch_assoc($res);
- if (NULL !== $id || NULL !== $label)
- printf("[021] Bound variables should not have been set\n");
- mysqli_free_result($res);
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
- printf("[024] Unknown result set type %s\n", $res->type);
- }
- if ($res->type !== MYSQLI_STORE_RESULT)
- printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type);
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[026] Expecting false got %s/%s\n",
- gettype($res), $res);
- }
-
- print "done!";
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_get_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_get_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_null($tmp = @mysqli_stmt_get_result($stmt, "foo")))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[008] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_execute($stmt);
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[013] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $row = mysqli_fetch_assoc($res);
+ if (NULL !== $id || NULL !== $label)
+ printf("[021] Bound variables should not have been set\n");
+ mysqli_free_result($res);
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
+ printf("[024] Unknown result set type %s\n", $res->type);
+ }
+ if ($res->type !== MYSQLI_STORE_RESULT)
+ printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type);
+
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[026] Expecting false got %s/%s\n",
+ gettype($res), $res);
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
index b05d2abe5e..dbc2876a15 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
@@ -20,110 +20,110 @@ Fetching BIT column values using the PS API
?>
--FILE--
<?php
- require('connect.inc');
-
- function dec32bin($dec, $bits) {
-
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- for ($bits = 1; $bits <= 46; $bits++) {
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
-
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
-
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
-
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
-
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value);
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$res = mysqli_stmt_get_result($stmt))
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
- printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
-
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
-
- }
-
- mysqli_stmt_close($stmt);
-
- }
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+
+ function dec32bin($dec, $bits) {
+
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ for ($bits = 1; $bits <= 46; $bits++) {
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
+
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
+
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
+
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value);
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$res = mysqli_stmt_get_result($stmt))
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
+ printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
+
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+
+ }
+
+ mysqli_stmt_close($stmt);
+
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
index d44aaa6f89..56431784a6 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
@@ -11,35 +11,35 @@ mysqli_stmt_get_result() - meta data, field_count()
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- printf("%s %s\n",
- $res_meta->field_count,
- $res->field_count);
+ printf("%s %s\n",
+ $res_meta->field_count,
+ $res->field_count);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
index 3e656aacba..c06d1d5218 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
@@ -14,127 +14,127 @@ mysqli_stmt_get_result - geometry / spatial types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) {
-
- 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
- if (!mysqli_query($link, $sql)) {
- printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
- }
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- if (!$res = mysqli_stmt_get_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
- $fields = mysqli_fetch_fields($result);
- if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
- printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
- }
-
- $num = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- $bind_res = &$row['label'];
-
- if (!$stmt2 = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
-
- $id = $row['id'] + 10;
- if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt2)) {
- printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
- mysqli_stmt_close($stmt2);
-
- if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
- $row['id'] + 10))) {
- printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
- printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($row_normal['label'] != $bind_res) {
- printf("[%04d] PS and non-PS return different data.\n", $offset + 17);
- return false;
- }
- mysqli_free_result($res_normal);
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
-
- return true;
- }
-
- $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
- func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
- func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
- func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
- func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
- func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) {
+
+ 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ if (!$res = mysqli_stmt_get_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+ $fields = mysqli_fetch_fields($result);
+ if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
+ printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
+ }
+
+ $num = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ $bind_res = &$row['label'];
+
+ if (!$stmt2 = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+
+ $id = $row['id'] + 10;
+ if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt2)) {
+ printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+ mysqli_stmt_close($stmt2);
+
+ if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
+ $row['id'] + 10))) {
+ printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
+ printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($row_normal['label'] != $bind_res) {
+ printf("[%04d] PS and non-PS return different data.\n", $offset + 17);
+ return false;
+ }
+ mysqli_free_result($res_normal);
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+
+ return true;
+ }
+
+ $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
+ func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
+ func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
+ func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
+ func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
+ func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
index d3afbba561..e2011c1f96 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
@@ -11,199 +11,199 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- var_dump(mysqli_fetch_assoc($res));
- var_dump(mysqli_fetch_assoc($res_meta));
-
- mysqli_free_result($res);
- mysqli_free_result($res_meta);
- mysqli_stmt_close($stmt);
-
- // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") ||
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) {
- printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
- }
-
- /*
- if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count()))
- printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
-
- if (($tmp1 = $res_meta->field_count()) !== $tmp2)
- printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
- */
-
- if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field))
- printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
-
- if (0 !== $tmp1)
- printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1);
-
- $fields = array();
- while ($info = $res->fetch_field())
- $fields['res'][] = $info;
- var_dump($info);
- while ($info = $res_meta->fetch_field())
- $fields['meta'][] = $info;
- var_dump($info);
- $fields['all_res'] = $res->fetch_fields();
- $fields['all_meta'] = $res_meta->fetch_fields();
-
- if (count($fields['res']) != count($fields['meta'])) {
- printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n",
- count($fields['res']),
- count($fields['meta']));
- }
-
- foreach ($fields['res'] as $k => $info) {
- printf("%s\n", $info->name);
- if ($info->name !== $fields['meta'][$k]->name)
- printf("[015 - %d] Expecting name %s/%s got %s/%s\n",
- $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name);
-
- if ($info->orgname !== $fields['meta'][$k]->orgname)
- printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n",
- $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname);
-
- if ($info->table !== $fields['meta'][$k]->table)
- printf("[017 - %d] Expecting table %s/%s got %s/%s\n",
- $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table);
-
- if ($info->orgtable !== $fields['meta'][$k]->orgtable)
- printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n",
- $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable);
-
- if ($info->def !== $fields['meta'][$k]->def)
- printf("[019 - %d] Expecting def %s/%s got %s/%s\n",
- $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def);
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ var_dump(mysqli_fetch_assoc($res));
+ var_dump(mysqli_fetch_assoc($res_meta));
+
+ mysqli_free_result($res);
+ mysqli_free_result($res_meta);
+ mysqli_stmt_close($stmt);
+
+ // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") ||
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) {
+ printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+ }
+
+ /*
+ if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count()))
+ printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+
+ if (($tmp1 = $res_meta->field_count()) !== $tmp2)
+ printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+ */
+
+ if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field))
+ printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+
+ if (0 !== $tmp1)
+ printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1);
+
+ $fields = array();
+ while ($info = $res->fetch_field())
+ $fields['res'][] = $info;
+ var_dump($info);
+ while ($info = $res_meta->fetch_field())
+ $fields['meta'][] = $info;
+ var_dump($info);
+ $fields['all_res'] = $res->fetch_fields();
+ $fields['all_meta'] = $res_meta->fetch_fields();
+
+ if (count($fields['res']) != count($fields['meta'])) {
+ printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n",
+ count($fields['res']),
+ count($fields['meta']));
+ }
+
+ foreach ($fields['res'] as $k => $info) {
+ printf("%s\n", $info->name);
+ if ($info->name !== $fields['meta'][$k]->name)
+ printf("[015 - %d] Expecting name %s/%s got %s/%s\n",
+ $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name);
+
+ if ($info->orgname !== $fields['meta'][$k]->orgname)
+ printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n",
+ $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname);
+
+ if ($info->table !== $fields['meta'][$k]->table)
+ printf("[017 - %d] Expecting table %s/%s got %s/%s\n",
+ $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table);
+
+ if ($info->orgtable !== $fields['meta'][$k]->orgtable)
+ printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n",
+ $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable);
+
+ if ($info->def !== $fields['meta'][$k]->def)
+ printf("[019 - %d] Expecting def %s/%s got %s/%s\n",
+ $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def);
/*
- if ($info->max_length !== $fields['meta'][$k]->max_length)
- printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n",
- $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length);
+ if ($info->max_length !== $fields['meta'][$k]->max_length)
+ printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n",
+ $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length);
*/
- if ($info->length !== $fields['meta'][$k]->length)
- printf("[021 - %d] Expecting length %s/%s got %s/%s\n",
- $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length);
-
- if ($info->charsetnr !== $fields['meta'][$k]->charsetnr)
- printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n",
- $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr);
-
- if ($info->flags !== $fields['meta'][$k]->flags)
- printf("[023 - %d] Expecting flags %s/%s got %s/%s\n",
- $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags);
-
- if ($info->type !== $fields['meta'][$k]->type)
- printf("[024 - %d] Expecting type %s/%s got %s/%s\n",
- $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type);
-
- if ($info->decimals !== $fields['meta'][$k]->decimals)
- printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n",
- $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals);
-
- /* Make them equal for the check */
- $tmp = $fields['all_res'][$k]->max_length;
- $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length;
-
- if ($fields['all_res'][$k] != $fields['all_meta'][$k]) {
- printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k);
- var_dump($fields['all_res'][$k]);
- var_dump($fields['all_meta'][$k]);
- }
- $fields['all_res'][$k]->max_length = $tmp;
- }
-
- $num = count($fields['res']);
- for ($i = 0; $i < 100; $i++) {
- $pos = mt_rand(-1, $num + 1);
- if ($pos >= 0 && $pos < $num) {
- if (true !== mysqli_field_seek($res, $pos))
- printf("[027] field_seek(res) failed\n");
- if (true !== $res_meta->field_seek($pos))
- printf("[028] field_seek(res__meta) failed\n");
-
- $tmp1 = $res->fetch_field();
- $tmp2 = mysqli_fetch_field($res_meta);
- $tmp2->max_length = $tmp1->max_length;
- if ($tmp1 != $tmp2) {
- printf("[029] Field info differs, dumping data\n");
- var_dump($tmp1);
- var_dump($tmp2);
- }
-
- if ($tmp1 != $fields['res'][$pos]) {
- printf("[030] Field info differs, dumping data\n");
- var_dump($tmp1);
- var_dump($fields['res'][$pos]);
- }
-
- $pos++;
- if ($pos !== ($tmp = mysqli_field_tell($res)))
- printf("[031] Expecting %s/%s got %s/%s\n",
- gettype($pos), $pos, gettype($tmp), $tmp);
-
- if ($pos !== ($tmp = mysqli_field_tell($res_meta)))
- printf("[032] Expecting %s/%s got %s/%s\n",
- gettype($pos), $pos, gettype($tmp), $tmp);
- } else {
-
- if (false !== @mysqli_field_seek($res, $pos))
- printf("[033] field_seek(%d) did not fail\n", $pos);
- if (false !== @mysqli_field_seek($res_meta, $pos))
- printf("[034] field_seek(%d) did not fail\n", $pos);
- }
- }
-
- $res->free_result();
- mysqli_free_result($res_meta);
-
- var_dump(mysqli_fetch_field($res));
-
- mysqli_stmt_close($stmt);
-
- var_dump(mysqli_fetch_field($res));
-
- mysqli_close($link);
-
- var_dump(mysqli_fetch_field($res));
-
- print "done!";
+ if ($info->length !== $fields['meta'][$k]->length)
+ printf("[021 - %d] Expecting length %s/%s got %s/%s\n",
+ $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length);
+
+ if ($info->charsetnr !== $fields['meta'][$k]->charsetnr)
+ printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n",
+ $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr);
+
+ if ($info->flags !== $fields['meta'][$k]->flags)
+ printf("[023 - %d] Expecting flags %s/%s got %s/%s\n",
+ $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags);
+
+ if ($info->type !== $fields['meta'][$k]->type)
+ printf("[024 - %d] Expecting type %s/%s got %s/%s\n",
+ $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type);
+
+ if ($info->decimals !== $fields['meta'][$k]->decimals)
+ printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n",
+ $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals);
+
+ /* Make them equal for the check */
+ $tmp = $fields['all_res'][$k]->max_length;
+ $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length;
+
+ if ($fields['all_res'][$k] != $fields['all_meta'][$k]) {
+ printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k);
+ var_dump($fields['all_res'][$k]);
+ var_dump($fields['all_meta'][$k]);
+ }
+ $fields['all_res'][$k]->max_length = $tmp;
+ }
+
+ $num = count($fields['res']);
+ for ($i = 0; $i < 100; $i++) {
+ $pos = mt_rand(-1, $num + 1);
+ if ($pos >= 0 && $pos < $num) {
+ if (true !== mysqli_field_seek($res, $pos))
+ printf("[027] field_seek(res) failed\n");
+ if (true !== $res_meta->field_seek($pos))
+ printf("[028] field_seek(res__meta) failed\n");
+
+ $tmp1 = $res->fetch_field();
+ $tmp2 = mysqli_fetch_field($res_meta);
+ $tmp2->max_length = $tmp1->max_length;
+ if ($tmp1 != $tmp2) {
+ printf("[029] Field info differs, dumping data\n");
+ var_dump($tmp1);
+ var_dump($tmp2);
+ }
+
+ if ($tmp1 != $fields['res'][$pos]) {
+ printf("[030] Field info differs, dumping data\n");
+ var_dump($tmp1);
+ var_dump($fields['res'][$pos]);
+ }
+
+ $pos++;
+ if ($pos !== ($tmp = mysqli_field_tell($res)))
+ printf("[031] Expecting %s/%s got %s/%s\n",
+ gettype($pos), $pos, gettype($tmp), $tmp);
+
+ if ($pos !== ($tmp = mysqli_field_tell($res_meta)))
+ printf("[032] Expecting %s/%s got %s/%s\n",
+ gettype($pos), $pos, gettype($tmp), $tmp);
+ } else {
+
+ if (false !== @mysqli_field_seek($res, $pos))
+ printf("[033] field_seek(%d) did not fail\n", $pos);
+ if (false !== @mysqli_field_seek($res_meta, $pos))
+ printf("[034] field_seek(%d) did not fail\n", $pos);
+ }
+ }
+
+ $res->free_result();
+ mysqli_free_result($res_meta);
+
+ var_dump(mysqli_fetch_field($res));
+
+ mysqli_stmt_close($stmt);
+
+ var_dump(mysqli_fetch_field($res));
+
+ mysqli_close($link);
+
+ var_dump(mysqli_fetch_field($res));
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
index 1486b1a9fc..a5146c3c9b 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
@@ -11,55 +11,55 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- $charsetInfo = mysqli_get_charset($link);
+ $charsetInfo = mysqli_get_charset($link);
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") ||
- !mysqli_stmt_execute($stmt))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- $i = 0;
- while ($field = $res->fetch_field()) {
- var_dump($field);
- $i++;
- if (2 == $i) {
- /*
- Label column, result set charset.
- All of the following columns are "too hot" - too server dependent
- */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset,
- $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $field->max_length);
- }
- }
- }
+ $i = 0;
+ while ($field = $res->fetch_field()) {
+ var_dump($field);
+ $i++;
+ if (2 == $i) {
+ /*
+ Label column, result set charset.
+ All of the following columns are "too hot" - too server dependent
+ */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $field->max_length);
+ }
+ }
+ }
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
index b6f02d0f6c..c9f0e455ec 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
@@ -11,81 +11,81 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require('table.inc');
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('SHOW ENGINES') ||
- !$stmt->execute())
- printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('SHOW ENGINES') ||
+ !$stmt->execute())
+ printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- $engines = mysqli_fetch_all($res, MYSQLI_NUM);
- if (empty($engines)) {
- printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
- } else {
- $found = false;
- foreach ($engines as $k => $engine)
- foreach ($engine as $k => $v)
- if (stristr($v, 'MyISAM')) {
- $found = true;
- break;
- }
- if (!$found)
- printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
- }
- mysqli_free_result($res);
- }
+ $engines = mysqli_fetch_all($res, MYSQLI_NUM);
+ if (empty($engines)) {
+ printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
+ } else {
+ $found = false;
+ foreach ($engines as $k => $engine)
+ foreach ($engine as $k => $v)
+ if (stristr($v, 'MyISAM')) {
+ $found = true;
+ break;
+ }
+ if (!$found)
+ printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
+ }
+ mysqli_free_result($res);
+ }
- if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('DESCRIBE test id') ||
- !$stmt->execute())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('DESCRIBE test id') ||
+ !$stmt->execute())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
- $description = mysqli_fetch_assoc($res);
- if ($description['Field'] != 'id') {
- printf("[008] Returned data seems wrong, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($description);
- }
- mysqli_free_result($res);
- }
+ $description = mysqli_fetch_assoc($res);
+ if ($description['Field'] != 'id') {
+ printf("[008] Returned data seems wrong, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($description);
+ }
+ mysqli_free_result($res);
+ }
- if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('EXPLAIN SELECT id FROM test') ||
- !$stmt->execute())
- printf("[009] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('EXPLAIN SELECT id FROM test') ||
+ !$stmt->execute())
+ printf("[009] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
- $tmp = mysqli_fetch_assoc($res);
- if (empty($tmp))
- printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- }
- mysqli_close($link);
+ $tmp = mysqli_fetch_assoc($res);
+ if (empty($tmp))
+ printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+ }
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
index bc365c6ad5..4f139fbc67 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
@@ -11,107 +11,107 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (3 !== $res->num_rows)
- printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows);
-
- if (2 !== $res->field_count)
- printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count);
-
- if (0 !== $res->current_field)
- printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field);
-
- for ($i = 2; $i > 0; $i--) {
- if (!$res->data_seek($i))
- printf("[007] Cannot seek to position %d, [%d] %s\n",
- $i, mysqli_stmt_errno($stmt), $stmt->error);
- $row = $res->fetch_array(MYSQLI_BOTH);
- if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) {
- printf("[008] Record looks wrong, dumping data\n");
- var_dump($row);
- } else {
- unset($row[0]);
- unset($row['id']);
- }
- if ($row[1] !== $row['label']) {
- printf("[009] Record looks wrong, dumping data\n");
- var_dump($row);
- } else {
- unset($row[1]);
- unset($row['label']);
- }
- if (!empty($row)) {
- printf("[010] Not empty, dumping unexpected data\n");
- var_dump($row);
- }
- }
-
- if (false !== ($tmp = $res->data_seek(-1)))
- printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $res->data_seek($res->num_rows + 1)))
- printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- for ($i = 0; $i < 100; $i++) {
- /* intentionally out of range! */
- $pos = mt_rand(-1, 4);
- $tmp = mysqli_data_seek($res, $pos);
- if (($pos >= 0 && $pos < 3)) {
- if (true !== $tmp)
- printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
- $row = $res->fetch_array(MYSQLI_NUM);
- if ($row[0] !== $pos + 1)
- printf("[016] Expecting id = %d for pos %d got %s/%s\n",
- $pos + 1, $pos, gettype($row[0]), $row[0]);
- } else {
- if (false !== $tmp)
- printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp);
- }
- }
-
- mysqli_stmt_close($stmt);
-
- if (true !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_array($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[017] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[018] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[019] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[020] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (3 !== $res->num_rows)
+ printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows);
+
+ if (2 !== $res->field_count)
+ printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count);
+
+ if (0 !== $res->current_field)
+ printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field);
+
+ for ($i = 2; $i > 0; $i--) {
+ if (!$res->data_seek($i))
+ printf("[007] Cannot seek to position %d, [%d] %s\n",
+ $i, mysqli_stmt_errno($stmt), $stmt->error);
+ $row = $res->fetch_array(MYSQLI_BOTH);
+ if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) {
+ printf("[008] Record looks wrong, dumping data\n");
+ var_dump($row);
+ } else {
+ unset($row[0]);
+ unset($row['id']);
+ }
+ if ($row[1] !== $row['label']) {
+ printf("[009] Record looks wrong, dumping data\n");
+ var_dump($row);
+ } else {
+ unset($row[1]);
+ unset($row['label']);
+ }
+ if (!empty($row)) {
+ printf("[010] Not empty, dumping unexpected data\n");
+ var_dump($row);
+ }
+ }
+
+ if (false !== ($tmp = $res->data_seek(-1)))
+ printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $res->data_seek($res->num_rows + 1)))
+ printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+ if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1)))
+ printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+
+ for ($i = 0; $i < 100; $i++) {
+ /* intentionally out of range! */
+ $pos = mt_rand(-1, 4);
+ $tmp = mysqli_data_seek($res, $pos);
+ if (($pos >= 0 && $pos < 3)) {
+ if (true !== $tmp)
+ printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
+ $row = $res->fetch_array(MYSQLI_NUM);
+ if ($row[0] !== $pos + 1)
+ printf("[016] Expecting id = %d for pos %d got %s/%s\n",
+ $pos + 1, $pos, gettype($row[0]), $row[0]);
+ } else {
+ if (false !== $tmp)
+ printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp);
+ }
+ }
+
+ mysqli_stmt_close($stmt);
+
+ if (true !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_array($row = $res->fetch_array(MYSQLI_NUM)))
+ printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_free_result($res);
+
+ if (false !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[017] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
+ printf("[018] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ if (false !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[019] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
+ printf("[020] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
index bde61c3706..297ca2b4bc 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
@@ -11,243 +11,243 @@ mysqli_stmt_get_result - data types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = null;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_stmt_init($link);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
-
- if (!$res = mysqli_stmt_get_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- $num = 0;
- $fields = mysqli_fetch_fields($result);
-
- while ($row = mysqli_fetch_assoc($res)) {
- $bind_res = &$row['label'];
- if (!gettype($bind_res) == 'unicode') {
- if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
- printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
- $offset + 10, $num,
- gettype($bind_value), $bind_value, $type_hint,
- gettype($bind_res), $bind_res);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return true;
- }
-
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
-
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
-
- /* test is broken too: we bind "integer" but value is a float
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
- */
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
- func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
- func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
-
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
-
- // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020);
-
- $tmp = intval(@date('Y'));
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580);
- func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string');
- func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
- func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
-
- /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
- func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660);
- func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
-
- func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = 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, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = null;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ mysqli_stmt_close($stmt);
+
+ $stmt = mysqli_stmt_init($link);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+
+ if (!$res = mysqli_stmt_get_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ $num = 0;
+ $fields = mysqli_fetch_fields($result);
+
+ while ($row = mysqli_fetch_assoc($res)) {
+ $bind_res = &$row['label'];
+ if (!gettype($bind_res) == 'unicode') {
+ if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
+ printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
+ $offset + 10, $num,
+ gettype($bind_value), $bind_value, $type_hint,
+ gettype($bind_res), $bind_res);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
+
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
+
+ /* test is broken too: we bind "integer" but value is a float
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
+ */
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
+
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
+
+ // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020);
+
+ $tmp = intval(@date('Y'));
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580);
+ func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
+ func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
+
+ /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
+ func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660);
+ func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
index a4a046dc7d..f63cb63196 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
@@ -24,79 +24,79 @@ mysqli_query($link, "DROP TABLE IF EXISTS test");
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_get_warnings()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_get_warnings($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") ||
- !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($warning = mysqli_stmt_get_warnings($stmt)))
- printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning);
+ if (!is_object($warning = mysqli_stmt_get_warnings($stmt)))
+ printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning);
- if ('mysqli_warning' !== get_class($warning))
- printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning));
+ if ('mysqli_warning' !== get_class($warning))
+ printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning));
- if (!method_exists($warning, 'next'))
- printf("[013] Object mysqli_warning seems to lack method next()\n");
+ if (!method_exists($warning, 'next'))
+ printf("[013] Object mysqli_warning seems to lack method next()\n");
- $i = 0;
- do {
+ $i = 0;
+ do {
- if ('' == $warning->message)
- printf("[014 - %d] Message should not be empty\n", $i);
+ if ('' == $warning->message)
+ printf("[014 - %d] Message should not be empty\n", $i);
- if ('' == $warning->sqlstate)
- printf("[015 - %d] SQL State should not be empty\n", $i);
+ if ('' == $warning->sqlstate)
+ printf("[015 - %d] SQL State should not be empty\n", $i);
- if (0 == $warning->errno)
- printf("[016 - %d] Error number should not be zero\n", $i);
+ if (0 == $warning->errno)
+ printf("[016 - %d] Error number should not be zero\n", $i);
- $i++;
+ $i++;
- } while ($warning->next());
+ } while ($warning->next());
- if (2 != $i)
- printf("[017] Expected 2 warnings, got %d warnings\n", $i);
+ if (2 != $i)
+ printf("[017] Expected 2 warnings, got %d warnings\n", $i);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt
index 6ec1a4c038..cba2245d8a 100644
--- a/ext/mysqli/tests/mysqli_stmt_init.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_init.phpt
@@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_init()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_init()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_init($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_init($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_object($stmt = mysqli_stmt_init($link)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object($stmt = mysqli_stmt_init($link)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($stmt2 = @mysqli_stmt_init($link)))
- printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object($stmt2 = @mysqli_stmt_init($link)))
+ printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (NULL !== ($tmp = mysqli_stmt_init($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_stmt_init($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_stmt_init($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_init($link)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
index f70cc1a171..2853d84d7a 100644
--- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
@@ -8,64 +8,64 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_insert_id()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $stmt = @new mysqli_stmt($link);
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = @new mysqli_stmt($link);
+ if (!is_null($tmp = @mysqli_insert_id($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = @mysqli_stmt_insert_id($stmt)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init($link);
+ if (false !== ($tmp = @mysqli_stmt_insert_id($stmt)))
+ printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- // no auto_increment column
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ // no auto_increment column
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_get_server_version($link) > 50000 &&
- (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") ||
- !mysqli_stmt_execute($stmt))) {
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- } else if (mysqli_get_server_version($link) < 50000){
- mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT");
- }
+ if (mysqli_get_server_version($link) > 50000 &&
+ (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") ||
+ !mysqli_stmt_execute($stmt))) {
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ } else if (mysqli_get_server_version($link) < 50000){
+ mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT");
+ }
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (0 === ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (0 === ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_stmt_insert_id($stmt));
+ var_dump(mysqli_stmt_insert_id($stmt));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_multires.phpt b/ext/mysqli/tests/mysqli_stmt_multires.phpt
index 084361ef11..73af79e2b1 100644
--- a/ext/mysqli/tests/mysqli_stmt_multires.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_multires.phpt
@@ -11,86 +11,86 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
- printf("[001] [%d] %s\n", $link->error, $link->errno);
- }
-
- if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
- printf("[002] [%d] %s\n", $link->error, $link->errno);
- }
-
- if (!($stmt = $link->prepare("CALL p123"))) {
- printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- if (!$stmt->execute()) {
- printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- $c_id = NULL;
- $c_label = NULL;
- if (!$stmt->bind_result($c_id, $c_label)) {
- printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
- }
- var_dump("pre:",$c_id, $c_label);
-
- if (!$stmt->fetch()) {
- printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- var_dump("post:",$c_id, $c_label);
-
- if ($stmt->fetch()) {
- printf("[007] Shouldn't have fetched anything\n");
- var_dump($c_id, $c_label);
- }
-
- if ($stmt->fetch()) {
- printf("[008] No more rows expected\n");
- }
-
- if (!$stmt->more_results()) {
- printf("[009] Expected more results\n");
- } else {
- var_dump("[009] next_result:", $stmt->next_result());
- }
-
- if (!$stmt->bind_result($c_id, $c_label)) {
- printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
- }
- var_dump("pre:",$c_id, $c_label);
-
- if (!$stmt->fetch()) {
- printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- var_dump("post:",$c_id, $c_label);
-
- if ($stmt->fetch()) {
- printf("[012] No more rows expected\n");
- }
-
- if (!$stmt->more_results()) {
- printf("[013] Expected more results\n");
- } else {
- var_dump("[013] next_result:", $stmt->next_result());
- }
-
- if ($stmt->more_results()) {
- printf("[014] No more results expected\n");
- } else {
- printf("[014] No result, as expected\n");
- }
-
- $stmt->close();
- $link->close();
-
-
- echo "done";
+ require_once("connect.inc");
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
+ printf("[001] [%d] %s\n", $link->error, $link->errno);
+ }
+
+ if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
+ printf("[002] [%d] %s\n", $link->error, $link->errno);
+ }
+
+ if (!($stmt = $link->prepare("CALL p123"))) {
+ printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ if (!$stmt->execute()) {
+ printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ $c_id = NULL;
+ $c_label = NULL;
+ if (!$stmt->bind_result($c_id, $c_label)) {
+ printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+ var_dump("pre:",$c_id, $c_label);
+
+ if (!$stmt->fetch()) {
+ printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ var_dump("post:",$c_id, $c_label);
+
+ if ($stmt->fetch()) {
+ printf("[007] Shouldn't have fetched anything\n");
+ var_dump($c_id, $c_label);
+ }
+
+ if ($stmt->fetch()) {
+ printf("[008] No more rows expected\n");
+ }
+
+ if (!$stmt->more_results()) {
+ printf("[009] Expected more results\n");
+ } else {
+ var_dump("[009] next_result:", $stmt->next_result());
+ }
+
+ if (!$stmt->bind_result($c_id, $c_label)) {
+ printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+ var_dump("pre:",$c_id, $c_label);
+
+ if (!$stmt->fetch()) {
+ printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ var_dump("post:",$c_id, $c_label);
+
+ if ($stmt->fetch()) {
+ printf("[012] No more rows expected\n");
+ }
+
+ if (!$stmt->more_results()) {
+ printf("[013] Expected more results\n");
+ } else {
+ var_dump("[013] next_result:", $stmt->next_result());
+ }
+
+ if ($stmt->more_results()) {
+ printf("[014] No more results expected\n");
+ } else {
+ printf("[014] No result, as expected\n");
+ }
+
+ $stmt->close();
+ $link->close();
+
+
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
index 682ab7bc92..77f567c41d 100644
--- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
@@ -8,104 +8,104 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) {
-
- if (!mysqli_stmt_prepare($stmt, $query)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_store_result($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
-
- mysqli_stmt_free_result($stmt);
-
- return true;
- }
-
- func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10);
- func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20);
- // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly
- // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL
- // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but
- // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP
- // users do.
- func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30);
-
- if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40);
- } else {
- printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
- printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (mysqli_stmt_execute($stmt)) {
-
- $i = 0;
- do {
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp);
- $i++;
- } while (mysqli_stmt_fetch($stmt));
-
- /* NOTE to users
- Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210
- Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement
- any behaviour they like, including the one checked for in this test.
- What the test does is cover an implementation detail of the mysqlnd library.
- This implementation detail may, at any time, change without prior notice.
- On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine
- day, after Klingons visited earh, becomes the official one. Meanwhile do
- not rely on it.
- */
- if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt))))
- printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp);
-
- } else {
- printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[056] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_num_rows()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_num_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) {
+
+ if (!mysqli_stmt_prepare($stmt, $query)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_store_result($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
+
+ mysqli_stmt_free_result($stmt);
+
+ return true;
+ }
+
+ func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10);
+ func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20);
+ // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly
+ // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL
+ // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but
+ // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP
+ // users do.
+ func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30);
+
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40);
+ } else {
+ printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
+ printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (mysqli_stmt_execute($stmt)) {
+
+ $i = 0;
+ do {
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp);
+ $i++;
+ } while (mysqli_stmt_fetch($stmt));
+
+ /* NOTE to users
+ Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210
+ Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement
+ any behaviour they like, including the one checked for in this test.
+ What the test does is cover an implementation detail of the mysqlnd library.
+ This implementation detail may, at any time, change without prior notice.
+ On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine
+ day, after Klingons visited earh, becomes the official one. Meanwhile do
+ not rely on it.
+ */
+ if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt))))
+ printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp);
+
+ } else {
+ printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_close($stmt);
+
+ if (false !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[056] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
index f3c0064541..f19f7932f9 100644
--- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
@@ -8,57 +8,57 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_param_count()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_param_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_param_count($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) {
+ function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) {
- if (!mysqli_stmt_prepare($stmt, $query)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt));
- return false;
- }
+ if (!mysqli_stmt_prepare($stmt, $query)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt));
+ return false;
+ }
- if ($expected !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
- return true;
- }
+ if ($expected !== ($tmp = mysqli_stmt_param_count($stmt)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
+ return true;
+ }
- func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40);
+ func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[40] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
+ printf("[40] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[041] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_param_count()))
+ printf("[041] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
index ff4fdd8c81..e7917e8ed2 100644
--- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
@@ -8,44 +8,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_prepare()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_prepare($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_stmt_prepare($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_stmt_prepare($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_prepare($stmt, "SELECT id FROM test")))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_prepare($stmt, "SELECT id FROM test")))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt
index 0a94491f47..a399272b50 100644
--- a/ext/mysqli/tests/mysqli_stmt_reset.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt
@@ -8,96 +8,96 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_reset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_reset()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_reset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_reset($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
- printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
+ printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_fetch($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($id);
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)"))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)"))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "b", $label))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "b", $label))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $label = 'abc';
- for ($i = 0; $i < 10; $i++) {
- if (!mysqli_stmt_send_long_data($stmt, 0, $label))
- printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ $label = 'abc';
+ for ($i = 0; $i < 10; $i++) {
+ if (!mysqli_stmt_send_long_data($stmt, 0, $label))
+ printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!mysqli_stmt_reset($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_reset($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SELECT label FROM test"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT label FROM test"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if ($row['label'] != '')
- printf("[020] Expecting empty string, got string/%s\n", $row['label']);
+ if ($row['label'] != '')
+ printf("[020] Expecting empty string, got string/%s\n", $row['label']);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
index 4b0551082a..32ec9c0b34 100644
--- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
@@ -8,90 +8,90 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_result_metadata()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_result_metadata($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_result_metadata($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
+ printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object(($res = mysqli_stmt_result_metadata($stmt))))
- printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object(($res = mysqli_stmt_result_metadata($stmt))))
+ printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp);
- if (2 !== ($tmp = mysqli_num_fields($res)))
- printf("[007] Expecting int/2, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (2 !== ($tmp = mysqli_num_fields($res)))
+ printf("[007] Expecting int/2, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!is_object($field0_fetch = mysqli_fetch_field($res)))
- printf("[008] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($field0_fetch = mysqli_fetch_field($res)))
+ printf("[008] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link));
- if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0)))
- printf("[009] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0)))
+ printf("[009] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link));
- if ($field0_fetch != $field0_direct) {
- printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n");
- var_dump($field0_fetch);
- var_dump($field0_direct);
- }
+ if ($field0_fetch != $field0_direct) {
+ printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n");
+ var_dump($field0_fetch);
+ var_dump($field0_direct);
+ }
- var_dump($field0_fetch);
+ var_dump($field0_fetch);
- if (!is_array($tmp = mysqli_fetch_fields($res)))
- printf("[011] Expecting array, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (!is_array($tmp = mysqli_fetch_fields($res)))
+ printf("[011] Expecting array, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) {
- printf("[012] mysqli_fetch_fields() return value is suspicious\n");
- var_dump($tmp);
- }
+ if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) {
+ printf("[012] mysqli_fetch_fields() return value is suspicious\n");
+ var_dump($tmp);
+ }
- if (!mysqli_field_seek($res, 1))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_field_seek($res, 1))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1)))
- printf("[014] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1)))
+ printf("[014] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link));
- if ($tmp[1] != $field1_direct) {
- printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n");
- var_dump($field1_direct);
- var_dump($tmp);
- }
+ if ($tmp[1] != $field1_direct) {
+ printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n");
+ var_dump($field1_direct);
+ var_dump($tmp);
+ }
- if (1 !== ($tmp = mysqli_field_tell($res)))
- printf("[016] Expecting int/1, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (1 !== ($tmp = mysqli_field_tell($res)))
+ printf("[016] Expecting int/1, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
+ printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[018] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_result_metadata()))
+ printf("[018] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
index fb285436d3..8f6a7cc920 100644
--- a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
@@ -10,219 +10,219 @@ die("skip Check again when the Klingons visit earth - http://bugs.mysql.com/bug.
?>
--FILE--
<?php
- require('table.inc');
-
- function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) {
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset, $sql,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!@mysqli_stmt_prepare($stmt, $sql)) {
- /* Not all server versions will support all statements */
- /* Failing to prepare is OK */
- return true;
- }
-
- if (empty($expected_lib) && (false !== $res)) {
- printf("[%04d - %s] No metadata expected\n",
- $offset + 1, $sql);
- return false;
- } else if (!empty($expected_lib) && (false == $res)) {
- printf("[%04d - %s] Metadata expected\n",
- $offset + 2, $sql);
- return false;
- }
- if (!empty($expected_lib)) {
- if (!is_object($res)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 3, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if (get_class($res) != 'mysqli_result') {
- printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
- $offset + 4, $sql, get_class($res));
- return false;
- }
-
- $meta = array(
- 'num_fields' => mysqli_num_fields($res),
- 'fetch_field' => mysqli_fetch_field($res),
- 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
- 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
- 'fetch_fields' => count(mysqli_fetch_fields($res)),
- 'field_count' => $res->field_count,
- 'field_seek-1' => @mysqli_field_seek($res, -1),
- 'field_seek0' => mysqli_field_seek($res, 0),
- 'field_tell' => mysqli_field_tell($res),
- );
- if (is_object($meta['fetch_field'])) {
- $meta['fetch_field']->charsetnr = 'ignore';
- $meta['fetch_field']->flags = 'ignore';
- }
- if (is_object($meta['fetch_field_direct0'])) {
- $meta['fetch_field_direct0']->charsetnr = 'ignore';
- $meta['fetch_field_direct0']->flags = 'ignore';
- }
- if (is_object($meta['fetch_field_direct1'])) {
- $meta['fetch_field_direct1']->charsetnr = 'ignore';
- $meta['fetch_field_direct1']->flags = 'ignore';
- }
- mysqli_free_result($res);
-
- if ($meta != $expected_lib) {
- printf("[%04d - %s] Metadata differes from expected values\n",
- $offset + 5, $sql);
- var_dump($meta);
- var_dump($expected_lib);
- return false;
- }
- }
-
- if (function_exists('mysqli_stmt_get_result')) {
- /* mysqlnd only */
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 6, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $res = mysqli_stmt_get_result($stmt);
- if (false === $res && !empty($expected_mysqlnd)) {
- printf("[%04d - %s] Expecting resultset [%d] %s\n",
- $offset + 7, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- } else if (empty($expected_mysqlnd) && false !== $res) {
- printf("[%04d - %s] Unexpected resultset [%d] %s\n",
- $offset + 8, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!is_object($res)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 9, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if ('mysqli_result' != get_class($res)) {
- printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
- $offset + 10, $sql,
- get_class($res));
- return false;
- }
-
- $meta_res = array(
- 'num_fields' => mysqli_num_fields($res),
- 'fetch_field' => mysqli_fetch_field($res),
- 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
- 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
- 'fetch_fields' => count(mysqli_fetch_fields($res)),
- 'field_count' => mysqli_field_count($link),
- 'field_seek-1' => @mysqli_field_seek($res, -1),
- 'field_seek0' => mysqli_field_seek($res, 0),
- 'field_tell' => mysqli_field_tell($res),
- );
- if (is_object($meta_res['fetch_field'])) {
- $meta_res['fetch_field']->charsetnr = 'ignore';
- $meta_res['fetch_field']->flags = 'ignore';
- }
- if (is_object($meta_res['fetch_field_direct0'])) {
- $meta_res['fetch_field_direct0']->charsetnr = 'ignore';
- $meta_res['fetch_field_direct0']->flags = 'ignore';
- }
- if (is_object($meta_res['fetch_field_direct1'])) {
- $meta_res['fetch_field_direct1']->charsetnr = 'ignore';
- $meta_res['fetch_field_direct1']->flags = 'ignore';
- }
- mysqli_free_result($res);
- if ($check_mysqlnd && $meta_res != $expected_mysqlnd) {
- printf("[%04d - %s] Metadata differs from expected\n",
- $offset + 11, $sql);
- var_dump($meta_res);
- var_dump($expected_mysqlnd);
- } else {
- if ($meta_res['field_count'] < 1) {
- printf("[%04d - %s] Metadata seems wrong, no fields?\n",
- $offset + 12, $sql);
- var_dump($meta_res);
- var_dump(mysqli_fetch_assoc($res));
- }
- }
-
- if ($compare && $meta_res != $meta) {
- printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n",
- $offset + 13, $sql);
- var_dump($meta_res);
- var_dump($meta);
- }
-
- }
-
- mysqli_stmt_close($stmt);
- return true;
- }
-
- /* Note: very weak testing, we accept almost any result */
-
- testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false);
- testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false);
- testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false);
-
- testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false);
- testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false);
- testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false);
- testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false);
- testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false);
- testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false);
- testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false);
- testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false);
- testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false);
- testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false);
- testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false);
- testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false);
- testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
- testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
- testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false);
- testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false);
- testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false);
-
- $field0 = new stdClass();
- $field0->name = 'id';
- $field0->orgname = 'id';
- $field0->table = 'test';
- $field0->orgtable = 'test';
- $field0->def = '';
- $field0->max_length = 0;
- $field0->length = 11;
- $field0->charsetnr = 'ignore';
- $field0->flags = 'ignore';
- $field0->type = MYSQLI_TYPE_LONG;
- $field0->decimals = 0;
- $meta_lib = array(
- 'num_fields' => 1,
- 'fetch_field' => $field0,
- 'fetch_field_direct0' => $field0,
- 'fetch_field_direct1' => false,
- 'fetch_fields' => 1,
- 'field_count' => 1,
- 'field_seek-1' => false,
- 'field_seek0' => true,
- 'field_tell' => 0,
- );
- $meta_mysqlnd = $meta_lib;
- testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true);
-
- testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false);
-
- mysqli_close($link);
- print "done!";
+ require('table.inc');
+
+ function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) {
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset, $sql,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!@mysqli_stmt_prepare($stmt, $sql)) {
+ /* Not all server versions will support all statements */
+ /* Failing to prepare is OK */
+ return true;
+ }
+
+ if (empty($expected_lib) && (false !== $res)) {
+ printf("[%04d - %s] No metadata expected\n",
+ $offset + 1, $sql);
+ return false;
+ } else if (!empty($expected_lib) && (false == $res)) {
+ printf("[%04d - %s] Metadata expected\n",
+ $offset + 2, $sql);
+ return false;
+ }
+ if (!empty($expected_lib)) {
+ if (!is_object($res)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 3, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if (get_class($res) != 'mysqli_result') {
+ printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
+ $offset + 4, $sql, get_class($res));
+ return false;
+ }
+
+ $meta = array(
+ 'num_fields' => mysqli_num_fields($res),
+ 'fetch_field' => mysqli_fetch_field($res),
+ 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
+ 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
+ 'fetch_fields' => count(mysqli_fetch_fields($res)),
+ 'field_count' => $res->field_count,
+ 'field_seek-1' => @mysqli_field_seek($res, -1),
+ 'field_seek0' => mysqli_field_seek($res, 0),
+ 'field_tell' => mysqli_field_tell($res),
+ );
+ if (is_object($meta['fetch_field'])) {
+ $meta['fetch_field']->charsetnr = 'ignore';
+ $meta['fetch_field']->flags = 'ignore';
+ }
+ if (is_object($meta['fetch_field_direct0'])) {
+ $meta['fetch_field_direct0']->charsetnr = 'ignore';
+ $meta['fetch_field_direct0']->flags = 'ignore';
+ }
+ if (is_object($meta['fetch_field_direct1'])) {
+ $meta['fetch_field_direct1']->charsetnr = 'ignore';
+ $meta['fetch_field_direct1']->flags = 'ignore';
+ }
+ mysqli_free_result($res);
+
+ if ($meta != $expected_lib) {
+ printf("[%04d - %s] Metadata differes from expected values\n",
+ $offset + 5, $sql);
+ var_dump($meta);
+ var_dump($expected_lib);
+ return false;
+ }
+ }
+
+ if (function_exists('mysqli_stmt_get_result')) {
+ /* mysqlnd only */
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 6, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $res = mysqli_stmt_get_result($stmt);
+ if (false === $res && !empty($expected_mysqlnd)) {
+ printf("[%04d - %s] Expecting resultset [%d] %s\n",
+ $offset + 7, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ } else if (empty($expected_mysqlnd) && false !== $res) {
+ printf("[%04d - %s] Unexpected resultset [%d] %s\n",
+ $offset + 8, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!is_object($res)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 9, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if ('mysqli_result' != get_class($res)) {
+ printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
+ $offset + 10, $sql,
+ get_class($res));
+ return false;
+ }
+
+ $meta_res = array(
+ 'num_fields' => mysqli_num_fields($res),
+ 'fetch_field' => mysqli_fetch_field($res),
+ 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
+ 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
+ 'fetch_fields' => count(mysqli_fetch_fields($res)),
+ 'field_count' => mysqli_field_count($link),
+ 'field_seek-1' => @mysqli_field_seek($res, -1),
+ 'field_seek0' => mysqli_field_seek($res, 0),
+ 'field_tell' => mysqli_field_tell($res),
+ );
+ if (is_object($meta_res['fetch_field'])) {
+ $meta_res['fetch_field']->charsetnr = 'ignore';
+ $meta_res['fetch_field']->flags = 'ignore';
+ }
+ if (is_object($meta_res['fetch_field_direct0'])) {
+ $meta_res['fetch_field_direct0']->charsetnr = 'ignore';
+ $meta_res['fetch_field_direct0']->flags = 'ignore';
+ }
+ if (is_object($meta_res['fetch_field_direct1'])) {
+ $meta_res['fetch_field_direct1']->charsetnr = 'ignore';
+ $meta_res['fetch_field_direct1']->flags = 'ignore';
+ }
+ mysqli_free_result($res);
+ if ($check_mysqlnd && $meta_res != $expected_mysqlnd) {
+ printf("[%04d - %s] Metadata differs from expected\n",
+ $offset + 11, $sql);
+ var_dump($meta_res);
+ var_dump($expected_mysqlnd);
+ } else {
+ if ($meta_res['field_count'] < 1) {
+ printf("[%04d - %s] Metadata seems wrong, no fields?\n",
+ $offset + 12, $sql);
+ var_dump($meta_res);
+ var_dump(mysqli_fetch_assoc($res));
+ }
+ }
+
+ if ($compare && $meta_res != $meta) {
+ printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n",
+ $offset + 13, $sql);
+ var_dump($meta_res);
+ var_dump($meta);
+ }
+
+ }
+
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+ /* Note: very weak testing, we accept almost any result */
+
+ testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false);
+ testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false);
+ testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false);
+
+ testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false);
+ testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false);
+ testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false);
+ testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false);
+ testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false);
+ testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false);
+ testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false);
+ testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false);
+ testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false);
+ testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false);
+ testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false);
+ testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false);
+ testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
+ testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
+ testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false);
+ testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false);
+ testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false);
+
+ $field0 = new stdClass();
+ $field0->name = 'id';
+ $field0->orgname = 'id';
+ $field0->table = 'test';
+ $field0->orgtable = 'test';
+ $field0->def = '';
+ $field0->max_length = 0;
+ $field0->length = 11;
+ $field0->charsetnr = 'ignore';
+ $field0->flags = 'ignore';
+ $field0->type = MYSQLI_TYPE_LONG;
+ $field0->decimals = 0;
+ $meta_lib = array(
+ 'num_fields' => 1,
+ 'fetch_field' => $field0,
+ 'fetch_field_direct0' => $field0,
+ 'fetch_field_direct1' => false,
+ 'fetch_fields' => 1,
+ 'field_count' => 1,
+ 'field_seek-1' => false,
+ 'field_seek0' => true,
+ 'field_tell' => 0,
+ );
+ $meta_mysqlnd = $meta_lib;
+ testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true);
+
+ testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
index 8e6dfcaffa..1bc1ca7c48 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
@@ -8,123 +8,123 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_send_long_data()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_send_long_data($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_send_long_data($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (isset($row['VARIABLE_VALUE']) && !isset($row['Value']))
- // MySQL 6.0
- $row['Value'] = $row['VARIABLE_VALUE'];
+ if (isset($row['VARIABLE_VALUE']) && !isset($row['Value']))
+ // MySQL 6.0
+ $row['Value'] = $row['VARIABLE_VALUE'];
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- for ($i = 0; $i < 1024; $i++) {
- $tmp .= 'a';
- }
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ for ($i = 0; $i < 1024; $i++) {
+ $tmp .= 'a';
+ }
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- for ($i = 0; $i < $limit; $i++)
- $blob .= $tmp;
- /*
- if (floor($max_allowed_packet / 1024) <= 10240) {
- $limit = strlen($blob) - $max_allowed_packet - 1;
- for ($i = 0; $i < $limit; $i++)
- $blob .= 'a';
- }
- */
- assert(strlen($blob) <= $max_allowed_packet);
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= $tmp;
+ /*
+ if (floor($max_allowed_packet / 1024) <= 10240) {
+ $limit = strlen($blob) - $max_allowed_packet - 1;
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= 'a';
+ }
+ */
+ assert(strlen($blob) <= $max_allowed_packet);
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob)))
- printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob)))
+ printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob)))
- printf("[013] Expecting NULL, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob)))
+ printf("[013] Expecting NULL, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob)))
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob)))
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 != ($tmp = mysqli_num_rows($res)))
- printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n",
- $tmp, mysqli_errno($link), mysqli_error($link));
+ if (1 != ($tmp = mysqli_num_rows($res)))
+ printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n",
+ $tmp, mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1))
- printf("[020] Record seems to be incomplete\n");
+ if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1))
+ printf("[020] Record seems to be incomplete\n");
- if ($blob != $row['label'])
- printf("[021] Blob value has not been stored properly!\n");
+ if ($blob != $row['label'])
+ printf("[021] Blob value has not been stored properly!\n");
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[022] Expecting NULL, got %s/%s\n");
+ if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
+ printf("[022] Expecting NULL, got %s/%s\n");
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_stmt_send_long_data()))
+ printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
index 10a6471d2b..36ac3acfca 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
@@ -11,84 +11,84 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- for ($i = 0; $i < 1024; $i++) {
- $tmp .= 'a';
- }
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ for ($i = 0; $i < 1024; $i++) {
+ $tmp .= 'a';
+ }
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- for ($i = 0; $i < $limit; $i++)
- $blob .= $tmp;
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= $tmp;
- assert(strlen($blob) <= $max_allowed_packet);
+ assert(strlen($blob) <= $max_allowed_packet);
- if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /*
- TODO - we skip this part of the test for now, because of bugs.mysql.com/26824
- if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
- // test with a blob smaller than 10M allows us to test
- // for too long packages without wasting too much memory
- $limit = $max_allowed_packet - strlen($blob) + 1;
- $blob2 = $blob;
- for ($i = 0; $i < $limit; $i++)
- $blob2 .= 'b';
+ /*
+ TODO - we skip this part of the test for now, because of bugs.mysql.com/26824
+ if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
+ // test with a blob smaller than 10M allows us to test
+ // for too long packages without wasting too much memory
+ $limit = $max_allowed_packet - strlen($blob) + 1;
+ $blob2 = $blob;
+ for ($i = 0; $i < $limit; $i++)
+ $blob2 .= 'b';
- assert(strlen($blob2) > $max_allowed_packet);
+ assert(strlen($blob2) > $max_allowed_packet);
- if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
- printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
+ printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 2;
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- */
- mysqli_stmt_close($stmt);
- mysqli_close($link);
+ $id = 2;
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ */
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
index e64d66fa12..30e3fba8b0 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
@@ -11,89 +11,89 @@ if (!stristr(mysqli_get_client_info(), 'mysqlnd'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- $tmp = str_repeat('a', 1024);
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ $tmp = str_repeat('a', 1024);
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- $blob = str_repeat($tmp, $limit);
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ $blob = str_repeat($tmp, $limit);
- assert(strlen($blob) <= $max_allowed_packet);
+ assert(strlen($blob) <= $max_allowed_packet);
- if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /*
- TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824
- It would always fail.
+ /*
+ TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824
+ It would always fail.
- This should be added to the EXPECTF, if you reactivate the test
+ This should be added to the EXPECTF, if you reactivate the test
Warning: mysqli_stmt_send_long_data(): Skipped %d bytes. Last command STMT_SEND_LONG_DATA hasn't consumed all the output from the server in %s on line %d
Warning: mysqli_stmt_send_long_data(): There was an error while sending long data. Probably max_allowed_packet_size is smaller than the data. You have to increase it or send smaller chunks of data. Answer was %d bytes long. in %s on line %d
- if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
- // test with a blob smaller than 10M allows us to test
- // for too long packages without wasting too much memory
- $limit = $max_allowed_packet - strlen($blob) + 1;
- $blob2 = $blob;
- $blob2 .= str_repeat('b', $limit);
+ if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
+ // test with a blob smaller than 10M allows us to test
+ // for too long packages without wasting too much memory
+ $limit = $max_allowed_packet - strlen($blob) + 1;
+ $blob2 = $blob;
+ $blob2 .= str_repeat('b', $limit);
- assert(strlen($blob2) > $max_allowed_packet);
+ assert(strlen($blob2) > $max_allowed_packet);
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
- printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
+ printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 2;
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- */
- mysqli_stmt_close($stmt);
- mysqli_close($link);
+ $id = 2;
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ */
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
index c684e3585a..8b46eca170 100644
--- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
@@ -8,48 +8,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_sqlstate()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_sqlstate($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link, '')))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_sqlstate($link, '')))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test"))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test"))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists"))
- printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists"))
+ printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ('' === ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ('' === ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
index b563e886bf..2f8a8965f7 100644
--- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
@@ -8,79 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_store_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_store_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = @mysqli_stmt_store_result(new mysqli_stmt())))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_stmt_store_result(new mysqli_stmt())))
+ printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // stmt object status test
- if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = @mysqli_stmt_store_result($stmt)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') ||
- !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$stmt_buf = mysqli_stmt_init($link_buf))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt_buf = mysqli_stmt_init($link_buf))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") ||
- !mysqli_stmt_execute($stmt_buf))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+ if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") ||
+ !mysqli_stmt_execute($stmt_buf))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
- $id = $label = $id_buf = $label_buf = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = $id_buf = $label_buf = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+ if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
- while (mysqli_stmt_fetch($stmt)) {
- if (!mysqli_stmt_fetch($stmt_buf)) {
- printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n",
- mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
- }
- if ($id !== $id_buf)
- printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n",
- $id, gettype($id), $id_buf, gettype($id_buf));
- if ($label !== $label_buf)
- printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n",
- $label, gettype($label), $label_buf, gettype($label_buf));
- }
+ while (mysqli_stmt_fetch($stmt)) {
+ if (!mysqli_stmt_fetch($stmt_buf)) {
+ printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n",
+ mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+ }
+ if ($id !== $id_buf)
+ printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n",
+ $id, gettype($id), $id_buf, gettype($id_buf));
+ if ($label !== $label_buf)
+ printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n",
+ $label, gettype($label), $label_buf, gettype($label_buf));
+ }
- mysqli_stmt_close($stmt);
- mysqli_stmt_close($stmt_buf);
+ mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt_buf);
- if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
+ printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
- mysqli_close($link_buf);
- print "done!";
+ mysqli_close($link);
+ mysqli_close($link_buf);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
index 18dddc90c7..722295b177 100644
--- a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* no, still bails out */
- $stmt_clone = clone $stmt;
- print "done!";
+ /* no, still bails out */
+ $stmt_clone = clone $stmt;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_stmt in %s:%d
diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt
index 2ac22ba767..a41c6f0544 100644
--- a/ext/mysqli/tests/mysqli_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_store_result.phpt
@@ -8,52 +8,52 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_store_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_store_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($res = mysqli_store_result($link)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = mysqli_store_result($link)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($res = mysqli_store_result($link)))
- printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_store_result($link)))
+ printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[009] Expecting boolean/false, got %s/%s\n",
- gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 1)))
+ printf("[009] Expecting boolean/false, got %s/%s\n",
+ gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_store_result($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_store_result($link)))
+ printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
index 31645b026c..fb1b9f3837 100644
--- a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
+++ b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
@@ -35,7 +35,7 @@ mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace"
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_store_result_copy.phpt b/ext/mysqli/tests/mysqli_store_result_copy.phpt
index 136e2c5d4d..eeef5c4cfc 100644
--- a/ext/mysqli/tests/mysqli_store_result_copy.phpt
+++ b/ext/mysqli/tests/mysqli_store_result_copy.phpt
@@ -196,7 +196,7 @@ END;')) {
?>
--CLEAN--
<?php
- require_once("clean_table.inc");
+ require_once("clean_table.inc");
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt
index f8e6d7fa1b..46d3b3db69 100644
--- a/ext/mysqli/tests/mysqli_thread_id.phpt
+++ b/ext/mysqli/tests/mysqli_thread_id.phpt
@@ -8,32 +8,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_thread_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_thread_id()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_thread_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_thread_id($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
- printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
+ printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- // should work if the thread id is correct
- mysqli_kill($link, mysqli_thread_id($link));
+ // should work if the thread id is correct
+ mysqli_kill($link, mysqli_thread_id($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_thread_id($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_thread_id($link)))
+ printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_thread_safe.phpt b/ext/mysqli/tests/mysqli_thread_safe.phpt
index 15b93dd209..3f45127095 100644
--- a/ext/mysqli/tests/mysqli_thread_safe.phpt
+++ b/ext/mysqli/tests/mysqli_thread_safe.phpt
@@ -7,10 +7,10 @@ require_once('skipifemb.inc');
?>
--FILE--
<?php
- if (!is_bool($tmp = mysqli_thread_safe()))
- printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_thread_safe()))
+ printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_unclonable.phpt b/ext/mysqli/tests/mysqli_unclonable.phpt
index a6bb1946c7..d7f42c2f6e 100644
--- a/ext/mysqli/tests/mysqli_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_unclonable.phpt
@@ -8,16 +8,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $link_clone = clone $link;
- mysqli_close($link);
+ $link_clone = clone $link;
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli in %s:%d
diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt
index f61d51208e..2c04aa3850 100644
--- a/ext/mysqli/tests/mysqli_use_result.phpt
+++ b/ext/mysqli/tests/mysqli_use_result.phpt
@@ -8,52 +8,52 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_use_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_use_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_use_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_use_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($res = mysqli_use_result($link)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($res = mysqli_use_result($link)))
- printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_use_result($link)))
+ printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[009] Expecting boolean/false, got %s/%s\n",
- gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 1)))
+ printf("[009] Expecting boolean/false, got %s/%s\n",
+ gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_use_result($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_use_result($link)))
+ printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt
index 128373ae36..6e55bc2591 100644
--- a/ext/mysqli/tests/mysqli_warning_count.phpt
+++ b/ext/mysqli/tests/mysqli_warning_count.phpt
@@ -8,40 +8,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_warning_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_warning_count()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_warning_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_warning_count($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many")))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (0 !== ($tmp = mysqli_warning_count($link)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_warning_count($link)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 !== ($tmp = mysqli_warning_count($link)))
- printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_warning_count($link)))
+ printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_warning_count($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_warning_count($link)))
+ printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_warning_unclonable.phpt b/ext/mysqli/tests/mysqli_warning_unclonable.phpt
index 3e63339140..53bca1212a 100644
--- a/ext/mysqli/tests/mysqli_warning_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_warning_unclonable.phpt
@@ -11,27 +11,27 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- $warning_clone = clone $warning;
- print "done!";
+ $warning_clone = clone $warning;
+ print "done!";
?>
--CLEAN--
<?php