summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2008-11-22 10:27:19 +0000
committerScott MacVicar <scottmac@php.net>2008-11-22 10:27:19 +0000
commita064b61971afbcf143789efd79833a29921f19d9 (patch)
tree2dde50a41e2a902e3795497ce0998f291c6d780e /ext
parente8326532d4ed3d9313f1a0c1395a338b7dab8f16 (diff)
downloadphp-git-a064b61971afbcf143789efd79833a29921f19d9.tar.gz
Warnings from libmagic should be notices rather than sent to stderr, this fixes a test on Windows
Diffstat (limited to 'ext')
-rw-r--r--ext/fileinfo/libmagic/print.c18
-rw-r--r--ext/fileinfo/tests/finfo_open_error.phpt3
2 files changed, 11 insertions, 10 deletions
diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c
index 3ebbc019ad..5a54fb692c 100644
--- a/ext/fileinfo/libmagic/print.c
+++ b/ext/fileinfo/libmagic/print.c
@@ -29,6 +29,8 @@
* print.c - debugging printout routines
*/
+#include "php.h"
+
#include "file.h"
#include <stdio.h>
#include <errno.h>
@@ -51,18 +53,16 @@ protected void
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
+ char *expanded_format;
+ TSRMLS_FETCH();
- /* cuz we use stdout for most, stderr here */
- (void) fflush(stdout);
-
- if (ms->file)
- (void) fprintf(stderr, "%s, %lu: ", ms->file,
- (unsigned long)ms->line);
- (void) fprintf(stderr, "Warning: ");
va_start(va, f);
- (void) vfprintf(stderr, f, va);
+ vasprintf(&expanded_format, f, va);
va_end(va);
- (void) fputc('\n', stderr);
+
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
+
+ efree(expanded_format);
}
protected const char *
diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt
index 079a2cb738..4aa3736783 100644
--- a/ext/fileinfo/tests/finfo_open_error.phpt
+++ b/ext/fileinfo/tests/finfo_open_error.phpt
@@ -31,7 +31,8 @@ bool(false)
Warning: finfo_open() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
-unknown, 0: Warning: using regular magic file `%s'
+
+Notice: finfo_open(): Warning: using regular magic file `%s' in %s on line %d
resource(%d) of type (file_info)
Warning: finfo_open() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d