1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00

make cache_list tests pass in php 6

This commit is contained in:
Greg Beaver
2009-07-26 03:07:23 +00:00
parent d46a947d23
commit e7e232cd2b
17 changed files with 19 additions and 34 deletions

View File

@@ -941,19 +941,7 @@ PHP_METHOD(Phar, webPhar)
++ext;
#if PHP_MAJOR_VERSION >= 6
if (FAILURE == zend_hash_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) {
/* try unicode extension */
zstr zext;
zspprintf(IS_UNICODE, &zext, 0, "%s", ext);
if (SUCCESS == zend_u_hash_find(Z_ARRVAL_P(mimeoverride), IS_UNICODE, zext, strlen(ext)+1, (void **) &val)) {
ezfree(zext);
goto unicode_found;
}
ezfree(zext);
goto notfound;
}
unicode_found:
{ /* this prevents parse error */
if (phar_find_key(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) {
#else
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) {
#endif
@@ -990,9 +978,6 @@ unicode_found:
}
}
#if PHP_MAJOR_VERSION >= 6
notfound:
#endif
if (!mime_type) {
code = phar_file_type(&PHAR_G(mime_types), entry, &mime_type TSRMLS_CC);
}

View File

@@ -10,5 +10,5 @@ phar.readonly=0
files/write17.phar
--EXPECTF--
NULL
string(2) "hi"
%string|unicode%(2) "hi"
ok

View File

@@ -10,5 +10,5 @@ phar.readonly=0
files/write19.phar
--EXPECTF--
string(2) "hi"
string(3) "hi2"
%string|unicode%(3) "hi2"
ok

View File

@@ -3,13 +3,13 @@
$a = new Phar(dirname(__FILE__) . '/frontcontroller12.phar');
$a['index.php'] = '<?php
var_dump($_SERVER["PHP_SELF"]);
var_dump($_SERVER["SCRIPT_NAME"]);
var_dump($_SERVER["SCRIPT_FILENAME"]);
var_dump($_SERVER["REQUEST_URI"]);
var_dump($_SERVER["PHAR_PHP_SELF"]);
var_dump($_SERVER["PHAR_SCRIPT_NAME"]);
var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]);
var_dump($_SERVER["PHAR_REQUEST_URI"]);
var_dump($_SERVER[b"SCRIPT_NAME"]);
var_dump($_SERVER[b"SCRIPT_FILENAME"]);
var_dump($_SERVER[b"REQUEST_URI"]);
var_dump($_SERVER[b"PHAR_PHP_SELF"]);
var_dump($_SERVER[b"PHAR_SCRIPT_NAME"]);
var_dump($_SERVER[b"PHAR_SCRIPT_FILENAME"]);
var_dump($_SERVER[b"PHAR_REQUEST_URI"]);
';
$a->setStub('<?php
Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI"));

View File

@@ -2,8 +2,8 @@
@unlink(dirname(__FILE__) . '/frontcontroller14.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller14.phar');
$a['html/index.php'] = '<?php
var_dump($_SERVER["PATH_INFO"]);
var_dump($_SERVER["PATH_TRANSLATED"]);
var_dump($_SERVER[b"PATH_INFO"]);
var_dump($_SERVER[b"PATH_TRANSLATED"]);
';
$a->setStub('<?php
function s($a)

View File

@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
static $b = array("/hi" => "a.phps");
static $b = array(b"/hi" => "a.phps");
if (isset($b[$a])) return $b[$a];
return $a;
}

View File

@@ -7,7 +7,7 @@ $a['a.phps'] = '<?php function hio(){}';
$a->setStub('<?php
function s($a)
{
static $b = array("/hi" => false);
static $b = array(b"/hi" => false);
if (isset($b[$a])) return $b[$a];
return $a;
}

View File

@@ -2,7 +2,7 @@
@unlink(dirname(__FILE__) . '/frontcontroller8.phar');
$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar');
$a['a.phps'] = 'hio1';
$a['a1.phps'] = '<?php var_dump($_SERVER["REQUEST_URI"], $_SERVER["PATH_INFO"]);';
$a['a1.phps'] = '<?php var_dump($_SERVER[b"REQUEST_URI"], $_SERVER[b"PATH_INFO"]);';
$a['a.jpg'] = 'hio2';
$a['a.php'] = '<?php function hio(){}';
$a['fronk.gronk'] = 'hio3';

View File

@@ -8,7 +8,7 @@ $phar->setStub('<?php
$p = new Phar(__FILE__);
var_dump(isset($p["newname"]));
$fp = fopen("phar://" . __FILE__ . "/newname", "w");
fwrite($fp, "hi");
fwrite($fp, b"hi");
fclose($fp);
var_dump(isset($p["newname"]));
echo "ok\n";

View File

@@ -15,7 +15,7 @@ files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(10) "/index.php"
%unicode|string%(10) "/index.php"
string(10) "/index.php"
string(%d) "phar://%sfrontcontroller21.php/index.php"
string(18) "/index.php?test=hi"

View File

@@ -14,8 +14,8 @@ files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(4) "test"
string(12) "oof/test.php"
%string|unicode%(4) "test"
%string|unicode%(12) "oof/test.php"
Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d