scottmac Sat Nov 22 10:27:19 2008 UTC
Modified files:
/php-src/ext/fileinfo/libmagic print.c
/php-src/ext/fileinfo/tests finfo_open_error.phpt
Log:
Warnings from libmagic should be notices rather than sent to stderr, this
fixes a test on Windows
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/libmagic/print.c?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/fileinfo/libmagic/print.c
diff -u php-src/ext/fileinfo/libmagic/print.c:1.4
php-src/ext/fileinfo/libmagic/print.c:1.5
--- php-src/ext/fileinfo/libmagic/print.c:1.4 Wed Oct 15 22:57:22 2008
+++ php-src/ext/fileinfo/libmagic/print.c Sat Nov 22 10:27:19 2008
@@ -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 @@
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 *
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/finfo_open_error.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/fileinfo/tests/finfo_open_error.phpt
diff -u php-src/ext/fileinfo/tests/finfo_open_error.phpt:1.2
php-src/ext/fileinfo/tests/finfo_open_error.phpt:1.3
--- php-src/ext/fileinfo/tests/finfo_open_error.phpt:1.2 Fri Aug 29
10:34:34 2008
+++ php-src/ext/fileinfo/tests/finfo_open_error.phpt Sat Nov 22 10:27:19 2008
@@ -31,7 +31,8 @@
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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php