diff options
-rw-r--r-- | ext/standard/info.c | 10 | ||||
-rw-r--r-- | main/main.c | 48 | ||||
-rw-r--r-- | main/php_ini.c | 2 | ||||
-rw-r--r-- | main/php_main.h | 2 |
4 files changed, 9 insertions, 53 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c index 1b7328813d..8b8c7d7a1a 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -79,7 +79,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) PUTS("[\""); switch (zend_hash_get_current_key(Z_ARRVAL_PP(data), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - php_html_puts(string_key, strlen(string_key) TSRMLS_CC); + zend_html_puts(string_key, strlen(string_key)); break; case HASH_KEY_IS_LONG: php_printf("%ld", num_key); @@ -94,10 +94,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); - php_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2) TSRMLS_CC); + zend_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); zval_dtor(&tmp2); } else { - php_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) TSRMLS_CC); + zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PUTS(" </td></tr>\n"); zend_hash_move_forward(Z_ARRVAL_PP(data)); @@ -290,7 +290,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n"); } php_printf("This program makes use of the Zend Scripting Language Engine:<br />"); - php_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); + zend_html_puts(zend_version, strlen(zend_version)); php_info_print_box_end(); efree(php_uname); } @@ -482,7 +482,7 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) if (!row_element || !*row_element) { php_printf(" "); } else { - php_html_puts(row_element, strlen(row_element) TSRMLS_CC); + zend_html_puts(row_element, strlen(row_element)); } php_printf("%s</td>", (i==0?"</b>":"")); diff --git a/main/main.c b/main/main.c index 26c21068b8..96411157ba 100644 --- a/main/main.c +++ b/main/main.c @@ -377,54 +377,12 @@ PHPAPI int php_printf(const char *format, ...) } /* }}} */ -/* {{{ php_html_puts */ -#include "ext/standard/php_smart_str.h" +/* {{{ php_html_puts */ +/* wrapper for backwards compatibility */ PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) { - const char *end = str+size; - const char *p = str; - smart_str s = {0}; - - while (p < end) { - switch (*p) { - case '\n': - smart_str_appendl(&s, "<br />", sizeof("<br />")-1); - break; - case '<': - smart_str_appendl(&s, "<", sizeof("<")-1); - break; - case '>': - smart_str_appendl(&s, ">", sizeof(">")-1); - break; - case '&': - smart_str_appendl(&s, "&", sizeof("&")-1); - break; - case ' ': { - const char *nextchar = p+1, *prevchar = p-1; - - /* series of spaces should be converted to 's */ - if (((nextchar < end) && *nextchar==' ') - || ((prevchar >= str) && *prevchar==' ')) { - smart_str_appendl(&s, " ", sizeof(" ")-1); - } else { - smart_str_appendc(&s, ' '); - } - } - break; - case '\t': - smart_str_appendl(&s, " ", sizeof(" ")-1); - break; - default: - smart_str_appendc(&s, *p); - } - p++; - } - - if (s.c) { - PHPWRITE(s.c, s.len); - smart_str_free(&s); - } + zend_html_puts(str, size); } /* }}} */ diff --git a/main/php_ini.c b/main/php_ini.c index e0bb7e2013..2d4c8f5f55 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -74,7 +74,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) display_string_length = sizeof("<i>no value</i>")-1; } if(esc_html) { - php_html_puts(display_string, display_string_length TSRMLS_CC); + zend_html_puts(display_string, display_string_length); } else { PHPWRITE(display_string, display_string_length); } diff --git a/main/php_main.h b/main/php_main.h index 0ae80136cd..ea9137c5f8 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -45,8 +45,6 @@ PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC); PHPAPI void php_handle_aborted_connection(void); PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC); -PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC); - extern void php_call_shutdown_functions(void); /* environment module */ |