From 27c973a954375a3706d4a1685334444713e14af8 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 26 Jul 2015 20:31:32 +0200 Subject: [PATCH] exclude the platform diff case from the test Say the string is \377\000, basename will use mbrlen() to check whether it's a start of a multibyte sequence. While on Linux it'll return -1 for any char in the extended ASCII, on Windows it's returning 1. From what I see the reason is that Windows doesn't implement UTF-8 in the CRT lib, it's rather 16-bit Unicode or DBCS. Since extended ASCII is convertable to Unicode directly - thus the behavior. On Linux however, it's a true UTF-8 locale and implementation, for it \377\000 is invalid. Maybe mbrlen needs an independent implementation for Windows supporting UTF-8. For now I just split out this case so the most of the big basename test doesn't fail on this one case. --- .../tests/strings/basename_invalid_path.phpt | 22 +++++++++++++++++++ .../strings/basename_invalid_path_win.phpt | 22 +++++++++++++++++++ .../tests/strings/basename_variation.phpt | 6 ----- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 ext/standard/tests/strings/basename_invalid_path.phpt create mode 100644 ext/standard/tests/strings/basename_invalid_path_win.phpt diff --git a/ext/standard/tests/strings/basename_invalid_path.phpt b/ext/standard/tests/strings/basename_invalid_path.phpt new file mode 100644 index 0000000000..b632efa845 --- /dev/null +++ b/ext/standard/tests/strings/basename_invalid_path.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test basename() function : usage variations with invalid paths +--SKIPIF-- + +--FILE-- + +--FILE-- +