mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Made ob_start() and friends reentrant. It's now possible to implement this
long-requested functionality, now that output buffering is re-entrant: function eval_ret($code) { ob_start(); eval($code); $retval = ob_get_contents(); ob_end_clean(); return $retval; }
This commit is contained in:
parent
d8a4278ab4
commit
52ff887db5
9 changed files with 176 additions and 105 deletions
|
@ -26,8 +26,9 @@
|
|||
PHPAPI void php_output_startup(void);
|
||||
PHPAPI int php_body_write(const char *str, uint str_length);
|
||||
PHPAPI int php_header_write(const char *str, uint str_length);
|
||||
PHPAPI void php_start_ob_buffering(void);
|
||||
PHPAPI void php_end_ob_buffering(int send_buffer);
|
||||
PHPAPI void php_start_ob_buffer(void);
|
||||
PHPAPI void php_end_ob_buffer(int send_buffer);
|
||||
PHPAPI void php_end_ob_buffers(int send_buffer);
|
||||
PHPAPI int php_ob_get_buffer(pval *p);
|
||||
PHPAPI void php_start_implicit_flush(void);
|
||||
PHPAPI void php_end_implicit_flush(void);
|
||||
|
@ -42,16 +43,22 @@ PHP_FUNCTION(ob_implicit_flush);
|
|||
|
||||
PHP_GINIT_FUNCTION(output);
|
||||
|
||||
typedef struct {
|
||||
typedef struct _php_ob_buffer {
|
||||
char *buffer;
|
||||
uint size;
|
||||
uint text_length;
|
||||
int block_size;
|
||||
} php_ob_buffer;
|
||||
|
||||
typedef struct _php_output_globals {
|
||||
int (*php_body_write)(const char *str, uint str_length); /* string output */
|
||||
int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
|
||||
char *ob_buffer;
|
||||
uint ob_size;
|
||||
uint ob_block_size;
|
||||
uint ob_text_length;
|
||||
php_ob_buffer active_ob_buffer;
|
||||
unsigned char implicit_flush;
|
||||
char *output_start_filename;
|
||||
int output_start_lineno;
|
||||
zend_stack ob_buffers;
|
||||
int nesting_level;
|
||||
} php_output_globals;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue