]> granicus.if.org Git - php/commitdiff
Promote Notice to Warning in libmagic
authorGeorge Peter Banyard <girgias@php.net>
Wed, 8 Jul 2020 16:13:23 +0000 (18:13 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Fri, 10 Jul 2020 12:43:43 +0000 (14:43 +0200)
The current behaviour makes little to no sense, having a notice which starts with 'Warning:' should just be a warning

Closes GH-5824

ext/fileinfo/libmagic.patch
ext/fileinfo/libmagic/print.c
ext/fileinfo/tests/bug61964-mb.phpt
ext/fileinfo/tests/bug61964.phpt
ext/fileinfo/tests/finfo_open_error.phpt

index 19a3fd9cd7f6558f4cf7fefbdb1193a70107b888..5eac52463428a8dd18467a53177e2d8325984dd9 100644 (file)
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
  
 diff -u libmagic.orig/cdf.c libmagic/cdf.c
 --- libmagic.orig/cdf.c        2019-02-20 03:35:27.000000000 +0100
-+++ libmagic/cdf.c     2020-04-07 22:25:10.517321000 +0200
++++ libmagic/cdf.c     2020-05-05 20:05:37.698461100 +0200
 @@ -43,7 +43,17 @@
  #include <err.h>
  #endif
@@ -1395,7 +1395,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
        (void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
 diff -u libmagic.orig/compress.c libmagic/compress.c
 --- libmagic.orig/compress.c   2019-05-07 04:27:11.000000000 +0200
-+++ libmagic/compress.c        2020-04-07 22:25:10.517321000 +0200
++++ libmagic/compress.c        2020-06-17 02:13:31.620121400 +0200
 @@ -45,13 +45,11 @@
  #endif
  #include <string.h>
@@ -1636,7 +1636,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
  }
 diff -u libmagic.orig/file.h libmagic/file.h
 --- libmagic.orig/file.h       2019-05-07 04:27:11.000000000 +0200
-+++ libmagic/file.h    2020-04-22 20:15:46.790840100 +0200
++++ libmagic/file.h    2020-06-21 00:23:48.421548900 +0200
 @@ -33,18 +33,9 @@
  #ifndef __file_h__
  #define __file_h__
@@ -2212,7 +2212,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
        case S_IFSOCK:
 diff -u libmagic.orig/funcs.c libmagic/funcs.c
 --- libmagic.orig/funcs.c      2019-05-07 04:27:11.000000000 +0200
-+++ libmagic/funcs.c   2020-04-14 17:15:50.737587100 +0200
++++ libmagic/funcs.c   2020-06-17 02:13:31.651362400 +0200
 @@ -31,87 +31,80 @@
  #endif        /* lint */
  
@@ -3048,7 +3048,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
  public const char *
  magic_error(struct magic_set *ms)
 diff -u libmagic.orig/magic.h libmagic/magic.h
---- libmagic.orig/magic.h      2020-04-22 20:17:15.432186600 +0200
+--- libmagic.orig/magic.h      2020-07-08 18:10:37.403232400 +0200
 +++ libmagic/magic.h   2020-04-07 22:25:10.548560600 +0200
 @@ -124,6 +124,7 @@
  
@@ -3060,7 +3060,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
  
 diff -u libmagic.orig/print.c libmagic/print.c
 --- libmagic.orig/print.c      2019-03-12 21:43:05.000000000 +0100
-+++ libmagic/print.c   2020-04-07 22:25:10.548560600 +0200
++++ libmagic/print.c   2020-07-08 18:05:40.114527900 +0200
 @@ -28,6 +28,7 @@
  /*
   * print.c - debugging printout routines
@@ -3108,7 +3108,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
 -      (void) fputc('\n', stderr);
 +
 +      if (expanded_len >= 0 && expanded_format) {
-+              php_error_docref(NULL, E_NOTICE, "Warning: %s", expanded_format);
++              php_error_docref(NULL, E_WARNING, "%s", expanded_format);
 +
 +              free(expanded_format);
 +      }
@@ -3253,7 +3253,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
        if (i != -1)
 diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
 --- libmagic.orig/softmagic.c  2019-05-17 04:24:59.000000000 +0200
-+++ libmagic/softmagic.c       2020-04-07 22:25:10.548560600 +0200
++++ libmagic/softmagic.c       2020-04-26 00:43:35.734037100 +0200
 @@ -43,6 +43,10 @@
  #include <time.h>
  #include "der.h"
index deb855d98e6d01fed7d8463d340343c025c4e1f3..94ff571bd03eac48152754244e99857ee60e765a 100644 (file)
@@ -226,7 +226,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
        va_end(va);
 
        if (expanded_len >= 0 && expanded_format) {
-               php_error_docref(NULL, E_NOTICE, "Warning: %s", expanded_format);
+               php_error_docref(NULL, E_WARNING, "%s", expanded_format);
 
                free(expanded_format);
        }
index 0713ac2eb67ea6b423cea5cc1c4f68109596dacb..9187393554eb613a7f3b9398a6a11747619a3343 100644 (file)
@@ -48,15 +48,15 @@ bool(false)%A
 resource(%d) of type (file_info)
 resource(%d) of type (file_info)
 bool(false)%A
-Notice: finfo_open(): Warning: offset `string' invalid in %sbug61964-mb.php on line %d
+Warning: finfo_open(): offset `string' invalid in %sbug61964-mb.php on line %d
 
-Notice: finfo_open(): Warning: offset ` Core' invalid in %sbug61964-mb.php on line %d
+Warning: finfo_open(): offset ` Core' invalid in %sbug61964-mb.php on line %d
 
-Notice: finfo_open(): Warning: offset ` Me' invalid in %sbug61964-mb.php on line %d
+Warning: finfo_open(): offset ` Me' invalid in %sbug61964-mb.php on line %d
 
-Notice: finfo_open(): Warning: offset `a' invalid in %sbug61964-mb.php on line %d
+Warning: finfo_open(): offset `a' invalid in %sbug61964-mb.php on line %d
 
-Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964-mb.php on line %d
+Warning: finfo_open(): offset `b' invalid in %sbug61964-mb.php on line %d
 
 Warning: finfo_open(): Failed to load magic database at '%sbug61964-mb'. in %sbug61964-mb.php on line %d
 DONE: testing dir with files
index 4d891e9731bea5af799137f2e196af00578f0d1f..24cf3bec8c8070c7b1194a216bde895c7694e858 100644 (file)
@@ -48,15 +48,15 @@ bool(false)%A
 resource(%d) of type (file_info)
 resource(%d) of type (file_info)
 bool(false)%A
-Notice: finfo_open(): Warning: offset `string' invalid in %sbug61964.php on line %d
+Warning: finfo_open(): offset `string' invalid in %sbug61964.php on line %d
 
-Notice: finfo_open(): Warning: offset ` Core' invalid in %sbug61964.php on line %d
+Warning: finfo_open(): offset ` Core' invalid in %sbug61964.php on line %d
 
-Notice: finfo_open(): Warning: offset ` Me' invalid in %sbug61964.php on line %d
+Warning: finfo_open(): offset ` Me' invalid in %sbug61964.php on line %d
 
-Notice: finfo_open(): Warning: offset `a' invalid in %sbug61964.php on line %d
+Warning: finfo_open(): offset `a' invalid in %sbug61964.php on line %d
 
-Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964.php on line %d
+Warning: finfo_open(): offset `b' invalid in %sbug61964.php on line %d
 
 Warning: finfo_open(): Failed to load magic database at '%sbug61964'. in %sbug61964.php on line %d
 DONE: testing dir with files
index 4b9ab706fb74534768ac08214df9a1603d3bebaa..fea2c54041d2d0fe9ef4d35d963cc290c121f75f 100644 (file)
@@ -34,7 +34,7 @@ Warning: finfo_open(%sfoobarfile): Failed to open stream: No such file or direct
 Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d
 bool(false)
 
-Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
+Warning: finfo_open(): using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
 resource(6) of type (file_info)
 finfo_open(): Argument #1 ($options) must be of type int, string given
 finfo::__construct(): Argument #1 ($options) must be of type int, string given