summaryrefslogtreecommitdiff
path: root/main/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/output.c')
-rw-r--r--main/output.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/output.c b/main/output.c
index cbf1fed9f0..83225107e0 100644
--- a/main/output.c
+++ b/main/output.c
@@ -240,6 +240,13 @@ PHPAPI int php_output_get_status(TSRMLS_D)
* Unbuffered write */
PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
{
+#if PHP_DEBUG
+ if (len > UINT_MAX) {
+ php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; "
+ "output will be truncated %lu => %lu",
+ (unsigned long) len, (unsigned long) (len % UINT_MAX));
+ }
+#endif
if (OG(flags) & PHP_OUTPUT_DISABLED) {
return 0;
}
@@ -254,6 +261,13 @@ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
* Buffered write */
PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC)
{
+#if PHP_DEBUG
+ if (len > UINT_MAX) {
+ php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; "
+ "output will be truncated %lu => %lu",
+ (unsigned long) len, (unsigned long) (len % UINT_MAX));
+ }
+#endif
if (OG(flags) & PHP_OUTPUT_DISABLED) {
return 0;
}