Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion main/streams/php_stream_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ typedef struct _php_stream_error_entry {
zend_string *message;
zend_enum_StreamErrorCode code;
char *wrapper_name;
char *param;
char *docref;
int severity;
bool terminating;
Expand Down
43 changes: 13 additions & 30 deletions main/streams/stream_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ static void php_stream_error_create_object(zval *zv, php_stream_error_entry *ent

zend_update_property_bool(
php_ce_stream_error, Z_OBJ_P(zv), ZEND_STRL("terminating"), entry->terminating);

if (entry->param) {
zend_update_property_string(
php_ce_stream_error, Z_OBJ_P(zv), ZEND_STRL("param"), entry->param);
} else {
zend_update_property_null(php_ce_stream_error, Z_OBJ_P(zv), ZEND_STRL("param"));
}
}

/* Create array of StreamError objects from error chain */
Expand Down Expand Up @@ -213,7 +206,6 @@ static void php_stream_error_entry_free(php_stream_error_entry *entry)
php_stream_error_entry *next = entry->next;
zend_string_release(entry->message);
efree(entry->wrapper_name);
efree(entry->param);
efree(entry->docref);
efree(entry);
entry = next;
Expand Down Expand Up @@ -326,7 +318,7 @@ PHPAPI php_stream_error_operation *php_stream_error_operation_begin(void)
}

static void php_stream_error_add(zend_enum_StreamErrorCode code, const char *wrapper_name,
zend_string *message, const char *docref, char *param, int severity, bool terminating)
zend_string *message, const char *docref, int severity, bool terminating)
{
php_stream_error_operation *op = FG(stream_error_state).current_operation;
ZEND_ASSERT(op != NULL);
Expand All @@ -335,7 +327,6 @@ static void php_stream_error_add(zend_enum_StreamErrorCode code, const char *wra
entry->message = message;
entry->code = code;
entry->wrapper_name = wrapper_name ? estrdup(wrapper_name) : NULL;
entry->param = param;
entry->docref = docref ? estrdup(docref) : NULL;
entry->severity = severity;
entry->terminating = terminating;
Expand Down Expand Up @@ -399,15 +390,9 @@ static void php_stream_report_errors(php_stream_context *context, php_stream_err
{
switch (error_mode) {
case PHP_STREAM_ERROR_MODE_ERROR: {
php_stream_error_entry *entry = op->first_error;
const php_stream_error_entry *entry = op->first_error;
while (entry) {
if (entry->param) {
php_error_docref1(entry->docref, entry->param, entry->severity, "%s",
ZSTR_VAL(entry->message));
} else {
php_error_docref(
entry->docref, entry->severity, "%s", ZSTR_VAL(entry->message));
}
php_error_docref(entry->docref, entry->severity, "%s", ZSTR_VAL(entry->message));
entry = entry->next;
}
break;
Expand Down Expand Up @@ -575,15 +560,15 @@ PHPAPI void php_stream_error_operation_abort(void)
/* Wrapper error reporting */

static void php_stream_wrapper_error_internal(const char *wrapper_name, php_stream_context *context,
const char *docref, int options, int severity, bool terminating,
zend_enum_StreamErrorCode code, char *param, zend_string *message)
const char *docref, int severity, bool terminating,
zend_enum_StreamErrorCode code, zend_string *message)
{
bool implicit_operation = (FG(stream_error_state).current_operation == NULL);
if (implicit_operation) {
php_stream_error_operation_begin();
}

php_stream_error_add(code, wrapper_name, message, docref, param, severity, terminating);
php_stream_error_add(code, wrapper_name, message, docref, severity, terminating);

if (implicit_operation) {
php_stream_error_operation_end(context);
Expand All @@ -604,7 +589,7 @@ PHPAPI void php_stream_wrapper_error_with_name(const char *wrapper_name,
va_end(args);

php_stream_wrapper_error_internal(
wrapper_name, context, docref, options, severity, terminating, code, NULL, message);
wrapper_name, context, docref, severity, terminating, code, message);
}

PHPAPI void php_stream_wrapper_error(php_stream_wrapper *wrapper, php_stream_context *context,
Expand All @@ -623,7 +608,7 @@ PHPAPI void php_stream_wrapper_error(php_stream_wrapper *wrapper, php_stream_con
const char *wrapper_name = PHP_STREAM_ERROR_WRAPPER_NAME(wrapper);

php_stream_wrapper_error_internal(
wrapper_name, context, docref, options, severity, terminating, code, NULL, message);
wrapper_name, context, docref, severity, terminating, code, message);
}

/* Stream error reporting */
Expand All @@ -641,8 +626,8 @@ PHPAPI void php_stream_error(php_stream *stream, const char *docref, int severit

php_stream_context *context = PHP_STREAM_CONTEXT(stream);

php_stream_wrapper_error_internal(wrapper_name, context, docref, REPORT_ERRORS, severity,
terminating, code, NULL, message);
php_stream_wrapper_error_internal(wrapper_name, context, docref, severity,
terminating, code, message);
}

/* Legacy wrapper error logging */
Expand All @@ -652,7 +637,6 @@ static void php_stream_error_entry_dtor_legacy(void *error)
php_stream_error_entry *entry = *(php_stream_error_entry **) error;
zend_string_release(entry->message);
efree(entry->wrapper_name);
efree(entry->param);
efree(entry->docref);
efree(entry);
}
Expand All @@ -671,7 +655,6 @@ static void php_stream_wrapper_log_store_error(zend_string *message, zend_enum_S
entry->message = message;
entry->code = code;
entry->wrapper_name = wrapper_name ? estrdup(wrapper_name) : NULL;
entry->param = NULL;
entry->severity = severity;
entry->terminating = terminating;

Expand Down Expand Up @@ -705,7 +688,7 @@ PHPAPI void php_stream_wrapper_log_error(const php_stream_wrapper *wrapper,

if (options & REPORT_ERRORS) {
php_stream_wrapper_error_internal(
wrapper_name, context, NULL, options, severity, terminating, code, NULL, message);
wrapper_name, context, NULL, severity, terminating, code, message);
} else {
php_stream_wrapper_log_store_error(
message, code, wrapper_name, severity, terminating);
Expand Down Expand Up @@ -784,8 +767,8 @@ PHPAPI void php_stream_display_wrapper_name_errors(const char *wrapper_name,

zend_string *message = strpprintf(0, "%s: %s", caption, msg);

php_stream_wrapper_error_internal(wrapper_name, context, NULL, REPORT_ERRORS, E_WARNING, true,
code, NULL, message);
php_stream_wrapper_error_internal(wrapper_name, context, NULL, E_WARNING, true,
code, message);

if (free_msg) {
efree(msg);
Expand Down
1 change: 0 additions & 1 deletion main/streams/stream_errors.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ enum StreamErrorStore
public string $wrapperName;
public int $severity;
public bool $terminating;
public ?string $param;
}

class StreamException extends Exception
Expand Down
8 changes: 1 addition & 7 deletions main/streams/stream_errors_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions main/streams/stream_errors_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading