1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 12:13:02 +02:00

Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  Added tests for PHAR/OPCahce incompatibilities
  Update NEWS
  Fixed bug #65947 (basename is no more working after fgetcsv in certain situation)
  Update NEWS
  Fixed Bug #66043 (Segfault calling bind_param() on mysqli)
  NEWS entry
  NEWS entry

Conflicts:
	NEWS
This commit is contained in:
Dmitry Stogov
2013-11-08 14:15:41 +04:00
7 changed files with 173 additions and 2 deletions

View File

@@ -385,7 +385,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
my_bool tmp;
#else
uint tmp = 0;
ulong tmp = 0;
#endif
stmt->result.buf[ofs].type = IS_STRING;
/*

View File

@@ -0,0 +1,24 @@
--TEST--
Bug #66043 (Segfault calling bind_param() on mysqli)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once("connect.inc");
if ($IS_MYSQLND) {
die("skip libmysql only test");
}
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require 'connect.inc';
$db = new mysqli($host, $user, $passwd, 'mysql');
$stmt = $db->stmt_init();
$stmt->prepare("SELECT User FROM user WHERE password=\"\"");
$stmt->execute();
$stmt->bind_result($testArg);
echo "Okey";
?>
--EXPECTF--
Okey

View File

@@ -0,0 +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!

View File

@@ -0,0 +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

View File

@@ -0,0 +1,47 @@
<?php
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
define ("PHP_CLI_SERVER_PORT", 8964);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
function php_cli_server_start($ini = "") {
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS;
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
} else {
$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
}
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
$i = 0;
while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
usleep(10000);
}
if ($fp) {
fclose($fp);
}
register_shutdown_function(
function($handle) {
proc_terminate($handle);
},
$handle
);
// don't bother sleeping, server is already up
// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
// sleeping doesn't work.
}
?>

View File

@@ -156,7 +156,7 @@ PHPAPI char *php_strerror(int errnum);
# define php_mblen(ptr, len) 1
#else
# if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state)))
# define php_mblen(ptr, len) ((ptr) == NULL ? memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))): (int)mbrlen(ptr, len, &BG(mblen_state)))
# else
# define php_mblen(ptr, len) mblen(ptr, len)
# endif

View File

@@ -0,0 +1,17 @@
--TEST--
Bug #65947 (basename is no more working after fgetcsv in certain situation)
--SKIPIF--
<?php if (!PHP_ZTS) { print "skip only for zts build"; }
--FILE--
<?php
$filename = 'test.toto';
// é in ISO-8859-1
$csv = base64_decode('6Q==');
$adata = str_getcsv($csv,";");
$b2 = basename($filename);
if ($filename != $b2)
print "BUG";
else
print "OKEY";
--EXPECTF--
OKEY