summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-01-25 14:47:19 +0000
committerPierre Joye <pajoye@php.net>2010-01-25 14:47:19 +0000
commit5eb4db5e8fa197339fdd28f23f447da777623f2b (patch)
treeca97e2057c87526a338b9ec6df67a2c6a6d8d085 /Zend/zend_alloc.c
parentd0ab70458dcb98d5c7de2b6677f571d9fbfca043 (diff)
downloadphp-git-5eb4db5e8fa197339fdd28f23f447da777623f2b.tar.gz
- Ensure that stderr output are not buffered, portability for tests
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index ed9aeb879b..8c7397a722 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -84,6 +84,10 @@ static void zend_mm_panic(const char *message) __attribute__ ((noreturn));
static void zend_mm_panic(const char *message)
{
fprintf(stderr, "%s\n", message);
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
kill(getpid(), SIGSEGV);
#endif
@@ -1031,11 +1035,19 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers,
if (zend_mm_low_bit(block_size) != zend_mm_high_bit(block_size)) {
fprintf(stderr, "'block_size' must be a power of two\n");
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
exit(255);
}
storage = handlers->init(params);
if (!storage) {
fprintf(stderr, "Cannot initialize zend_mm storage [%s]\n", handlers->name);
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
exit(255);
}
storage->handlers = handlers;
@@ -1118,9 +1130,17 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
if (!mem_handlers[i].name) {
fprintf(stderr, "Wrong or unsupported zend_mm storage type '%s'\n", mem_type);
fprintf(stderr, " supported types:\n");
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
for (i = 0; mem_handlers[i].name; i++) {
fprintf(stderr, " '%s'\n", mem_handlers[i].name);
}
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
exit(255);
}
}
@@ -1131,9 +1151,17 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
seg_size = zend_atoi(tmp, 0);
if (zend_mm_low_bit(seg_size) != zend_mm_high_bit(seg_size)) {
fprintf(stderr, "ZEND_MM_SEG_SIZE must be a power of two\n");
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
exit(255);
} else if (seg_size < ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE) {
fprintf(stderr, "ZEND_MM_SEG_SIZE is too small\n");
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
exit(255);
}
} else {
@@ -1672,6 +1700,10 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
size);
fprintf(stderr, " in %s on line %d\n", error_filename, error_lineno);
}
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
} zend_end_try();
} else {
heap->overflow = 2;