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
33 changes: 16 additions & 17 deletions main/SAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen)
}
if (read_bytes < buflen) {
/* done */
SG(post_read) = 1;
SG(post_read) = true;
}

return read_bytes;
Expand Down Expand Up @@ -409,7 +409,7 @@ SAPI_API void sapi_activate(void)
*/
SG(sapi_headers).http_status_line = NULL;
SG(sapi_headers).mimetype = NULL;
SG(headers_sent) = 0;
SG(headers_sent) = false;
SG(read_post_bytes) = 0;
SG(request_info).request_body = NULL;
SG(request_info).current_user = NULL;
Expand All @@ -418,7 +418,7 @@ SAPI_API void sapi_activate(void)
SG(request_info).post_entry = NULL;
SG(request_info).proto_num = 1000; /* Default to HTTP 1.0 */
SG(global_request_time) = 0;
SG(post_read) = 0;
SG(post_read) = false;
SG(send_header_fcc) = empty_fcall_info_cache;
/* It's possible to override this general case in the activate() callback, if necessary. */
if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
Expand Down Expand Up @@ -517,7 +517,7 @@ SAPI_API void sapi_deactivate_destroy(void)
}
sapi_send_headers_free();
SG(sapi_started) = 0;
SG(headers_sent) = 0;
SG(headers_sent) = false;
SG(request_info).headers_read = 0;
SG(global_request_time) = 0;
}
Expand Down Expand Up @@ -646,7 +646,7 @@ static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_
}
}

SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg)
{
sapi_header_struct sapi_header;
char *colon_offset;
Expand Down Expand Up @@ -830,10 +830,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
}


SAPI_API int sapi_send_headers(void)
SAPI_API zend_result sapi_send_headers(void)
{
int retval;
int ret = FAILURE;
zend_result ret = FAILURE;

if (SG(headers_sent) || SG(request_info).no_headers) {
return SUCCESS;
Expand Down Expand Up @@ -871,7 +871,7 @@ SAPI_API int sapi_send_headers(void)
zend_fcc_dtor(&fcc);
}

SG(headers_sent) = 1;
SG(headers_sent) = true;

if (sapi_module.send_headers) {
retval = sapi_module.send_headers(&SG(sapi_headers));
Expand Down Expand Up @@ -908,7 +908,7 @@ SAPI_API int sapi_send_headers(void)
ret = SUCCESS;
break;
case SAPI_HEADER_SEND_FAILED:
SG(headers_sent) = 0;
SG(headers_sent) = false;
ret = FAILURE;
break;
}
Expand All @@ -919,7 +919,7 @@ SAPI_API int sapi_send_headers(void)
}


SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entries)
{
const sapi_post_entry *p=post_entries;

Expand All @@ -933,16 +933,15 @@ SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
}


SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry)
SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry)
{
int ret;
zend_string *key;
if (SG(sapi_started) && EG(current_execute_data)) {
return FAILURE;
}
key = zend_string_init(post_entry->content_type, post_entry->content_type_len, 1);
GC_MAKE_PERSISTENT_LOCAL(key);
ret = zend_hash_add_mem(&SG(known_post_content_types), key,
zend_result ret = zend_hash_add_mem(&SG(known_post_content_types), key,
(void *) post_entry, sizeof(sapi_post_entry)) ? SUCCESS : FAILURE;
zend_string_release_ex(key, 1);
return ret;
Expand All @@ -958,7 +957,7 @@ SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry)
}


SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void))
SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void))
{
if (SG(sapi_started) && EG(current_execute_data)) {
return FAILURE;
Expand All @@ -968,7 +967,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void)
}


SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
{
if (SG(sapi_started) && EG(current_execute_data)) {
return FAILURE;
Expand All @@ -977,7 +976,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva
return SUCCESS;
}

SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
{
if (SG(sapi_started) && EG(current_execute_data)) {
return FAILURE;
Expand All @@ -987,7 +986,7 @@ SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, co
return SUCCESS;
}

SAPI_API int sapi_flush(void)
SAPI_API zend_result sapi_flush(void)
{
if (sapi_module.flush) {
sapi_module.flush(SG(server_context));
Expand Down
24 changes: 12 additions & 12 deletions main/SAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ typedef struct _sapi_globals_struct {
sapi_request_info request_info;
sapi_headers_struct sapi_headers;
int64_t read_post_bytes;
unsigned char post_read;
unsigned char headers_sent;
bool post_read;
bool headers_sent;
bool sapi_started;
int options;
zend_stat_t global_stat;
char *default_mimetype;
char *default_charset;
HashTable *rfc1867_uploaded_files;
zend_long post_max_size;
int options;
bool sapi_started;
double global_request_time;
HashTable known_post_content_types;
zend_fcall_info_cache send_header_fcc;
Expand Down Expand Up @@ -198,25 +198,25 @@ typedef enum { /* Parameter: */
} sapi_header_op_enum;

BEGIN_EXTERN_C()
SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg);
SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg);

SAPI_API int sapi_add_header_ex(const char *header_line, size_t header_line_len, bool duplicate, bool replace);
#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1)


SAPI_API int sapi_send_headers(void);
SAPI_API zend_result sapi_send_headers(void);
SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
SAPI_API void sapi_handle_post(void *arg);
SAPI_API void sapi_read_post_data(void);
SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen);
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entry);
SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry);
SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entry);
SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry);
SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry);
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void));
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void));
SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));

