From 11b4f3becd371dae9f76ec18d2197edf53130db7 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 24 May 2012 13:42:47 -0300 Subject: [PATCH] - Fixed magic file regex support --- ext/fileinfo/libmagic/softmagic.c | 25 +-------------------- ext/fileinfo/tests/finfo_file_002.phpt | 4 +++- ext/fileinfo/tests/finfo_file_regex.phpt | 28 ++++++++++++++++++++++++ ext/fileinfo/tests/resources/test.awk | 1 + 4 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 ext/fileinfo/tests/finfo_file_regex.phpt create mode 100644 ext/fileinfo/tests/resources/test.awk diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index 648f641697..f9c2836dd2 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -1654,29 +1654,6 @@ convert_libmagic_pattern(zval *pattern, int options) for (i=0; i --EXPECTF-- -array(6) { +array(7) { ["%s/resources/dir.zip"]=> string(15) "application/zip" + ["%s/resources/test.awk"]=> + string(10) "text/plain" ["%s/resources/test.bmp"]=> string(14) "image/x-ms-bmp" ["%s/resources/test.gif"]=> diff --git a/ext/fileinfo/tests/finfo_file_regex.phpt b/ext/fileinfo/tests/finfo_file_regex.phpt new file mode 100644 index 0000000000..c1cc36f2b3 --- /dev/null +++ b/ext/fileinfo/tests/finfo_file_regex.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test finfo_file() function : regex rules +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing finfo_file() : regex rules *** +string(28) "text/plain; charset=us-ascii" +string(22) "awk script, ASCII text" +===DONE=== diff --git a/ext/fileinfo/tests/resources/test.awk b/ext/fileinfo/tests/resources/test.awk new file mode 100644 index 0000000000..e000d50419 --- /dev/null +++ b/ext/fileinfo/tests/resources/test.awk @@ -0,0 +1 @@ +BEGIN { print "START" } -- 2.49.0