-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote a few remaining errors in ext/standard #6110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4c9cdca
5102425
b0faf9d
88ee6ad
15d89e9
4543298
da80b64
448f74d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -942,14 +942,17 @@ PHP_FUNCTION(popen) | |
mode_len--; | ||
} | ||
} | ||
#endif | ||
|
||
/* Musl only partially validates the mode. Manually check it to ensure consistent behavior. */ | ||
if (mode_len != 1 || (*posix_mode != 'r' && *posix_mode != 'w')) { | ||
php_error_docref2(NULL, command, posix_mode, E_WARNING, "Invalid mode"); | ||
if (mode_len > 2 || | ||
(mode_len == 1 && (*posix_mode != 'r' && *posix_mode != 'w')) || | ||
(mode_len == 2 && (memcmp(posix_mode, "rb", 2) && memcmp(posix_mode, "wb", 2))) | ||
) { | ||
zend_argument_value_error(2, "must be one of \"r\", \"rb\", \"w\", or \"wb\""); | ||
efree(posix_mode); | ||
RETURN_FALSE; | ||
RETURN_THROWS(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this now throws ValueError, we should make it consistent between Linux & Windows. I.e. move this outside the ifndef, but also allow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully I managed to find the condition you imagined ^^ |
||
} | ||
#endif | ||
|
||
fp = VCWD_POPEN(command, posix_mode); | ||
if (!fp) { | ||
|
@@ -1816,7 +1819,7 @@ PHP_FUNCTION(fputcsv) | |
zend_argument_value_error(3, "must be a single character"); | ||
RETURN_THROWS(); | ||
} else if (delimiter_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "delimiter must be a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #3 ($delimiter) must be a single character"); | ||
} | ||
|
||
/* use first character from string */ | ||
|
@@ -1828,15 +1831,15 @@ PHP_FUNCTION(fputcsv) | |
zend_argument_value_error(4, "must be a single character"); | ||
RETURN_THROWS(); | ||
} else if (enclosure_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "enclosure must be a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #4 ($enclosure) must be a single character"); | ||
} | ||
/* use first character from string */ | ||
enclosure = *enclosure_str; | ||
} | ||
|
||
if (escape_str != NULL) { | ||
if (escape_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "escape must be empty or a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #5 ($escape) must be empty or a single character"); | ||
} | ||
if (escape_str_len < 1) { | ||
escape_char = PHP_CSV_NO_ESCAPE; | ||
|
@@ -1954,7 +1957,7 @@ PHP_FUNCTION(fgetcsv) | |
zend_argument_value_error(3, "must be a single character"); | ||
RETURN_THROWS(); | ||
} else if (delimiter_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "delimiter must be a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #3 ($delimiter) must be a single character"); | ||
} | ||
|
||
/* use first character from string */ | ||
|
@@ -1966,7 +1969,7 @@ PHP_FUNCTION(fgetcsv) | |
zend_argument_value_error(4, "must be a single character"); | ||
RETURN_THROWS(); | ||
} else if (enclosure_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "enclosure must be a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #4 ($enclosure) must be a single character"); | ||
} | ||
|
||
/* use first character from string */ | ||
|
@@ -1975,7 +1978,7 @@ PHP_FUNCTION(fgetcsv) | |
|
||
if (escape_str != NULL) { | ||
if (escape_str_len > 1) { | ||
php_error_docref(NULL, E_NOTICE, "escape must be empty or a single character"); | ||
php_error_docref(NULL, E_WARNING, "Argument #5 ($enclosure) must be empty or a single character"); | ||
} | ||
|
||
if (escape_str_len < 1) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.