mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
- Ensure that stderr output are not buffered, portability for tests
This commit is contained in:
parent
d0ab70458d
commit
5eb4db5e8f
@ -84,6 +84,10 @@ static void zend_mm_panic(const char *message) __attribute__ ((noreturn));
|
|||||||
static void zend_mm_panic(const char *message)
|
static void zend_mm_panic(const char *message)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", 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)
|
#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
|
||||||
kill(getpid(), SIGSEGV);
|
kill(getpid(), SIGSEGV);
|
||||||
#endif
|
#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)) {
|
if (zend_mm_low_bit(block_size) != zend_mm_high_bit(block_size)) {
|
||||||
fprintf(stderr, "'block_size' must be a power of two\n");
|
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);
|
exit(255);
|
||||||
}
|
}
|
||||||
storage = handlers->init(params);
|
storage = handlers->init(params);
|
||||||
if (!storage) {
|
if (!storage) {
|
||||||
fprintf(stderr, "Cannot initialize zend_mm storage [%s]\n", handlers->name);
|
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);
|
exit(255);
|
||||||
}
|
}
|
||||||
storage->handlers = handlers;
|
storage->handlers = handlers;
|
||||||
@ -1118,9 +1130,17 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
|
|||||||
if (!mem_handlers[i].name) {
|
if (!mem_handlers[i].name) {
|
||||||
fprintf(stderr, "Wrong or unsupported zend_mm storage type '%s'\n", mem_type);
|
fprintf(stderr, "Wrong or unsupported zend_mm storage type '%s'\n", mem_type);
|
||||||
fprintf(stderr, " supported types:\n");
|
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++) {
|
for (i = 0; mem_handlers[i].name; i++) {
|
||||||
fprintf(stderr, " '%s'\n", mem_handlers[i].name);
|
fprintf(stderr, " '%s'\n", mem_handlers[i].name);
|
||||||
}
|
}
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1131,9 +1151,17 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
|
|||||||
seg_size = zend_atoi(tmp, 0);
|
seg_size = zend_atoi(tmp, 0);
|
||||||
if (zend_mm_low_bit(seg_size) != zend_mm_high_bit(seg_size)) {
|
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");
|
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);
|
exit(255);
|
||||||
} else if (seg_size < ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE) {
|
} else if (seg_size < ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE) {
|
||||||
fprintf(stderr, "ZEND_MM_SEG_SIZE is too small\n");
|
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);
|
exit(255);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1672,6 +1700,10 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
|
|||||||
size);
|
size);
|
||||||
fprintf(stderr, " in %s on line %d\n", error_filename, error_lineno);
|
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();
|
} zend_end_try();
|
||||||
} else {
|
} else {
|
||||||
heap->overflow = 2;
|
heap->overflow = 2;
|
||||||
|
@ -1232,6 +1232,10 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
|
|||||||
{
|
{
|
||||||
if (Z_TYPE_PP(pz) > 9) {
|
if (Z_TYPE_PP(pz) > 9) {
|
||||||
fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
|
fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
} else if (Z_TYPE_PP(pz) == IS_ARRAY) {
|
} else if (Z_TYPE_PP(pz) == IS_ARRAY) {
|
||||||
zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
|
zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
|
||||||
} else if (Z_TYPE_PP(pz) == IS_OBJECT) {
|
} else if (Z_TYPE_PP(pz) == IS_OBJECT) {
|
||||||
|
@ -74,6 +74,10 @@ static void zend_handle_sigsegv(int dummy) /* {{{ */
|
|||||||
get_active_function_name(TSRMLS_C),
|
get_active_function_name(TSRMLS_C),
|
||||||
zend_get_executed_filename(TSRMLS_C),
|
zend_get_executed_filename(TSRMLS_C),
|
||||||
zend_get_executed_lineno(TSRMLS_C));
|
zend_get_executed_lineno(TSRMLS_C));
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (original_sigsegv_handler!=zend_handle_sigsegv) {
|
if (original_sigsegv_handler!=zend_handle_sigsegv) {
|
||||||
original_sigsegv_handler(dummy);
|
original_sigsegv_handler(dummy);
|
||||||
|
@ -35,6 +35,10 @@ int zend_load_extension(const char *path)
|
|||||||
if (!handle) {
|
if (!handle) {
|
||||||
#ifndef ZEND_WIN32
|
#ifndef ZEND_WIN32
|
||||||
fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
|
fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Failed loading %s\n", path);
|
fprintf(stderr, "Failed loading %s\n", path);
|
||||||
#endif
|
#endif
|
||||||
@ -51,6 +55,10 @@ int zend_load_extension(const char *path)
|
|||||||
}
|
}
|
||||||
if (!extension_version_info || !new_extension) {
|
if (!extension_version_info || !new_extension) {
|
||||||
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
|
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
DL_UNLOAD(handle);
|
DL_UNLOAD(handle);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
@ -64,6 +72,10 @@ int zend_load_extension(const char *path)
|
|||||||
new_extension->name,
|
new_extension->name,
|
||||||
extension_version_info->zend_extension_api_no,
|
extension_version_info->zend_extension_api_no,
|
||||||
ZEND_EXTENSION_API_NO);
|
ZEND_EXTENSION_API_NO);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
DL_UNLOAD(handle);
|
DL_UNLOAD(handle);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
||||||
@ -76,6 +88,10 @@ int zend_load_extension(const char *path)
|
|||||||
new_extension->author,
|
new_extension->author,
|
||||||
new_extension->URL,
|
new_extension->URL,
|
||||||
new_extension->name);
|
new_extension->name);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
DL_UNLOAD(handle);
|
DL_UNLOAD(handle);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
@ -83,6 +99,10 @@ int zend_load_extension(const char *path)
|
|||||||
(!new_extension->build_id_check || new_extension->build_id_check(ZEND_EXTENSION_BUILD_ID) != SUCCESS)) {
|
(!new_extension->build_id_check || new_extension->build_id_check(ZEND_EXTENSION_BUILD_ID) != SUCCESS)) {
|
||||||
fprintf(stderr, "Cannot load %s - it was built with configuration %s, whereas running engine is %s\n",
|
fprintf(stderr, "Cannot load %s - it was built with configuration %s, whereas running engine is %s\n",
|
||||||
new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID);
|
new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
DL_UNLOAD(handle);
|
DL_UNLOAD(handle);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
@ -90,6 +110,10 @@ int zend_load_extension(const char *path)
|
|||||||
return zend_register_extension(new_extension, handle);
|
return zend_register_extension(new_extension, handle);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,10 @@ php_output_globals output_globals;
|
|||||||
PHPAPI int php_default_output_func(const char *str, uint str_len TSRMLS_DC)
|
PHPAPI int php_default_output_func(const char *str, uint str_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
fwrite(str, 1, str_len, stderr);
|
fwrite(str, 1, str_len, stderr);
|
||||||
|
/* See http://support.microsoft.com/kb/190351 */
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
return str_len;
|
return str_len;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
Loading…
Reference in New Issue
Block a user