From 9f068855ef4024e519e3800e4b357077c8d1e368 Mon Sep 17 00:00:00 2001 From: bugreportuser <37939393+bugreportuser@users.noreply.github.com> Date: Thu, 12 Sep 2019 12:44:08 -0600 Subject: [PATCH] Fix auto_detect_line_endings type --- ext/standard/file.c | 2 +- ext/standard/file.h | 2 +- .../file/auto_detect_line_endings_1.phpt | 24 ++++++++++++++++ .../file/auto_detect_line_endings_2.phpt | 28 +++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/file/auto_detect_line_endings_1.phpt create mode 100644 ext/standard/tests/file/auto_detect_line_endings_2.phpt diff --git a/ext/standard/file.c b/ext/standard/file.c index ff3bef3f030b9..fb5ca26298b52 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -166,7 +166,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals) STD_PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, OnUpdateString, from_address, php_file_globals, file_globals) STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals) - STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateLong, auto_detect_line_endings, php_file_globals, file_globals) + STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateBool, auto_detect_line_endings, php_file_globals, file_globals) PHP_INI_END() PHP_MINIT_FUNCTION(file) diff --git a/ext/standard/file.h b/ext/standard/file.h index 54df0936d3f0e..70fbc798f5526 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -119,7 +119,7 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data *); typedef struct { int pclose_ret; size_t def_chunk_size; - zend_long auto_detect_line_endings; + zend_bool auto_detect_line_endings; zend_long default_socket_timeout; char *user_agent; /* for the http wrapper */ char *from_address; /* for the ftp and http wrappers */ diff --git a/ext/standard/tests/file/auto_detect_line_endings_1.phpt b/ext/standard/tests/file/auto_detect_line_endings_1.phpt new file mode 100644 index 0000000000000..c79082ecdb212 --- /dev/null +++ b/ext/standard/tests/file/auto_detect_line_endings_1.phpt @@ -0,0 +1,24 @@ +--TEST-- +auto_detect_line_endings --INI-- bool +--INI-- +auto_detect_line_endings=on +--STDIN-- +fooBar1 fooBar2 fooBar3 +--FILE-- + +--EXPECTF-- +string(1) "1" +string(8) "fooBar1 " +string(8) "fooBar2 " +string(8) "fooBar3 +" +Done diff --git a/ext/standard/tests/file/auto_detect_line_endings_2.phpt b/ext/standard/tests/file/auto_detect_line_endings_2.phpt new file mode 100644 index 0000000000000..f33a055e08325 --- /dev/null +++ b/ext/standard/tests/file/auto_detect_line_endings_2.phpt @@ -0,0 +1,28 @@ +--TEST-- +ini_set auto_detect_line_endings bool +--FILE-- + +--EXPECTF-- +string(2) "on" +string(8) "fooBar1 " +string(8) "fooBar2 " +string(7) "fooBar3" +Done +--CLEAN-- +