svn: /php/php-src/ branches/PHP_5_4/main/output.c trunk/main/output.c
| From: | Michael Wallner | Date: | Mon, 30 Jan 2012 12:17:51 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/main/output.c trunk/main/output.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-67576@lists.php.net to get a copy of this message | ||
mike Mon, 30 Jan 2012 12:17:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=322931
Log:
use stderr before, stdout after php_output_startup() and sapi_module.ub_write() after
php_output_activate()
- fixes Bug #60920 CLI: php -v on STDERR
- fixes Bug #60923 Failing tests for sapi/cli
Bugs: https://bugs.php.net/60920 (Critical) CLI: php -v on
STDERR
https://bugs.php.net/60923 (Critical) Failing tests
for sapi/cli
Changed paths:
U php/php-src/branches/PHP_5_4/main/output.c
U php/php-src/trunk/main/output.c
Modified: php/php-src/branches/PHP_5_4/main/output.c
===================================================================
--- php/php-src/branches/PHP_5_4/main/output.c 2012-01-30 11:36:37 UTC (rev 322930)
+++ php/php-src/branches/PHP_5_4/main/output.c 2012-01-30 12:17:51 UTC (rev 322931)
@@ -85,7 +85,12 @@
}
/* }}} */
-/* {{{ stderr writer if not PHP_OUTPUT_ACTIVATED */
+/* {{{ stderr/stdout writer if not PHP_OUTPUT_ACTIVATED */
+static int php_output_stdout(const char *str, size_t str_len)
+{
+ fwrite(str, 1, str_len, stdout);
+ return str_len;
+}
static int php_output_stderr(const char *str, size_t str_len)
{
fwrite(str, 1, str_len, stderr);
@@ -95,6 +100,7 @@
#endif
return str_len;
}
+static int (*php_output_direct)(const char *str, size_t str_len) = php_output_stderr;
/* }}} */
/* {{{ void php_output_startup(void)
@@ -105,6 +111,7 @@
zend_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1);
zend_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1);
zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, (void (*)(void *))
zend_hash_destroy, 1);
+ php_output_direct = php_output_stdout;
}
/* }}} */
@@ -112,6 +119,7 @@
* Destroy module globals and the conflict and reverse conflict hash tables */
PHPAPI void php_output_shutdown(void)
{
+ php_output_direct = php_output_stderr;
zend_hash_destroy(&php_output_handler_aliases);
zend_hash_destroy(&php_output_handler_conflicts);
zend_hash_destroy(&php_output_handler_reverse_conflicts);
@@ -207,7 +215,7 @@
if (OG(flags) & PHP_OUTPUT_ACTIVATED) {
return sapi_module.ub_write(str, len TSRMLS_CC);
}
- return php_output_stderr(str, len);
+ return php_output_direct(str, len);
}
/* }}} */
@@ -222,7 +230,7 @@
php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len TSRMLS_CC);
return (int) len;
}
- return php_output_stderr(str, len);
+ return php_output_direct(str, len);
}
/* }}} */
Modified: php/php-src/trunk/main/output.c
===================================================================
--- php/php-src/trunk/main/output.c 2012-01-30 11:36:37 UTC (rev 322930)
+++ php/php-src/trunk/main/output.c 2012-01-30 12:17:51 UTC (rev 322931)
@@ -85,7 +85,12 @@
}
/* }}} */
-/* {{{ stderr writer if not PHP_OUTPUT_ACTIVATED */
+/* {{{ stderr/stdout writer if not PHP_OUTPUT_ACTIVATED */
+static int php_output_stdout(const char *str, size_t str_len)
+{
+ fwrite(str, 1, str_len, stdout);
+ return str_len;
+}
static int php_output_stderr(const char *str, size_t str_len)
{
fwrite(str, 1, str_len, stderr);
@@ -95,6 +100,7 @@
#endif
return str_len;
}
+static int (*php_output_direct)(const char *str, size_t str_len) = php_output_stderr;
/* }}} */
/* {{{ void php_output_startup(void)
@@ -105,6 +111,7 @@
zend_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1);
zend_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1);
zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, (void (*)(void *))
zend_hash_destroy, 1);
+ php_output_direct = php_output_stdout;
}
/* }}} */
@@ -112,6 +119,7 @@
* Destroy module globals and the conflict and reverse conflict hash tables */
PHPAPI void php_output_shutdown(void)
{
+ php_output_direct = php_output_stderr;
zend_hash_destroy(&php_output_handler_aliases);
zend_hash_destroy(&php_output_handler_conflicts);
zend_hash_destroy(&php_output_handler_reverse_conflicts);
@@ -207,7 +215,7 @@
if (OG(flags) & PHP_OUTPUT_ACTIVATED) {
return sapi_module.ub_write(str, len TSRMLS_CC);
}
- return php_output_stderr(str, len);
+ return php_output_direct(str, len);
}
/* }}} */
@@ -222,7 +230,7 @@
php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len TSRMLS_CC);
return (int) len;
}
- return php_output_stderr(str, len);
+ return php_output_direct(str, len);
}
/* }}} */