diff options
author | Stanislav Malyshev <stas@php.net> | 2014-04-20 17:23:15 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-04-20 17:23:52 -0700 |
commit | 32d5f269a03b554a0d3ebc96fcacc842e3344e4e (patch) | |
tree | 422b9d7e045b2afd1ffbcb7ca2c89ab752c23919 /ext/phar/tests | |
parent | 186ffcb72c982b0235761bdd6388ff1c36d79568 (diff) | |
parent | dafb2af705d0e6c4c747ecf4b3f7cf8e25454dd0 (diff) | |
download | php-git-32d5f269a03b554a0d3ebc96fcacc842e3344e4e.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
Allow valid multi-byte utf-8 characters to be allowed as file names in phar archives.
Diffstat (limited to 'ext/phar/tests')
-rw-r--r-- | ext/phar/tests/create_new_phar.phpt | 8 | ||||
-rw-r--r-- | ext/phar/tests/create_path_error.phpt | 31 |
2 files changed, 32 insertions, 7 deletions
diff --git a/ext/phar/tests/create_new_phar.phpt b/ext/phar/tests/create_new_phar.phpt index ec57c27217..26794095e1 100644 --- a/ext/phar/tests/create_new_phar.phpt +++ b/ext/phar/tests/create_new_phar.phpt @@ -9,8 +9,13 @@ phar.require_hash=1 <?php file_put_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php', - 'brand new!'); + "brand new!\n"); include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php'; + +$fileName = "ChineseFile\xE5\x84\xB7\xE9\xBB\x91.php"; +file_put_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php', + 'Text in utf8 file.'); +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php'; ?> ===DONE=== @@ -18,4 +23,5 @@ include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.pha <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECT-- brand new! +Text in utf8 file. ===DONE=== diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt index d3fc035860..7451d9cd39 100644 --- a/ext/phar/tests/create_path_error.phpt +++ b/ext/phar/tests/create_path_error.phpt @@ -22,15 +22,26 @@ var_dump(file_get_contents($pname . '/b.php')); function error_handler($errno, $errmsg) { - echo "Error: $errmsg\n"; + echo "Error: $errmsg"; } set_error_handler('error_handler'); -$checks = array('/', '.', '../', 'a/..', 'a/', 'b//a.php'); +$count = 0; +$checks = array( + '/', '.', '../', 'a/..', 'a/', 'b//a.php', + "Font\xE5\x84\xB7\xE9\xBB\x91pro.ttf", //two valid multi-byte characters + "\xF0\x9F\x98\x8D.ttf", // valid 4 byte char - smiling face with heart-shaped eyes + "Font\xE9\xBBpro.ttf", //Invalid multi-byte character - missing last byte + "Font\xBB\x91pro.ttf", //Invalid multi-byte character - missing first byte + "\xFC\x81\x81\x81\x81pro.ttf", //RFC 3629 limited char points to 0000-10FFFF aka 5 byte utf-8 not valid +); foreach($checks as $check) { + $count++; + echo "$count:"; file_put_contents($pname . '/' . $check, "error"); + echo "\n"; } $phar = new Phar($fname); @@ -54,9 +65,17 @@ foreach($checks as $check) --EXPECTF-- string(5) "query" string(5) "query" -Error: file_put_contents(phar://%s//): failed to open stream: phar error: file "" in phar "%s" cannot be empty -Error: file_put_contents(phar://%s/.): failed to open stream: phar error: file "" in phar "%s" cannot be empty -Error: file_put_contents(phar://%s/../): failed to open stream: phar error: file "" in phar "%s" cannot be empty -Error: file_put_contents(phar://%s/a/..): failed to open stream: phar error: file "" in phar "%s" cannot be empty +1:Error: file_put_contents(phar://%s//): failed to open stream: phar error: file "" in phar "%s" cannot be empty +2:Error: file_put_contents(phar://%s/.): failed to open stream: phar error: file "" in phar "%s" cannot be empty +3:Error: file_put_contents(phar://%s/../): failed to open stream: phar error: file "" in phar "%s" cannot be empty +4:Error: file_put_contents(phar://%s/a/..): failed to open stream: phar error: file "" in phar "%s" cannot be empty +5: +6: +7: +8: +9:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character +10:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character +11:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character Exception: Entry a does not exist and cannot be created: phar error: invalid path "a" contains illegal character ===DONE=== + |