mirror of
https://github.com/php/php-src.git
synced 2026-04-20 06:21:12 +02:00
Merge branch 'PHP-5.6'
This commit is contained in:
@@ -1,42 +1,42 @@
|
||||
--TEST--
|
||||
Bug #66338 (Optimization binding of class constants is not safely opcacheable)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$root = str_replace('.php', "", __FILE__);
|
||||
$base = basename( $root );
|
||||
|
||||
file_put_contents( "$root-Officials.inc", '<?php
|
||||
class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } }
|
||||
' );
|
||||
|
||||
file_put_contents( "$root-clientUS.php", '<?php
|
||||
class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; }
|
||||
require "'.$root.'-Officials.inc";
|
||||
printf( "The President of the USA is %s\n", Officials::getLeader() );
|
||||
' );
|
||||
|
||||
file_put_contents( "$root-clientUK.php", '<?php
|
||||
class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; }
|
||||
require "'.$root.'-Officials.inc";
|
||||
printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() );
|
||||
' );
|
||||
|
||||
include "php_cli_server.inc";
|
||||
$uri = sprintf("http://%s/%s", PHP_CLI_SERVER_ADDRESS, basename(__FILE__));
|
||||
$opt = -1; # This test works if $opt = 0
|
||||
php_cli_server_start("-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.optimization_level=$opt -d opcache.file_update_protection=0" );
|
||||
|
||||
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/$base-clientUS.php" );
|
||||
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/$base-clientUK.php" );
|
||||
|
||||
unlink("$root-Officials.inc");
|
||||
unlink("$root-clientUS.php");
|
||||
unlink("$root-clientUK.php");
|
||||
?>
|
||||
--EXPECT--
|
||||
The President of the USA is Barack Hussein Obama II
|
||||
The Prime Minister of the UK is David William Donald Cameron
|
||||
--TEST--
|
||||
Bug #66338 (Optimization binding of class constants is not safely opcacheable)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$root = str_replace('.php', "", __FILE__);
|
||||
$base = basename( $root );
|
||||
|
||||
file_put_contents( "$root-Officials.inc", '<?php
|
||||
class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } }
|
||||
' );
|
||||
|
||||
file_put_contents( "$root-clientUS.php", '<?php
|
||||
class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; }
|
||||
require "'.$root.'-Officials.inc";
|
||||
printf( "The President of the USA is %s\n", Officials::getLeader() );
|
||||
' );
|
||||
|
||||
file_put_contents( "$root-clientUK.php", '<?php
|
||||
class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; }
|
||||
require "'.$root.'-Officials.inc";
|
||||
printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() );
|
||||
' );
|
||||
|
||||
include "php_cli_server.inc";
|
||||
$uri = sprintf("http://%s/%s", PHP_CLI_SERVER_ADDRESS, basename(__FILE__));
|
||||
$opt = -1; # This test works if $opt = 0
|
||||
php_cli_server_start("-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.optimization_level=$opt -d opcache.file_update_protection=0" );
|
||||
|
||||
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/$base-clientUS.php" );
|
||||
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/$base-clientUK.php" );
|
||||
|
||||
unlink("$root-Officials.inc");
|
||||
unlink("$root-clientUS.php");
|
||||
unlink("$root-clientUK.php");
|
||||
?>
|
||||
--EXPECT--
|
||||
The President of the USA is Barack Hussein Obama II
|
||||
The Prime Minister of the UK is David William Donald Cameron
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
--TEST--
|
||||
ISSUE #115 (path issue when using phar)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = '<?php
|
||||
Phar::interceptFileFuncs();
|
||||
require "phar://this/index.php";
|
||||
__HALT_COMPILER(); ?>';
|
||||
$p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 1.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 1!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
$p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 2.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 2!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0115_1.phar.php');
|
||||
@unlink(__DIR__ . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello from Index 1.
|
||||
Hello World 1!
|
||||
Hello from Index 2.
|
||||
Hello World 2!
|
||||
--TEST--
|
||||
ISSUE #115 (path issue when using phar)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = '<?php
|
||||
Phar::interceptFileFuncs();
|
||||
require "phar://this/index.php";
|
||||
__HALT_COMPILER(); ?>';
|
||||
$p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 1.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 1!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
$p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 2.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 2!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0115_1.phar.php');
|
||||
@unlink(__DIR__ . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello from Index 1.
|
||||
Hello World 1!
|
||||
Hello from Index 2.
|
||||
Hello World 2!
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
--TEST--
|
||||
Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq"
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.revalidate_freq=0
|
||||
opcache.file_update_protection=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
define("FILENAME", dirname(__FILE__) . "/issuer0140.inc.php");
|
||||
file_put_contents(FILENAME, "1\n");
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
include(FILENAME);
|
||||
var_dump(filemtime(FILENAME));
|
||||
|
||||
sleep(2);
|
||||
file_put_contents(FILENAME, "2\n");
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
include(FILENAME);
|
||||
var_dump(filemtime(FILENAME));
|
||||
|
||||
sleep(2);
|
||||
unlink(FILENAME);
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
var_dump(@include(FILENAME));
|
||||
var_dump(@filemtime(FILENAME));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
1
|
||||
int(%d)
|
||||
bool(true)
|
||||
2
|
||||
int(%d)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
--TEST--
|
||||
Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq"
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.revalidate_freq=0
|
||||
opcache.file_update_protection=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
define("FILENAME", dirname(__FILE__) . "/issuer0140.inc.php");
|
||||
file_put_contents(FILENAME, "1\n");
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
include(FILENAME);
|
||||
var_dump(filemtime(FILENAME));
|
||||
|
||||
sleep(2);
|
||||
file_put_contents(FILENAME, "2\n");
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
include(FILENAME);
|
||||
var_dump(filemtime(FILENAME));
|
||||
|
||||
sleep(2);
|
||||
unlink(FILENAME);
|
||||
|
||||
var_dump(is_readable(FILENAME));
|
||||
var_dump(@include(FILENAME));
|
||||
var_dump(@filemtime(FILENAME));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
1
|
||||
int(%d)
|
||||
bool(true)
|
||||
2
|
||||
int(%d)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
--TEST--
|
||||
ISSUE #149 (Phar mount points not working this OPcache enabled)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = "<?php header('Content-Type: text/plain;');
|
||||
Phar::mount('this.file', '". __FILE__ . "');
|
||||
echo 'OK\n';
|
||||
__HALT_COMPILER(); ?>";
|
||||
$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this');
|
||||
$p['index.php'] = ""; # A Phar must have at least one file, hence this dummy
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0149.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
--TEST--
|
||||
ISSUE #149 (Phar mount points not working this OPcache enabled)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = "<?php header('Content-Type: text/plain;');
|
||||
Phar::mount('this.file', '". __FILE__ . "');
|
||||
echo 'OK\n';
|
||||
__HALT_COMPILER(); ?>";
|
||||
$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this');
|
||||
$p['index.php'] = ""; # A Phar must have at least one file, hence this dummy
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0149.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
|
||||
Reference in New Issue
Block a user