Skip to content

Commit 4b22cb2

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: fileinfo: Backport svg detection patch
2 parents 0f5b382 + 1f5bea3 commit 4b22cb2

File tree

6 files changed

+186
-150
lines changed

6 files changed

+186
-150
lines changed

ext/fileinfo/data_file.c

+146-146
Large diffs are not rendered by default.

ext/fileinfo/magicdata.patch

+20
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,23 @@ diff -ur Magdir/securitycerts Magdir.orig/securitycerts
7878
0 belong 0xedfeedfe Sun 'jks' Java Keystore File data
7979
-
8080
-0 string \0volume_key volume_key escrow packet
81+
diff -ur Magdir/sgml Magdir.orig/sgml
82+
--- Magdir/sgml 2023-08-09 16:00:55.807784619 +0000
83+
+++ Magdir.orig/sgml 2021-02-23 00:49:24.000000000 +0000
84+
@@ -3,14 +3,13 @@
85+
# $File: sgml,v 1.42 2020/12/12 20:01:47 christos Exp $
86+
# Type: SVG Vectorial Graphics
87+
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
88+
-0 string/bt \<?xml\ version=
89+
+0 string \<?xml\ version=
90+
>14 regex ['"\ \t]*[0-9.]+['"\ \t]*
91+
>>19 search/4096 \<svg SVG Scalable Vector Graphics image
92+
-!:strength +50
93+
!:mime image/svg+xml
94+
>>19 search/4096 \<gnc-v2 GnuCash file
95+
!:mime application/x-gnucash
96+
-0 string/bt \<svg SVG Scalable Vector Graphics image
97+
+0 string \<svg SVG Scalable Vector Graphics image
98+
!:mime image/svg+xml
99+
100+
# Sitemap file

ext/fileinfo/tests/bug-gh11891.phpt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug GH-11891: fileinfo returns text/xml for some svg files
3+
--EXTENSIONS--
4+
fileinfo
5+
--FILE--
6+
<?php
7+
var_dump(
8+
(new \finfo(\FILEINFO_MIME_TYPE))->file(
9+
__DIR__ . '/bug-gh11891.svg',
10+
),
11+
);
12+
?>
13+
--EXPECT--
14+
string(13) "image/svg+xml"

ext/fileinfo/tests/bug-gh11891.svg

686 Bytes
Loading

ext/fileinfo/tests/magic

+3-2
Original file line numberDiff line numberDiff line change
@@ -30298,13 +30298,14 @@
3029830298
# $File: sgml,v 1.42 2020/12/12 20:01:47 christos Exp $
3029930299
# Type: SVG Vectorial Graphics
3030030300
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
30301-
0 string \<?xml\ version=
30301+
0 string/bt \<?xml\ version=
3030230302
>14 regex ['"\ \t]*[0-9.]+['"\ \t]*
3030330303
>>19 search/4096 \<svg SVG Scalable Vector Graphics image
30304+
!:strength +50
3030430305
!:mime image/svg+xml
3030530306
>>19 search/4096 \<gnc-v2 GnuCash file
3030630307
!:mime application/x-gnucash
30307-
0 string \<svg SVG Scalable Vector Graphics image
30308+
0 string/bt \<svg SVG Scalable Vector Graphics image
3030830309
!:mime image/svg+xml
3030930310

3031030311
# Sitemap file

ext/fileinfo/tests/magic私はガラスを食べられます

+3-2
Original file line numberDiff line numberDiff line change
@@ -30298,13 +30298,14 @@
3029830298
# $File: sgml,v 1.42 2020/12/12 20:01:47 christos Exp $
3029930299
# Type: SVG Vectorial Graphics
3030030300
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
30301-
0 string \<?xml\ version=
30301+
0 string/bt \<?xml\ version=
3030230302
>14 regex ['"\ \t]*[0-9.]+['"\ \t]*
3030330303
>>19 search/4096 \<svg SVG Scalable Vector Graphics image
30304+
!:strength +50
3030430305
!:mime image/svg+xml
3030530306
>>19 search/4096 \<gnc-v2 GnuCash file
3030630307
!:mime application/x-gnucash
30307-
0 string \<svg SVG Scalable Vector Graphics image
30308+
0 string/bt \<svg SVG Scalable Vector Graphics image
3030830309
!:mime image/svg+xml
3030930310

3031030311
# Sitemap file

0 commit comments

Comments
 (0)