-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Convert warnings to exceptions in standard lib (reopened) #5004
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
e6b3915
80250da
ae0b1f5
0a0e75e
13d8ec6
2f08249
e1eb864
f289483
f38e877
c992c01
6a4bd43
f53e365
761842d
1bb354d
30f05c1
c90cce3
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 |
---|---|---|
|
@@ -701,8 +701,8 @@ PHP_FUNCTION(get_browser) | |
} | ||
} else { | ||
if (!global_bdata.htab) { | ||
php_error_docref(NULL, E_WARNING, "browscap ini directive not set"); | ||
RETURN_FALSE; | ||
zend_throw_error(NULL, "Browscap ini directive not set"); | ||
return; | ||
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. Imho this is again an environment issue: Code may have to deal with the fact that browscap is not available. |
||
} | ||
bdata = &global_bdata; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,13 @@ PHPAPI PHP_FUNCTION(dl) | |
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
if (!PG(enable_dl)) { | ||
php_error_docref(NULL, E_WARNING, "Dynamically loaded extensions aren't enabled"); | ||
RETURN_FALSE; | ||
zend_throw_error(NULL, "Dynamically loaded extensions aren't enabled"); | ||
return; | ||
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. Similar here, environment issue. |
||
} | ||
|
||
if (filename_len >= MAXPATHLEN) { | ||
php_error_docref(NULL, E_WARNING, "File name exceeds the maximum allowed length of %d characters", MAXPATHLEN); | ||
RETURN_FALSE; | ||
zend_value_error("File name exceeds the maximum allowed length of %d characters", MAXPATHLEN); | ||
return; | ||
} | ||
|
||
php_dl(filename, MODULE_TEMPORARY, return_value, 0); | ||
|
@@ -265,7 +265,7 @@ PHP_MINFO_FUNCTION(dl) | |
|
||
PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now) | ||
{ | ||
php_error_docref(NULL, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file); | ||
zend_throw_error(NULL, "Cannot dynamically load %s - dynamic modules are not supported", file); | ||
RETVAL_FALSE; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,8 +383,8 @@ PHP_FUNCTION(dns_check_record) | |
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
if (hostname_len == 0) { | ||
php_error_docref(NULL, E_WARNING, "Host cannot be empty"); | ||
RETURN_FALSE; | ||
zend_value_error("Host cannot be empty"); | ||
return; | ||
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. This is fine :) |
||
} | ||
|
||
if (rectype) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmb69 What do you think about moving this check into Z_PARAM_PATH? It seems to be a pretty common check (and it's also checked in php_stream_open_wrapper), but we probably don't check it everywhere we should be checking it. That would make sure it's treated consistently.
(Conversely: Are there any cases where an empty path should be accepted?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are at least some cases where an empty path should be accepted, e.g. for SQLite3::open() (where an empty path is supposed to create a temporary on-disk database). Generally, I think that empty paths should be forbidden right away nonetheless. Maybe change Z_PARAM_PATH to reject empty paths, and cater to the few exceptions by checking for a string and adding a manual NUL byte check? Or maybe introduce another macro (say, Z_PARAM_PATH_MAYBE_EMPTY)? The latter won't work with classic ZPP, though (don't think that would a problem though).