SAPI_API int sapi_flush(void);
SAPI_API zend_result sapi_flush(void);
SAPI_API zend_stat_t *sapi_get_stat(void);
SAPI_API char *sapi_getenv(const char *name, size_t name_len);

Expand Down
4 changes: 2 additions & 2 deletions main/streams/stream_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ static void php_stream_throw_exception_with_errors(php_stream_error_operation *o
object_init_ex(&ex, php_ce_stream_exception);

/* Set message from first error */
zend_update_property_string(php_ce_stream_exception, Z_OBJ(ex), ZEND_STRL("message"),
ZSTR_VAL(op->first_error->message));
zend_update_property_str(php_ce_stream_exception, Z_OBJ(ex), ZEND_STRL("message"),
op->first_error->message);

/* Set code from first error */
zend_update_property_long(php_ce_stream_exception, Z_OBJ(ex), ZEND_STRL("code"),
Expand Down
12 changes: 6 additions & 6 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ consult the installation file that came with this distribution, or visit \n\
}
fcgi_shutdown();
no_headers = 1;
SG(headers_sent) = 1;
SG(headers_sent) = true;
php_cgi_usage(argv[0]);
php_output_end_all();
exit_status = 0;
Expand Down Expand Up @@ -2325,7 +2325,7 @@ consult the installation file that came with this distribution, or visit \n\
return FAILURE;
}
if (no_headers) {
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;
}
php_print_info(0xFFFFFFFF);
Expand All @@ -2343,7 +2343,7 @@ consult the installation file that came with this distribution, or visit \n\
if (script_file) {
efree(script_file);
}
SG(headers_sent) = 1;
SG(headers_sent) = true;
php_printf("[PHP Modules]\n");
print_modules();
php_printf("\n[Zend Modules]\n");
Expand All @@ -2369,7 +2369,7 @@ consult the installation file that came with this distribution, or visit \n\
free(bindpath);
return FAILURE;
}
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;
php_print_version(&cgi_sapi_module);
php_request_shutdown((void *) 0);
Expand Down Expand Up @@ -2406,7 +2406,7 @@ consult the installation file that came with this distribution, or visit \n\
}

if (no_headers) {
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;
}

Expand Down Expand Up @@ -2466,7 +2466,7 @@ consult the installation file that came with this distribution, or visit \n\
return FAILURE;
}
if (no_headers) {
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static void sapi_cli_server_flush(void *server_context) /* {{{ */

if (!SG(headers_sent)) {
sapi_send_headers();
SG(headers_sent) = 1;
SG(headers_sent) = true;
}
} /* }}} */

Expand Down
10 changes: 5 additions & 5 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ int main(int argc, char *argv[])
case 'm': /* list compiled in modules */
cgi_sapi_module.startup(&cgi_sapi_module);
php_output_activate();
SG(headers_sent) = 1;
SG(headers_sent) = true;
php_printf("[PHP Modules]\n");
print_modules();
php_printf("\n[Zend Modules]\n");
Expand Down Expand Up @@ -1674,7 +1674,7 @@ int main(int argc, char *argv[])
case PHP_GETOPT_INVALID_ARG:
cgi_sapi_module.startup(&cgi_sapi_module);
php_output_activate();
SG(headers_sent) = 1;
SG(headers_sent) = true;
php_cgi_usage(argv[0]);
php_output_end_all();
php_output_deactivate();
Expand All @@ -1689,7 +1689,7 @@ int main(int argc, char *argv[])
php_module_shutdown();
return FPM_EXIT_SOFTWARE;
}
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;

php_print_version(&sapi_module);
Expand All @@ -1710,7 +1710,7 @@ int main(int argc, char *argv[])
php_module_shutdown();
return FPM_EXIT_SOFTWARE;
}
SG(headers_sent) = 1;
SG(headers_sent) = true;
SG(request_info).no_headers = 1;
php_print_info(0xFFFFFFFF);
php_request_shutdown((void *) 0);
Expand All @@ -1723,7 +1723,7 @@ int main(int argc, char *argv[])
if (argc != php_optind) {
cgi_sapi_module.startup(&cgi_sapi_module);
php_output_activate();
SG(headers_sent) = 1;
SG(headers_sent) = true;
php_cgi_usage(argv[0]);
php_output_end_all();
php_output_deactivate();
Expand Down