mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: (146 commits) Flush stderr on win32 in cli_log_message Fixed bug #73154 FIx bug #70213 Fix dom class can't be inherited by the internal class Another try at making concat_003 more reliable Fix flaky openssl_pkey_new test Make Opcache tests using the cli server more reliable Revert "Fix #73530: Unsetting result set may reset other result set" define php_ap_map_http_request_error function for older httpd only add old versions of httpd support Disable AppVeyor fast_finish Makes the sapi web server and curl tests more reliable Fixes the curl tests to be more reliable in Travis CI Interpretation of curl_setopt values for boolean parameters Fixes #65689. PDO_Firebrid / exec() does not free allocated statement. Fix alpn_ctx leaking in openssl Fixed bug #73373 (deflate_add does not verify that output was not truncated) Fix IS_UNDEF comparisons in opcache Fixed bug #73704 (phpdbg shows the wrong line in files with shebang) Increase timing quota for small string concat test ...
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
version: "{branch}.build.{build}"
|
||||
|
||||
image: Visual Studio 2015
|
||||
|
||||
clone_depth: 64
|
||||
|
||||
cache:
|
||||
- c:\build-cache
|
||||
- c:\build-cache\sdk -> .appveyor.yml
|
||||
|
||||
environment:
|
||||
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: c:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.0alpha6
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
#MYSQL_TEST_USER: root
|
||||
#PDO_MYSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=root password=Password12!"
|
||||
#PDO_MYSQL_TEST_USER: root
|
||||
#PDO_MYSQL_TEST_PASS: Password12!
|
||||
#PGSQL_TEST_CONNSTR: "host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!"
|
||||
#PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=Password12!"
|
||||
#build permutations
|
||||
matrix:
|
||||
- THREAD_SAFE: 0
|
||||
OPCACHE: 0
|
||||
- THREAD_SAFE: 1
|
||||
OPCACHE: 1
|
||||
|
||||
services:
|
||||
# the setup scripts have to be touched, once some other db version is used
|
||||
- mysql
|
||||
- postgresql95
|
||||
|
||||
platform:
|
||||
- x64
|
||||
# - x86
|
||||
|
||||
build_script:
|
||||
- appveyor\build.bat
|
||||
|
||||
test_script:
|
||||
- appveyor\test.bat
|
||||
|
||||
@@ -1,14 +1,68 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2016 PHP 7.0.14
|
||||
?? ??? 2016 PHP 7.0.15
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73792 (invalid foreach loop hangs script). (Dmitry)
|
||||
. Fixed bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created
|
||||
with list()). (Laruence)
|
||||
. Fixed bug #73585 (Logging of "Internal Zend error - Missing class
|
||||
information" missing class name). (Laruence)
|
||||
. Fixed bug #73753 (unserialized array pointer not advancing). (David Walker)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #73679 (DOTNET read access violation using invalid codepage).
|
||||
(Anatol)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed issue with decoding BIT columns when having more than one rows in the
|
||||
result set. 7.0+ problem. (Andrey)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #73612 (preg_*() may leak memory). (cmb)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #72931 (PDO_FIREBIRD with Firebird 3.0 not work on returning
|
||||
statement). (Dorin Marcoci)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #73586 (php_user_filter::$stream is not set to the stream the
|
||||
filter is working on). (Dmitry)
|
||||
|
||||
- Phpdbg:
|
||||
. Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup).
|
||||
(Bob)
|
||||
. Fixed issue getting executable lines from custom wrappers. (Bob)
|
||||
. Fixed bug #73704 (phpdbg shows the wrong line in files with shebang). (Bob)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #46103 (ReflectionObject memory leak). (Nikita)
|
||||
|
||||
- SQLite3:
|
||||
. Reverted fix for bug #73530 (Unsetting result set may reset other result
|
||||
set). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73594 (dns_get_record does not populate $additional out
|
||||
parameter). (Bruce Weirdan)
|
||||
. Fixed bug #70213 (Unserialize context shared on double class lookup).
|
||||
(Taoguang Chen)
|
||||
. Fixed bug #73154 (serialize object with __sleep function crash). (Nikita)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #73373 (deflate_add does not verify that output was not truncated).
|
||||
(Matt Bonneau)
|
||||
|
||||
08 Dec 2016 PHP 7.0.14
|
||||
|
||||
- Core:
|
||||
. Fixed memory leak(null coalescing operator with Spl hash). (Tyson Andre)
|
||||
. Fixded bug #72736 (Slow performance when fetching large dataset with mysqli
|
||||
/ PDO). (Dmitry)
|
||||
|
||||
- Calendar:
|
||||
. Fix integer overflows (Joshua Rogers)
|
||||
|
||||
- Core:
|
||||
. Fixded bug #72736 (Slow performance when fetching large dataset with mysqli
|
||||
/ PDO). (Dmitry)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #69587 (DateInterval properties and isset). (jhdxr)
|
||||
|
||||
@@ -17,9 +71,12 @@ PHP NEWS
|
||||
This may be enabled again using envirionment variable USE_ZEND_DTRACE=1.
|
||||
(Dmitry)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #64526 (Add missing mysqlnd.* parameters to php.ini-*). (cmb)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #73526 (php_json_encode depth issue). (Jakub Zelenka)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #64526 (Add missing mysqlnd.* parameters to php.ini-*). (cmb)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #73448 (odbc_errormsg returns trash, always 513 bytes).
|
||||
(Anatol)
|
||||
@@ -29,6 +86,7 @@ PHP NEWS
|
||||
. Fixed bug #73546 (Logging for opcache has an empty file name). (mhagstrand)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #73483 (Segmentation fault on pcre_replace_callback). (Laruence)
|
||||
. Fixed bug #73392 (A use-after-free in zend allocator management).
|
||||
(Laruence)
|
||||
|
||||
@@ -36,6 +94,17 @@ PHP NEWS
|
||||
. Fixed bug #73087, #61183, #71494 (Memory corruption in bindParam).
|
||||
(Dorin Marcoci)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #73498 (Incorrect SQL generated for pg_copy_to()). (Craig Duncan)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #73580 (Phar::isValidPharFilename illegal memory access). (Stas)
|
||||
|
||||
- Soap:
|
||||
. Fixed bug #73538 (SoapClient::__setSoapHeaders doesn't overwrite SOAP
|
||||
headers). (duncan3dc)
|
||||
. Fixed bug #73452 (Segfault (Regression for #69152)). (Dmitry)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73423 (Reproducible crash with GDB backtrace). (Laruence)
|
||||
|
||||
@@ -43,8 +112,13 @@ PHP NEWS
|
||||
. Fixed bug #73530 (Unsetting result set may reset other result set). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73297 (HTTP stream wrapper should ignore HTTP 100 Continue).
|
||||
(rowan dot collins at gmail dot com)
|
||||
. Fixed bug #73297 (HTTP stream wrapper should ignore HTTP 100 Continue).
|
||||
(rowan dot collins at gmail dot com)
|
||||
. Fixed bug #73645 (version_compare illegal write access). (Stas)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #73631 (Invalid read when wddx decodes empty boolean element).
|
||||
(Stas)
|
||||
|
||||
- XML:
|
||||
. Fixed bug #72135 (malformed XML causes fault) (edgarsandi)
|
||||
|
||||
@@ -5,6 +5,7 @@ This is the github mirror of the official PHP repository located at
|
||||
http://git.php.net.
|
||||
|
||||
[](http://travis-ci.org/php/php-src)
|
||||
[](https://ci.appveyor.com/project/php/php-src)
|
||||
|
||||
Pull Requests
|
||||
=============
|
||||
|
||||
@@ -484,6 +484,7 @@ Other
|
||||
is defined in the interface.
|
||||
. session.lazy_write(default=On) INI setting enables only write session data when
|
||||
session data is updated.
|
||||
. session_regenerate_id() saves current $_SESSION before creating new session ID.
|
||||
|
||||
- Opcache
|
||||
. Removed opcache.load_comments configuration directive. Now doc comments
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Assign to $this leaks when $this not defined
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
$this->a = new stdClass;
|
||||
} catch (Error $e) { echo $e->getMessage(), "\n"; }
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Using $this when not in object context
|
||||
@@ -0,0 +1,73 @@
|
||||
--TEST--
|
||||
Bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())
|
||||
--FILE--
|
||||
<?php
|
||||
function change(&$ref) {
|
||||
$ref = range(1, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
$func = function (&$ref) {
|
||||
return change($ref);
|
||||
};
|
||||
|
||||
$array = [1];
|
||||
var_dump(list($val) = $array); // NG: Invalid opcode
|
||||
|
||||
change(list($val) = $array);
|
||||
var_dump($array);
|
||||
|
||||
$array = [1];
|
||||
|
||||
$func(list($val) = $array);
|
||||
var_dump($array);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
array(10) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
[6]=>
|
||||
int(7)
|
||||
[7]=>
|
||||
int(8)
|
||||
[8]=>
|
||||
int(9)
|
||||
[9]=>
|
||||
int(10)
|
||||
}
|
||||
array(10) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
[6]=>
|
||||
int(7)
|
||||
[7]=>
|
||||
int(8)
|
||||
[8]=>
|
||||
int(9)
|
||||
[9]=>
|
||||
int(10)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #73753 Non packed arrays and duplication
|
||||
--FILE--
|
||||
<?php
|
||||
function iterate($current, $a, $result = null) {
|
||||
if (!$current) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return iterate(getNext($a), $a, $current);
|
||||
}
|
||||
|
||||
function getNext(&$a) {
|
||||
return next($a);
|
||||
}
|
||||
|
||||
function getCurrent($a) {
|
||||
return current($a);
|
||||
}
|
||||
|
||||
function traverse($a) {
|
||||
return iterate(getCurrent($a), $a);
|
||||
}
|
||||
|
||||
$arr = array(1 => 'foo', 'b' => 'bar', 'baz');
|
||||
var_dump(traverse($arr));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(3) "baz"
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73792 (invalid foreach loop hangs script)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = 'aaa';
|
||||
|
||||
foreach ($a['bbb'] as &$value) {
|
||||
echo 'loop';
|
||||
}
|
||||
|
||||
unset($value);
|
||||
echo 'done';
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Illegal string offset 'bbb' in %sbug73792.php on line 4
|
||||
|
||||
Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in %sbug73792.php:4
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sbug73792.php on line 4
|
||||
@@ -0,0 +1,184 @@
|
||||
--TEST--
|
||||
Behavior of failing compound assignment
|
||||
--INI--
|
||||
opcache.optimization_level=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
$a = 1;
|
||||
$a %= 0;
|
||||
} catch (Error $e) { var_dump($a); }
|
||||
|
||||
try {
|
||||
$a = 1;
|
||||
$a >>= -1;
|
||||
} catch (Error $e) { var_dump($a); }
|
||||
|
||||
try {
|
||||
$a = 1;
|
||||
$a <<= -1;
|
||||
} catch (Error $e) { var_dump($a); }
|
||||
|
||||
set_error_handler(function($type, $msg) { throw new Exception($msg); });
|
||||
|
||||
try {
|
||||
$a = [];
|
||||
$a .= "foo";
|
||||
} catch (Throwable $e) { var_dump($a); }
|
||||
|
||||
try {
|
||||
$a = "foo";
|
||||
$a .= [];
|
||||
} catch (Throwable $e) { var_dump($a); }
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x += 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x += new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x -= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x -= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x *= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x *= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x /= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x /= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x %= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x %= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x **= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x **= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x ^= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x ^= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x &= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x &= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x |= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x |= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x <<= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x <<= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = new stdClass;
|
||||
try { $x >>= 1; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
|
||||
$x = 1;
|
||||
try { $x >>= new stdClass; }
|
||||
catch (Exception $e) {}
|
||||
var_dump($x);
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
array(0) {
|
||||
}
|
||||
string(3) "foo"
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
int(1)
|
||||
+14
-28
@@ -2,51 +2,37 @@
|
||||
Concatenating many small strings should not slowdown allocations
|
||||
--SKIPIF--
|
||||
<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?>
|
||||
--INI--
|
||||
memory_limit=256m
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* To note is that memory usage can vary depending on whether opcache is on. The actual
|
||||
measuring that matters is timing here. */
|
||||
|
||||
$time = microtime(TRUE);
|
||||
|
||||
/* This might vary on Linux/Windows, so the worst case and also count in slow machines. */
|
||||
$t0_max = 0.1;
|
||||
$t1_max = 0.4;
|
||||
|
||||
$datas = [];
|
||||
for ($i = 0; $i < 220000; $i++)
|
||||
{
|
||||
$datas[] = [
|
||||
'000.000.000.000',
|
||||
'000.255.255.255',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
];
|
||||
}
|
||||
|
||||
$t0 = microtime(TRUE) - $time;
|
||||
var_dump($t0 < $t0_max);
|
||||
$t_max = 1.0;
|
||||
|
||||
$datas = array_fill(0, 220000, [
|
||||
'000.000.000.000',
|
||||
'000.255.255.255',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
]);
|
||||
|
||||
$time = microtime(TRUE);
|
||||
$texts = '';
|
||||
foreach ($datas AS $data)
|
||||
{
|
||||
$texts .= implode("\t", $data) . "\r\n";
|
||||
}
|
||||
|
||||
$t1 = microtime(TRUE) - $time;
|
||||
var_dump($t1 < $t1_max);
|
||||
$t = microtime(TRUE) - $time;
|
||||
var_dump($t < $t_max);
|
||||
|
||||
?>
|
||||
+++DONE+++
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
+++DONE+++
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Calling generator through magic __call()
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public function __call($name, $args) {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
yield $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
foreach ($a->gen() as $n) {
|
||||
var_dump($n);
|
||||
}
|
||||
$a->gen();
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
@@ -6,6 +6,8 @@ ANDing strings
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
$s3 = str_repeat("f", 1);
|
||||
$s4 = str_repeat("f", 2);
|
||||
|
||||
$s &= 22;
|
||||
var_dump($s);
|
||||
@@ -16,10 +18,18 @@ var_dump($s1);
|
||||
$s2 &= 33;
|
||||
var_dump($s2);
|
||||
|
||||
$s3 &= " ";
|
||||
var_dump($s3);
|
||||
|
||||
$s4 &= " ";
|
||||
var_dump($s4);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(18)
|
||||
int(0)
|
||||
int(33)
|
||||
string(1) " "
|
||||
string(2) " "
|
||||
Done
|
||||
|
||||
@@ -6,6 +6,8 @@ ORing strings
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
$s3 = str_repeat("f", 1);
|
||||
$s4 = str_repeat("f", 2);
|
||||
|
||||
$s |= 22;
|
||||
var_dump($s);
|
||||
@@ -16,10 +18,18 @@ var_dump($s1);
|
||||
$s2 |= 33;
|
||||
var_dump($s2);
|
||||
|
||||
$s3 |= " ";
|
||||
var_dump($s3);
|
||||
|
||||
$s4 |= " ";
|
||||
var_dump($s4);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(127)
|
||||
int(11)
|
||||
int(45345)
|
||||
string(1) "f"
|
||||
string(2) "ff"
|
||||
Done
|
||||
|
||||
@@ -6,6 +6,8 @@ XORing strings
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
$s3 = str_repeat("f", 1);
|
||||
$s4 = str_repeat("f", 2);
|
||||
|
||||
$s ^= 22;
|
||||
var_dump($s);
|
||||
@@ -16,10 +18,18 @@ var_dump($s1);
|
||||
$s2 ^= 33;
|
||||
var_dump($s2);
|
||||
|
||||
$s3 ^= " ";
|
||||
var_dump($s3);
|
||||
|
||||
$s4 ^= " ";
|
||||
var_dump($s4);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(109)
|
||||
int(11)
|
||||
int(45312)
|
||||
string(1) "F"
|
||||
string(2) "FF"
|
||||
Done
|
||||
|
||||
+1
-1
@@ -2343,7 +2343,7 @@ ZEND_API int is_zend_mm(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !ZEND_DEBUG && (!defined(_WIN32) || defined(__clang__))
|
||||
#if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P)
|
||||
#undef _emalloc
|
||||
|
||||
#if ZEND_MM_CUSTOM
|
||||
|
||||
+12
-5
@@ -1002,10 +1002,8 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze
|
||||
op1 = RT_CONSTANT(op_array, opline->op1);
|
||||
op2 = RT_CONSTANT(op_array, opline->op2);
|
||||
}
|
||||
if ((ce = zend_hash_find_ptr(class_table, Z_STR_P(op1))) == NULL) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1));
|
||||
return NULL;
|
||||
}
|
||||
ce = zend_hash_find_ptr(class_table, Z_STR_P(op1));
|
||||
ZEND_ASSERT(ce);
|
||||
ce->refcount++;
|
||||
if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
|
||||
ce->refcount--;
|
||||
@@ -2783,12 +2781,21 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
|
||||
}
|
||||
} else {
|
||||
zend_compile_expr(&arg_node, arg);
|
||||
ZEND_ASSERT(arg_node.op_type != IS_CV);
|
||||
if (arg_node.op_type == IS_VAR) {
|
||||
opcode = ZEND_SEND_VAR_NO_REF;
|
||||
if (fbc && ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||
flags |= ZEND_ARG_SEND_BY_REF;
|
||||
}
|
||||
} else if (arg_node.op_type == IS_CV) {
|
||||
if (fbc) {
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||
opcode = ZEND_SEND_REF;
|
||||
} else {
|
||||
opcode = ZEND_SEND_VAR;
|
||||
}
|
||||
} else {
|
||||
opcode = ZEND_SEND_VAR_EX;
|
||||
}
|
||||
} else {
|
||||
if (fbc) {
|
||||
opcode = ZEND_SEND_VAL;
|
||||
|
||||
@@ -186,7 +186,9 @@ ZEND_API void zend_clear_exception(void) /* {{{ */
|
||||
}
|
||||
OBJ_RELEASE(EG(exception));
|
||||
EG(exception) = NULL;
|
||||
EG(current_execute_data)->opline = EG(opline_before_exception);
|
||||
if (EG(current_execute_data)) {
|
||||
EG(current_execute_data)->opline = EG(opline_before_exception);
|
||||
}
|
||||
#if ZEND_DEBUG
|
||||
EG(opline_before_exception) = NULL;
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -1412,11 +1412,11 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object,
|
||||
zval rv;
|
||||
|
||||
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
|
||||
zval *z, obj;
|
||||
zval *z, *zptr, obj;
|
||||
|
||||
ZVAL_OBJ(&obj, Z_OBJ_P(object));
|
||||
Z_ADDREF(obj);
|
||||
z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
|
||||
zptr = z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
OBJ_RELEASE(Z_OBJ(obj));
|
||||
return;
|
||||
@@ -1443,7 +1443,7 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object,
|
||||
}
|
||||
Z_OBJ_HT(obj)->write_property(&obj, property, z, cache_slot);
|
||||
OBJ_RELEASE(Z_OBJ(obj));
|
||||
zval_ptr_dtor(z);
|
||||
zval_ptr_dtor(zptr);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
|
||||
if (UNEXPECTED(result)) {
|
||||
|
||||
@@ -519,6 +519,7 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator
|
||||
generator->execute_fake.prev_execute_data = original_execute_data;
|
||||
}
|
||||
|
||||
root->execute_data->opline--; /* ZEND_YIELD(_FROM) already advance, so decrement opline to throw from correct place */
|
||||
zend_throw_exception(zend_ce_ClosedGeneratorException, "Generator yielded from aborted, no return value available", 0);
|
||||
|
||||
EG(current_execute_data) = original_execute_data;
|
||||
|
||||
+4
-3
@@ -1757,7 +1757,7 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source,
|
||||
|
||||
static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, int static_keys, int with_holes)
|
||||
{
|
||||
uint32_t idx = 0;
|
||||
uint32_t idx = 0;
|
||||
Bucket *p = source->arData;
|
||||
Bucket *q = target->arData;
|
||||
Bucket *end = p + source->nNumUsed;
|
||||
@@ -1785,7 +1785,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
|
||||
|
||||
ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
{
|
||||
uint32_t idx;
|
||||
uint32_t idx;
|
||||
HashTable *target;
|
||||
|
||||
IS_CONSISTENT(source);
|
||||
@@ -1849,7 +1849,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
target->u.flags = (source->u.flags & ~(HASH_FLAG_PERSISTENT|ZEND_HASH_APPLY_COUNT_MASK)) | HASH_FLAG_APPLY_PROTECTION;
|
||||
target->nTableMask = source->nTableMask;
|
||||
target->nNextFreeElement = source->nNextFreeElement;
|
||||
target->nInternalPointer = HT_INVALID_IDX;
|
||||
target->nInternalPointer = source->nInternalPointer;
|
||||
|
||||
HT_SET_DATA_ADDR(target, emalloc(HT_SIZE(target)));
|
||||
HT_HASH_RESET(target);
|
||||
|
||||
|
||||
@@ -301,6 +301,16 @@ static zend_always_inline zval *zend_hash_str_find_ind(const HashTable *ht, cons
|
||||
}
|
||||
|
||||
|
||||
static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len)
|
||||
{
|
||||
zval *zv;
|
||||
|
||||
zv = zend_hash_str_find(ht, str, len);
|
||||
return zv && (Z_TYPE_P(zv) != IS_INDIRECT ||
|
||||
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
|
||||
}
|
||||
|
||||
|
||||
static zend_always_inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
|
||||
{
|
||||
zend_ulong idx;
|
||||
|
||||
@@ -115,10 +115,10 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||
/* ZEND_ASSERT(!Z_REFCOUNTED_P(op1)); */
|
||||
if (ZEND_SYSTEM_INI) {
|
||||
ZVAL_PSTRINGL(op1, ZSTR_VAL(str), ZSTR_LEN(str));
|
||||
zend_string_release(str);
|
||||
} else {
|
||||
ZVAL_STR(op1, str);
|
||||
}
|
||||
zend_string_release(str);
|
||||
}
|
||||
op1_len = (int)Z_STRLEN_P(op1);
|
||||
|
||||
|
||||
+2319
-3140
File diff suppressed because it is too large
Load Diff
@@ -408,9 +408,9 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
<INITIAL>"[" { /* Section start */
|
||||
/* Enter section data lookup state */
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
|
||||
yy_push_state(ST_SECTION_RAW);
|
||||
BEGIN(ST_SECTION_RAW);
|
||||
} else {
|
||||
yy_push_state(ST_SECTION_VALUE);
|
||||
BEGIN(ST_SECTION_VALUE);
|
||||
}
|
||||
return TC_SECTION;
|
||||
}
|
||||
@@ -438,7 +438,7 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
EAT_TRAILING_WHITESPACE_EX('[');
|
||||
|
||||
/* Enter offset lookup state */
|
||||
yy_push_state(ST_OFFSET);
|
||||
BEGIN(ST_OFFSET);
|
||||
|
||||
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
|
||||
}
|
||||
@@ -492,9 +492,9 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
|
||||
<INITIAL>{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
|
||||
yy_push_state(ST_RAW);
|
||||
BEGIN(ST_RAW);
|
||||
} else {
|
||||
yy_push_state(ST_VALUE);
|
||||
BEGIN(ST_VALUE);
|
||||
}
|
||||
return '=';
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.14.3 */
|
||||
/* Generated by re2c 0.16 */
|
||||
#line 3 "Zend/zend_ini_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
||||
@@ -736,9 +736,11 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /*
|
||||
if (type == BP_VAR_IS) {
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, offset);
|
||||
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
|
||||
zval_ptr_dtor(offset);
|
||||
return NULL;
|
||||
}
|
||||
if (!i_zend_is_true(rv)) {
|
||||
zval_ptr_dtor(offset);
|
||||
zval_ptr_dtor(rv);
|
||||
return &EG(uninitialized_zval);
|
||||
}
|
||||
|
||||
+122
-54
@@ -188,41 +188,45 @@ try_again:
|
||||
|
||||
/* {{{ zendi_convert_scalar_to_number */
|
||||
#define zendi_convert_scalar_to_number(op, holder, result) \
|
||||
if (op==result) { \
|
||||
if (Z_TYPE_P(op) != IS_LONG) { \
|
||||
convert_scalar_to_number(op); \
|
||||
} \
|
||||
} else { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
if (Z_TYPE_P(op) != IS_LONG) { \
|
||||
if (op==result && Z_TYPE_P(op) != IS_OBJECT) { \
|
||||
convert_scalar_to_number(op); \
|
||||
} else { \
|
||||
switch (Z_TYPE_P(op)) { \
|
||||
case IS_STRING: \
|
||||
if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
} \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
} \
|
||||
case IS_NULL: \
|
||||
case IS_FALSE: \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_TRUE: \
|
||||
ZVAL_LONG(&(holder), 1); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_OBJECT: \
|
||||
ZVAL_COPY(&(holder), op); \
|
||||
convert_to_long_base(&(holder), 10); \
|
||||
if (Z_TYPE(holder) == IS_LONG) { \
|
||||
(op) = &(holder); \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
} \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_NULL: \
|
||||
case IS_FALSE: \
|
||||
ZVAL_LONG(&(holder), 0); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_TRUE: \
|
||||
ZVAL_LONG(&(holder), 1); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_RESOURCE: \
|
||||
ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
|
||||
(op) = &(holder); \
|
||||
break; \
|
||||
case IS_OBJECT: \
|
||||
ZVAL_COPY(&(holder), op); \
|
||||
convert_to_long_base(&(holder), 10); \
|
||||
if (UNEXPECTED(EG(exception))) { \
|
||||
return FAILURE; \
|
||||
} \
|
||||
if (Z_TYPE(holder) == IS_LONG) { \
|
||||
if (op == result) { \
|
||||
zval_ptr_dtor(op); \
|
||||
} \
|
||||
(op) = &(holder); \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -259,6 +263,9 @@ try_again:
|
||||
} \
|
||||
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(op, op_func); \
|
||||
op1_lval = _zval_get_long_func(op1); \
|
||||
if (UNEXPECTED(EG(exception))) { \
|
||||
return FAILURE; \
|
||||
} \
|
||||
} else { \
|
||||
op1_lval = Z_LVAL_P(op1); \
|
||||
} \
|
||||
@@ -274,6 +281,9 @@ try_again:
|
||||
} \
|
||||
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(op); \
|
||||
op2_lval = _zval_get_long_func(op2); \
|
||||
if (UNEXPECTED(EG(exception))) { \
|
||||
return FAILURE; \
|
||||
} \
|
||||
} else { \
|
||||
op2_lval = Z_LVAL_P(op2); \
|
||||
} \
|
||||
@@ -1187,10 +1197,6 @@ ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {
|
||||
|
||||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_MOD, mod_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
if (op2_lval == 0) {
|
||||
/* modulus by zero */
|
||||
if (EG(current_execute_data) && !CG(in_compilation)) {
|
||||
@@ -1198,10 +1204,16 @@ ZEND_API int ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Modulo by zero");
|
||||
}
|
||||
ZVAL_UNDEF(result);
|
||||
if (op1 != result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
if (op2_lval == -1) {
|
||||
/* Prevent overflow error/crash if op1==LONG_MIN */
|
||||
ZVAL_LONG(result, 0);
|
||||
@@ -1349,6 +1361,9 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op
|
||||
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
|
||||
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
|
||||
zend_uchar or = (zend_uchar) (*Z_STRVAL_P(op1) | *Z_STRVAL_P(op2));
|
||||
if (result==op1) {
|
||||
zend_string_release(Z_STR_P(result));
|
||||
}
|
||||
if (CG(one_char_string)[or]) {
|
||||
ZVAL_INTERNED_STR(result, CG(one_char_string)[or]);
|
||||
} else {
|
||||
@@ -1378,12 +1393,18 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op
|
||||
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_OR, bitwise_or_function);
|
||||
op1_lval = _zval_get_long_func(op1);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_OR);
|
||||
op2_lval = _zval_get_long_func(op2);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
@@ -1416,6 +1437,9 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o
|
||||
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
|
||||
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
|
||||
zend_uchar and = (zend_uchar) (*Z_STRVAL_P(op1) & *Z_STRVAL_P(op2));
|
||||
if (result==op1) {
|
||||
zend_string_release(Z_STR_P(result));
|
||||
}
|
||||
if (CG(one_char_string)[and]) {
|
||||
ZVAL_INTERNED_STR(result, CG(one_char_string)[and]);
|
||||
} else {
|
||||
@@ -1445,12 +1469,18 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o
|
||||
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_AND, bitwise_and_function);
|
||||
op1_lval = _zval_get_long_func(op1);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_AND);
|
||||
op2_lval = _zval_get_long_func(op2);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
@@ -1483,6 +1513,9 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o
|
||||
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
|
||||
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
|
||||
zend_uchar xor = (zend_uchar) (*Z_STRVAL_P(op1) ^ *Z_STRVAL_P(op2));
|
||||
if (result==op1) {
|
||||
zend_string_release(Z_STR_P(result));
|
||||
}
|
||||
if (CG(one_char_string)[xor]) {
|
||||
ZVAL_INTERNED_STR(result, CG(one_char_string)[xor]);
|
||||
} else {
|
||||
@@ -1512,12 +1545,18 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o
|
||||
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_XOR, bitwise_xor_function);
|
||||
op1_lval = _zval_get_long_func(op1);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
|
||||
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_XOR);
|
||||
op2_lval = _zval_get_long_func(op2);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
@@ -1536,13 +1575,12 @@ ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op
|
||||
|
||||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_SL, shift_left_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
/* prevent wrapping quirkiness on some processors where << 64 + x == << x */
|
||||
if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
|
||||
if (EXPECTED(op2_lval > 0)) {
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -1551,11 +1589,17 @@ ZEND_API int ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Bit shift by negative number");
|
||||
}
|
||||
ZVAL_UNDEF(result);
|
||||
if (op1 != result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
ZVAL_LONG(result, op1_lval << op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1567,13 +1611,12 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o
|
||||
|
||||
convert_op1_op2_long(op1, op1_lval, op2, op2_lval, ZEND_SR, shift_right_function);
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
/* prevent wrapping quirkiness on some processors where >> 64 + x == >> x */
|
||||
if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
|
||||
if (EXPECTED(op2_lval > 0)) {
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, (op1_lval < 0) ? -1 : 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -1582,11 +1625,17 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o
|
||||
} else {
|
||||
zend_error_noreturn(E_ERROR, "Bit shift by negative number");
|
||||
}
|
||||
ZVAL_UNDEF(result);
|
||||
if (op1 != result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
ZVAL_LONG(result, op1_lval >> op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1594,6 +1643,7 @@ ZEND_API int ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *o
|
||||
|
||||
ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */
|
||||
{
|
||||
zval *orig_op1 = op1;
|
||||
zval op1_copy, op2_copy;
|
||||
int use_copy1 = 0, use_copy2 = 0;
|
||||
|
||||
@@ -1606,11 +1656,11 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_CONCAT, concat_function);
|
||||
use_copy1 = zend_make_printable_zval(op1, &op1_copy);
|
||||
if (use_copy1) {
|
||||
/* We have created a converted copy of op1. Therefore, op1 won't become the result so
|
||||
* we have to free it.
|
||||
*/
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
zval_dtor(&op1_copy);
|
||||
return FAILURE;
|
||||
}
|
||||
if (result == op1) {
|
||||
zval_dtor(op1);
|
||||
if (UNEXPECTED(op1 == op2)) {
|
||||
op2 = &op1_copy;
|
||||
}
|
||||
@@ -1628,6 +1678,13 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
||||
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_CONCAT);
|
||||
use_copy2 = zend_make_printable_zval(op2, &op2_copy);
|
||||
if (use_copy2) {
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
if (UNEXPECTED(use_copy1)) {
|
||||
zval_dtor(op1);
|
||||
}
|
||||
zval_dtor(&op2_copy);
|
||||
return FAILURE;
|
||||
}
|
||||
op2 = &op2_copy;
|
||||
}
|
||||
}
|
||||
@@ -1641,7 +1698,15 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
||||
|
||||
if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
|
||||
zend_throw_error(NULL, "String size overflow");
|
||||
ZVAL_FALSE(result);
|
||||
if (UNEXPECTED(use_copy1)) {
|
||||
zval_dtor(op1);
|
||||
}
|
||||
if (UNEXPECTED(use_copy2)) {
|
||||
zval_dtor(op2);
|
||||
}
|
||||
if (orig_op1 != result) {
|
||||
ZVAL_UNDEF(result);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -1651,6 +1716,9 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
||||
} else {
|
||||
result_str = zend_string_alloc(result_len, 0);
|
||||
memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
|
||||
if (result == orig_op1) {
|
||||
zval_dtor(orig_op1);
|
||||
}
|
||||
}
|
||||
|
||||
/* This has to happen first to account for the cases where result == op1 == op2 and
|
||||
|
||||
@@ -125,6 +125,8 @@
|
||||
# define ZEND_IGNORE_VALUE(x) ((void) (x))
|
||||
#endif
|
||||
|
||||
#define zend_quiet_write(...) ZEND_IGNORE_VALUE(write(__VA_ARGS__))
|
||||
|
||||
/* all HAVE_XXX test have to be after the include of zend_config above */
|
||||
|
||||
#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
|
||||
|
||||
+30
-11
@@ -2142,6 +2142,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
|
||||
if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -2150,6 +2151,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
FREE_OP2();
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, OP1_TYPE, property_name, OP2_TYPE, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -5876,6 +5878,12 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY)
|
||||
|
||||
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
|
||||
array_ref = array_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(array_ref == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot iterate on string offsets by reference");
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (Z_ISREF_P(array_ref)) {
|
||||
array_ptr = Z_REFVAL_P(array_ref);
|
||||
}
|
||||
@@ -7846,7 +7854,8 @@ ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ANY)
|
||||
if (RETURN_VALUE_USED(result)) {
|
||||
ZVAL_TRUE(EX_VAR(result->result.var));
|
||||
}
|
||||
ZEND_VM_JMP(target);
|
||||
ZEND_VM_SET_OPCODE(target);
|
||||
ZEND_VM_CONTINUE();
|
||||
} else {
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -7928,17 +7937,27 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
|
||||
|
||||
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
|
||||
ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_GENERATOR));
|
||||
|
||||
call->symbol_table = NULL;
|
||||
i_init_func_execute_data(call, &fbc->op_array,
|
||||
ret, (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0);
|
||||
|
||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
ZEND_VM_ENTER();
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (ret) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, ret);
|
||||
Z_VAR_FLAGS_P(ret) = 0;
|
||||
} else {
|
||||
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) {
|
||||
OBJ_RELEASE((zend_object*)fbc->op_array.prototype);
|
||||
}
|
||||
zend_vm_stack_free_args(call);
|
||||
}
|
||||
} else {
|
||||
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
|
||||
zend_execute_ex(call);
|
||||
call->symbol_table = NULL;
|
||||
i_init_func_execute_data(call, &fbc->op_array,
|
||||
ret, (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0);
|
||||
|
||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
ZEND_VM_ENTER();
|
||||
} else {
|
||||
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
|
||||
zend_execute_ex(call);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zval retval;
|
||||
|
||||
+64
-11
@@ -1655,7 +1655,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSERT_CHECK_SPEC_HANDLER(ZEND
|
||||
if (RETURN_VALUE_USED(result)) {
|
||||
ZVAL_TRUE(EX_VAR(result->result.var));
|
||||
}
|
||||
ZEND_VM_JMP(target);
|
||||
ZEND_VM_SET_OPCODE(target);
|
||||
ZEND_VM_CONTINUE();
|
||||
} else {
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
@@ -1737,17 +1738,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
|
||||
|
||||
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
|
||||
ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_GENERATOR));
|
||||
|
||||
call->symbol_table = NULL;
|
||||
i_init_func_execute_data(call, &fbc->op_array,
|
||||
ret, (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0);
|
||||
|
||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
ZEND_VM_ENTER();
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (ret) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, ret);
|
||||
Z_VAR_FLAGS_P(ret) = 0;
|
||||
} else {
|
||||
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) {
|
||||
OBJ_RELEASE((zend_object*)fbc->op_array.prototype);
|
||||
}
|
||||
zend_vm_stack_free_args(call);
|
||||
}
|
||||
} else {
|
||||
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
|
||||
zend_execute_ex(call);
|
||||
call->symbol_table = NULL;
|
||||
i_init_func_execute_data(call, &fbc->op_array,
|
||||
ret, (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0);
|
||||
|
||||
if (EXPECTED(zend_execute_ex == execute_ex)) {
|
||||
ZEND_VM_ENTER();
|
||||
} else {
|
||||
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
|
||||
zend_execute_ex(call);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zval retval;
|
||||
@@ -3825,6 +3836,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER
|
||||
|
||||
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
|
||||
array_ref = array_ptr = NULL;
|
||||
if (IS_CONST == IS_VAR && UNEXPECTED(array_ref == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot iterate on string offsets by reference");
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (Z_ISREF_P(array_ref)) {
|
||||
array_ptr = Z_REFVAL_P(array_ref);
|
||||
}
|
||||
@@ -12320,6 +12337,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
|
||||
|
||||
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
|
||||
array_ref = array_ptr = NULL;
|
||||
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(array_ref == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot iterate on string offsets by reference");
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (Z_ISREF_P(array_ref)) {
|
||||
array_ptr = Z_REFVAL_P(array_ref);
|
||||
}
|
||||
@@ -15788,6 +15811,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
|
||||
|
||||
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
|
||||
array_ref = array_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(array_ref == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot iterate on string offsets by reference");
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (Z_ISREF_P(array_ref)) {
|
||||
array_ptr = Z_REFVAL_P(array_ref);
|
||||
}
|
||||
@@ -17519,6 +17548,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HAND
|
||||
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -17527,6 +17557,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HAND
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_VAR, property_name, IS_CONST, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -20743,6 +20774,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER
|
||||
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -20751,6 +20783,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_VAR, property_name, IS_CV, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -22423,6 +22456,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_HAN
|
||||
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -22431,6 +22465,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_HAN
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
zval_ptr_dtor_nogc(free_op2);
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_VAR, property_name, (IS_TMP_VAR|IS_VAR), (opline+1)->op1_type, (opline+1)->op1, execute_data, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -23907,6 +23942,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_H
|
||||
if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -23915,6 +23951,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_H
|
||||
if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_UNUSED, property_name, IS_CONST, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -26338,6 +26375,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HAND
|
||||
if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -26346,6 +26384,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HAND
|
||||
if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_UNUSED, property_name, IS_CV, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -27846,6 +27885,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
|
||||
if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -27854,6 +27894,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
|
||||
if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
zval_ptr_dtor_nogc(free_op2);
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_UNUSED, property_name, (IS_TMP_VAR|IS_VAR), (opline+1)->op1_type, (opline+1)->op1, execute_data, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -29618,6 +29659,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
|
||||
|
||||
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
|
||||
array_ref = array_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(array_ref == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot iterate on string offsets by reference");
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (Z_ISREF_P(array_ref)) {
|
||||
array_ptr = Z_REFVAL_P(array_ref);
|
||||
}
|
||||
@@ -31966,6 +32013,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDL
|
||||
if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -31974,6 +32022,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDL
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_CV, property_name, IS_CONST, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -37015,6 +37064,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(
|
||||
if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -37023,6 +37073,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_CV, property_name, IS_CV, (opline+1)->op1_type, (opline+1)->op1, execute_data, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
@@ -39701,6 +39752,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_HAND
|
||||
if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
|
||||
zend_throw_error(NULL, "Using $this when not in object context");
|
||||
zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@@ -39709,6 +39761,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_HAND
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
|
||||
zend_throw_error(NULL, "Cannot use string offset as an array");
|
||||
zval_ptr_dtor_nogc(free_op2);
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_assign_to_object(UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL, object, IS_CV, property_name, (IS_TMP_VAR|IS_VAR), (opline+1)->op1_type, (opline+1)->op1, execute_data, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL));
|
||||
|
||||
+1
-1
@@ -2264,7 +2264,7 @@ AC_DEFUN([PHP_SETUP_KERBEROS],[
|
||||
fi
|
||||
|
||||
dnl If krb5-config is found try using it
|
||||
if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then
|
||||
if test "$PHP_KERBEROS" != "no" && test -x "$KRB5_CONFIG"; then
|
||||
KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
|
||||
KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
|
||||
set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
|
||||
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
|
||||
|
||||
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
|
||||
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
|
||||
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
|
||||
)
|
||||
|
||||
if not exist "%PHP_BUILD_OBJ_DIR%" (
|
||||
echo Creating %PHP_BUILD_OBJ_DIR%
|
||||
mkdir "%PHP_BUILD_OBJ_DIR%"
|
||||
)
|
||||
|
||||
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
|
||||
echo Cloning remote SDK repository
|
||||
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
|
||||
) else (
|
||||
echo Fetching remote SDK repository
|
||||
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
|
||||
echo Checkout SDK repository branch
|
||||
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
|
||||
)
|
||||
|
||||
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
|
||||
if not exist "%SDK_RUNNER%" (
|
||||
echo "%SDK_RUNNER%" doesn't exist
|
||||
exit /b 3
|
||||
)
|
||||
|
||||
call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\build_task.bat
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
@echo off
|
||||
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
cd /D %APPVEYOR_BUILD_FOLDER%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=%APPVEYOR_REPO_BRANCH:~4%
|
||||
set STABILITY=stable
|
||||
) else (
|
||||
set BRANCH=master
|
||||
set STABILITY=staging
|
||||
)
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
|
||||
rem SDK is cached, deps info is cached as well
|
||||
echo Updating dependencies
|
||||
call phpsdk_deps --update --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
call buildconf.bat --force
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
if "%THREAD_SAFE%" equ "0" set ADD_CONF=--disable-zts
|
||||
|
||||
set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_odbc,odbc,pdo_firebird,interbase,ldap,imap,dba
|
||||
if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
|
||||
|
||||
call configure.bat ^
|
||||
--enable-snapshot-build ^
|
||||
--enable-debug-pack ^
|
||||
--with-mcrypt=shared ^
|
||||
--enable-com-dotnet=shared ^
|
||||
--without-analyzer ^
|
||||
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
|
||||
--with-php-build=%DEPS_DIR% ^
|
||||
%ADD_CONF% ^
|
||||
--with-test-ini-ext-exclude=%EXT_EXCLUDE_FROM_TEST%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
nmake /NOLOGO
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
exit /b 0
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
|
||||
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
|
||||
if not exist "%SDK_RUNNER%" (
|
||||
echo "%SDK_RUNNER%" doesn't exist
|
||||
exit /b 3
|
||||
)
|
||||
|
||||
call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\test_task.bat
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
@echo off
|
||||
|
||||
set NO_INTERACTION=1
|
||||
set REPORT_EXIT_STATUS=1
|
||||
set SKIP_IO_CAPTURE_TESTS=1
|
||||
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
|
||||
|
||||
rem setup MySQL related exts
|
||||
set MYSQL_PWD=Password12!
|
||||
set MYSQL_TEST_PASSWD=%MYSQL_PWD%
|
||||
set MYSQL_TEST_USER=root
|
||||
set MYSQL_TEST_HOST=127.0.0.1
|
||||
set MYSQL_TEST_PORT=3306
|
||||
set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
|
||||
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
|
||||
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
|
||||
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
|
||||
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST% port=%PDO_MYSQL_TEST_PORT% dbname=test user=%PDO_MYSQL_TEST_USER% password=%MYSQL_PW%
|
||||
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
|
||||
|
||||
rem setup PostgreSQL related exts
|
||||
set PGUSER=postgres
|
||||
set PGPASSWORD=Password12!
|
||||
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
|
||||
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
|
||||
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
|
||||
"C:\Program Files\PostgreSQL\9.5\bin\createdb.exe" test
|
||||
|
||||
rem prepare for ext/openssl
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
|
||||
mkdir c:\usr\local\ssl
|
||||
copy %DEPS_DIR%\template\ssl\openssl.cnf c:\usr\local\ssl
|
||||
set OPENSSL_CONF=c:\usr\local\ssl\openssl.cnf
|
||||
rem set OPENSSL_CONF=
|
||||
rem set SSLEAY_CONF=
|
||||
|
||||
rem prepare for Opcache
|
||||
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enabled=1 -d opcache.enable_cli=1
|
||||
|
||||
rem prepare for enchant
|
||||
mkdir c:\enchant_plugins
|
||||
copy %DEPS_DIR%\bin\libenchant_ispell.dll c:\enchant_plugins
|
||||
copy %DEPS_DIR%\bin\libenchant_myspell.dll c:\enchant_plugins
|
||||
reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
|
||||
set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
|
||||
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
|
||||
echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
|
||||
mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
|
||||
)
|
||||
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
|
||||
echo Fetching enchant dicts
|
||||
pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
|
||||
del /q *
|
||||
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
|
||||
unzip dict.zip
|
||||
del /q dict.zip
|
||||
popd
|
||||
)
|
||||
mkdir %USERPROFILE%\enchant\myspell
|
||||
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %USERPROFILE%\enchant\myspell
|
||||
|
||||
mkdir c:\tests_tmp
|
||||
|
||||
cd "%APPVEYOR_BUILD_FOLDER%"
|
||||
nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp"
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=0
|
||||
PHP_RELEASE_VERSION=14
|
||||
PHP_RELEASE_VERSION=15
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
@@ -52,6 +52,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE,
|
||||
&authid, EOAC_NONE
|
||||
};
|
||||
zend_long cp = GetACP();
|
||||
|
||||
php_com_initialize();
|
||||
obj = CDNO_FETCH(object);
|
||||
@@ -59,16 +60,22 @@ PHP_FUNCTION(com_create_instance)
|
||||
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS(), "s|s!ls",
|
||||
&module_name, &module_name_len, &server_name, &server_name_len,
|
||||
&obj->code_page, &typelib_name, &typelib_name_len) &&
|
||||
&cp, &typelib_name, &typelib_name_len) &&
|
||||
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS(), "sa|ls",
|
||||
&module_name, &module_name_len, &server_params, &obj->code_page,
|
||||
&module_name, &module_name_len, &server_params, &cp,
|
||||
&typelib_name, &typelib_name_len)) {
|
||||
|
||||
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!");
|
||||
return;
|
||||
}
|
||||
obj->code_page = (int)cp;
|
||||
|
||||
if (server_name) {
|
||||
ctx = CLSCTX_REMOTE_SERVER;
|
||||
} else if (server_params) {
|
||||
|
||||
@@ -196,6 +196,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
int ret = FAILURE;
|
||||
char *where = "";
|
||||
IUnknown *unk = NULL;
|
||||
zend_long cp = GetACP();
|
||||
|
||||
php_com_initialize();
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
@@ -245,11 +246,17 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l",
|
||||
&assembly_name, &assembly_name_len,
|
||||
&datatype_name, &datatype_name_len,
|
||||
&obj->code_page)) {
|
||||
&cp)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");
|
||||
return;
|
||||
}
|
||||
obj->code_page = (int)cp;
|
||||
|
||||
oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page);
|
||||
oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page);
|
||||
oletype_sys = SysAllocString(oletype);
|
||||
|
||||
@@ -656,5 +656,7 @@ zend_object* php_com_object_new(zend_class_entry *ce)
|
||||
zend_object_std_init(&obj->zo, ce);
|
||||
obj->zo.handlers = &php_com_object_handlers;
|
||||
|
||||
obj->typeinfo = NULL;
|
||||
|
||||
return (zend_object*)obj;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73679 DOTNET read access violation using invalid codepage
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$stack = new DOTNET("mscorlib", "System.Collections.Stack", -2200000000);
|
||||
$stack->Push(".Net");
|
||||
$stack->Push("Hello ");
|
||||
echo $stack->Pop() . $stack->Pop();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught com_exception: Could not create .Net object - invalid codepage! in %sbug73679.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug73679.php(%d): dotnet->dotnet('mscorlib', 'System.Collecti...', -2200000000)
|
||||
#1 {main}
|
||||
thrown in %sbug73679.php on line %d
|
||||
+7
-12
@@ -2302,8 +2302,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
error = curl_easy_setopt(ch->cp, option, lval);
|
||||
break;
|
||||
case CURLOPT_SAFE_UPLOAD:
|
||||
lval = zval_get_long(zvalue);
|
||||
if (lval == 0) {
|
||||
if (!zend_is_true(zvalue)) {
|
||||
php_error_docref(NULL, E_WARNING, "Disabling safe uploads is no longer supported");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -2639,13 +2638,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
break;
|
||||
|
||||
case CURLOPT_FOLLOWLOCATION:
|
||||
lval = zval_get_long(zvalue);
|
||||
lval = zend_is_true(zvalue);
|
||||
#if LIBCURL_VERSION_NUM < 0x071304
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
if (lval != 0) {
|
||||
php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
|
||||
return FAILURE;
|
||||
}
|
||||
if (lval && PG(open_basedir) && *PG(open_basedir)) {
|
||||
php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
error = curl_easy_setopt(ch->cp, option, lval);
|
||||
@@ -2801,8 +2798,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
break;
|
||||
|
||||
case CURLOPT_RETURNTRANSFER:
|
||||
lval = zval_get_long(zvalue);
|
||||
if (lval) {
|
||||
if (zend_is_true(zvalue)) {
|
||||
ch->handlers->write->method = PHP_CURL_RETURN;
|
||||
} else {
|
||||
ch->handlers->write->method = PHP_CURL_STDOUT;
|
||||
@@ -2878,8 +2874,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
}
|
||||
|
||||
case CURLINFO_HEADER_OUT:
|
||||
lval = zval_get_long(zvalue);
|
||||
if (lval == 1) {
|
||||
if (zend_is_true(zvalue)) {
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
|
||||
die('skip Windows only test');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_STDERR, $fp);
|
||||
curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
echo "Ok\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
Hello World!
|
||||
Hello World!Ok
|
||||
%A
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
|
||||
die('skip now for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
|
||||
@@ -7,7 +7,7 @@ include 'skipif.inc';
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
function checkForClosedFilePointer($curl_option, $description) {
|
||||
function checkForClosedFilePointer($target_url, $curl_option, $description) {
|
||||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
|
||||
|
||||
$ch1 = curl_init();
|
||||
@@ -16,7 +16,7 @@ function checkForClosedFilePointer($curl_option, $description) {
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
$curl_option => $fp,
|
||||
CURLOPT_URL => curl_cli_server_start()
|
||||
CURLOPT_URL => $target_url,
|
||||
);
|
||||
|
||||
// we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly
|
||||
@@ -47,6 +47,10 @@ function checkForClosedFilePointer($curl_option, $description) {
|
||||
curl_multi_remove_handle($mh, $ch2);
|
||||
curl_multi_close($mh);
|
||||
|
||||
// Force curl to output results
|
||||
fflush(STDERR);
|
||||
fflush(STDOUT);
|
||||
|
||||
echo "Ok for $description\n";
|
||||
}
|
||||
|
||||
@@ -54,31 +58,34 @@ $options_to_check = array(
|
||||
"CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE"
|
||||
);
|
||||
|
||||
$target_url = curl_cli_server_start();
|
||||
foreach($options_to_check as $option) {
|
||||
checkForClosedFilePointer(constant($option), $option);
|
||||
checkForClosedFilePointer($target_url, constant($option), $option);
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
%A
|
||||
Ok for CURLOPT_STDERR
|
||||
%A
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
%AOk for CURLOPT_FILE
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
Hello World!
|
||||
Hello World!Hello World!
|
||||
Hello World!Ok for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug48203_multi.php on line 36
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
--TEST--
|
||||
Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
|
||||
die('skip Windows only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function checkForClosedFilePointer($host, $curl_option, $description) {
|
||||
$fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+');
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
// we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
|
||||
if (CURLOPT_STDERR == $curl_option) {
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
}
|
||||
|
||||
if (CURLOPT_INFILE == $curl_option) {
|
||||
curl_setopt($ch, CURLOPT_UPLOAD, 1);
|
||||
}
|
||||
|
||||
curl_setopt($ch, $curl_option, $fp);
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $host);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
echo "Ok for $description\n";
|
||||
}
|
||||
|
||||
$options_to_check = array(
|
||||
"CURLOPT_STDERR",
|
||||
"CURLOPT_WRITEHEADER",
|
||||
"CURLOPT_FILE",
|
||||
"CURLOPT_INFILE"
|
||||
);
|
||||
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
foreach($options_to_check as $option) {
|
||||
checkForClosedFilePointer($host, constant($option), $option);
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
|
||||
--EXPECTF--
|
||||
%AOk for CURLOPT_STDERR
|
||||
|
||||
%AOk for CURLOPT_WRITEHEADER
|
||||
|
||||
%AHello World!
|
||||
Hello World!Ok for CURLOPT_FILE
|
||||
|
||||
%AOk for CURLOPT_INFILE
|
||||
===DONE===
|
||||
%A
|
||||
@@ -3,6 +3,9 @@ Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling c
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
|
||||
die('skip not for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -5,19 +5,28 @@ Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' )
|
||||
die("skip Not Valid for Linux");
|
||||
?>
|
||||
--INI--
|
||||
open_basedir="c:/tmp"
|
||||
--FILE--
|
||||
<?php
|
||||
$base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
|
||||
mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
|
||||
|
||||
ini_set("open_basedir", $base_dir);
|
||||
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
|
||||
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/tmp/foo"));
|
||||
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo"));
|
||||
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
|
||||
curl_close($ch);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
|
||||
rmdir("$base_dir/foo");
|
||||
rmdir($base_dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
%a
|
||||
bool(true)
|
||||
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
|
||||
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (%sbug61948) in %sbug61948-win32.php on line %d
|
||||
bool(false)
|
||||
|
||||
+48
-32
@@ -9,48 +9,64 @@ function curl_cli_server_start() {
|
||||
return getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
}
|
||||
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
$router = "responder/get.php";
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
$router = "responder/get.php";
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$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} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$cmd .= " 2>/dev/null";
|
||||
$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} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$cmd .= " 2>/dev/null";
|
||||
|
||||
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
|
||||
}
|
||||
$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_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT))) {
|
||||
usleep(10000);
|
||||
// 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
|
||||
$error = "Unable to connect to servers\n";
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
usleep(25000); // 25ms per try
|
||||
$status = proc_get_status($handle);
|
||||
$fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT);
|
||||
// Failure, the server is no longer running
|
||||
if (!($status && $status['running'])) {
|
||||
$error = "Server is not running\n";
|
||||
break;
|
||||
}
|
||||
// Success, Connected to servers
|
||||
if ($fp) {
|
||||
$error = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
register_shutdown_function(
|
||||
function($handle) use($router) {
|
||||
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.
|
||||
if ($error) {
|
||||
echo $error;
|
||||
proc_terminate($handle);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
register_shutdown_function(
|
||||
function($handle) use($router) {
|
||||
proc_terminate($handle);
|
||||
},
|
||||
$handle
|
||||
);
|
||||
|
||||
return PHP_CURL_SERVER_ADDRESS;
|
||||
}
|
||||
|
||||
|
||||
+48
-48
@@ -828,7 +828,7 @@ std:
|
||||
|
||||
|
||||
|
||||
#line 832 "<stdout>"
|
||||
#line 832 "ext/date/lib/parse_date.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@@ -976,7 +976,7 @@ yy3:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 980 "<stdout>"
|
||||
#line 980 "ext/date/lib/parse_date.c"
|
||||
yy4:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'E') {
|
||||
@@ -1281,7 +1281,7 @@ yy12:
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1285 "<stdout>"
|
||||
#line 1285 "ext/date/lib/parse_date.c"
|
||||
yy13:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'R') {
|
||||
@@ -2299,7 +2299,7 @@ yy49:
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2303 "<stdout>"
|
||||
#line 2303 "ext/date/lib/parse_date.c"
|
||||
yy50:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy49;
|
||||
@@ -2310,7 +2310,7 @@ yy51:
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2314 "<stdout>"
|
||||
#line 2314 "ext/date/lib/parse_date.c"
|
||||
yy53:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy12;
|
||||
@@ -2692,7 +2692,7 @@ yy72:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2696 "<stdout>"
|
||||
#line 2696 "ext/date/lib/parse_date.c"
|
||||
yy73:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'D') goto yy74;
|
||||
@@ -3377,7 +3377,7 @@ yy166:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3381 "<stdout>"
|
||||
#line 3381 "ext/date/lib/parse_date.c"
|
||||
yy167:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'K') {
|
||||
@@ -3879,7 +3879,7 @@ yy193:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 3883 "<stdout>"
|
||||
#line 3883 "ext/date/lib/parse_date.c"
|
||||
yy194:
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
|
||||
@@ -3938,7 +3938,7 @@ yy198:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 3942 "<stdout>"
|
||||
#line 3942 "ext/date/lib/parse_date.c"
|
||||
yy199:
|
||||
yyaccept = 6;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -4212,7 +4212,7 @@ yy222:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4216 "<stdout>"
|
||||
#line 4216 "ext/date/lib/parse_date.c"
|
||||
yy223:
|
||||
yyaccept = 7;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -4877,7 +4877,7 @@ yy277:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4881 "<stdout>"
|
||||
#line 4881 "ext/date/lib/parse_date.c"
|
||||
yy279:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 0x1F) {
|
||||
@@ -5052,7 +5052,7 @@ yy294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5056 "<stdout>"
|
||||
#line 5056 "ext/date/lib/parse_date.c"
|
||||
yy295:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') {
|
||||
@@ -6216,7 +6216,7 @@ yy363:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6220 "<stdout>"
|
||||
#line 6220 "ext/date/lib/parse_date.c"
|
||||
yy364:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy363;
|
||||
@@ -6845,7 +6845,7 @@ yy392:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 6849 "<stdout>"
|
||||
#line 6849 "ext/date/lib/parse_date.c"
|
||||
yy393:
|
||||
yyaccept = 5;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -8544,7 +8544,7 @@ yy454:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 8548 "<stdout>"
|
||||
#line 8548 "ext/date/lib/parse_date.c"
|
||||
yy455:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9091,7 +9091,7 @@ yy475:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9095 "<stdout>"
|
||||
#line 9095 "ext/date/lib/parse_date.c"
|
||||
yy476:
|
||||
yyaccept = 10;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9235,7 +9235,7 @@ yy487:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9239 "<stdout>"
|
||||
#line 9239 "ext/date/lib/parse_date.c"
|
||||
yy489:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9271,7 +9271,7 @@ yy490:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9275 "<stdout>"
|
||||
#line 9275 "ext/date/lib/parse_date.c"
|
||||
yy491:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -9567,7 +9567,7 @@ yy522:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9571 "<stdout>"
|
||||
#line 9571 "ext/date/lib/parse_date.c"
|
||||
yy524:
|
||||
yyaccept = 11;
|
||||
YYMARKER = ++YYCURSOR;
|
||||
@@ -9676,7 +9676,7 @@ yy534:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 9680 "<stdout>"
|
||||
#line 9680 "ext/date/lib/parse_date.c"
|
||||
yy535:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'M') goto yy536;
|
||||
@@ -10351,7 +10351,7 @@ yy604:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10355 "<stdout>"
|
||||
#line 10355 "ext/date/lib/parse_date.c"
|
||||
yy607:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -10395,7 +10395,7 @@ yy611:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10399 "<stdout>"
|
||||
#line 10399 "ext/date/lib/parse_date.c"
|
||||
yy612:
|
||||
yyaccept = 11;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -11004,7 +11004,7 @@ yy656:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11008 "<stdout>"
|
||||
#line 11008 "ext/date/lib/parse_date.c"
|
||||
yy657:
|
||||
yyaccept = 13;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -11115,7 +11115,7 @@ yy666:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11119 "<stdout>"
|
||||
#line 11119 "ext/date/lib/parse_date.c"
|
||||
yy667:
|
||||
yyaccept = 14;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -11334,7 +11334,7 @@ yy700:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 11338 "<stdout>"
|
||||
#line 11338 "ext/date/lib/parse_date.c"
|
||||
yy701:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '5') {
|
||||
@@ -11834,7 +11834,7 @@ yy763:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11838 "<stdout>"
|
||||
#line 11838 "ext/date/lib/parse_date.c"
|
||||
yy764:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'C') goto yy765;
|
||||
@@ -11878,7 +11878,7 @@ yy770:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 11882 "<stdout>"
|
||||
#line 11882 "ext/date/lib/parse_date.c"
|
||||
yy772:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'V') goto yy765;
|
||||
@@ -12011,7 +12011,7 @@ yy783:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12015 "<stdout>"
|
||||
#line 12015 "ext/date/lib/parse_date.c"
|
||||
yy784:
|
||||
yych = *++YYCURSOR;
|
||||
switch (yych) {
|
||||
@@ -12162,7 +12162,7 @@ yy793:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 12166 "<stdout>"
|
||||
#line 12166 "ext/date/lib/parse_date.c"
|
||||
yy794:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'I') goto yy927;
|
||||
@@ -12374,7 +12374,7 @@ yy814:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 12378 "<stdout>"
|
||||
#line 12378 "ext/date/lib/parse_date.c"
|
||||
yy815:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy56;
|
||||
@@ -12399,7 +12399,7 @@ yy816:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 12403 "<stdout>"
|
||||
#line 12403 "ext/date/lib/parse_date.c"
|
||||
yy818:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -12472,7 +12472,7 @@ yy821:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 12476 "<stdout>"
|
||||
#line 12476 "ext/date/lib/parse_date.c"
|
||||
yy822:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -12579,7 +12579,7 @@ yy842:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 12583 "<stdout>"
|
||||
#line 12583 "ext/date/lib/parse_date.c"
|
||||
yy843:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '2') {
|
||||
@@ -12846,7 +12846,7 @@ yy848:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 12850 "<stdout>"
|
||||
#line 12850 "ext/date/lib/parse_date.c"
|
||||
yy849:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'H') {
|
||||
@@ -13653,7 +13653,7 @@ yy973:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 13657 "<stdout>"
|
||||
#line 13657 "ext/date/lib/parse_date.c"
|
||||
yy974:
|
||||
yyaccept = 22;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -14587,7 +14587,7 @@ yy1067:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 14591 "<stdout>"
|
||||
#line 14591 "ext/date/lib/parse_date.c"
|
||||
yy1068:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy60;
|
||||
@@ -14690,7 +14690,7 @@ yy1075:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 14694 "<stdout>"
|
||||
#line 14694 "ext/date/lib/parse_date.c"
|
||||
yy1076:
|
||||
yyaccept = 25;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -15562,7 +15562,7 @@ yy1117:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 15566 "<stdout>"
|
||||
#line 15566 "ext/date/lib/parse_date.c"
|
||||
yy1118:
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
@@ -15625,7 +15625,7 @@ yy1125:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 15629 "<stdout>"
|
||||
#line 15629 "ext/date/lib/parse_date.c"
|
||||
yy1127:
|
||||
yyaccept = 26;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -15741,7 +15741,7 @@ yy1141:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 15745 "<stdout>"
|
||||
#line 15745 "ext/date/lib/parse_date.c"
|
||||
yy1142:
|
||||
yych = *++YYCURSOR;
|
||||
goto yy1117;
|
||||
@@ -18287,7 +18287,7 @@ yy1294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 18291 "<stdout>"
|
||||
#line 18291 "ext/date/lib/parse_date.c"
|
||||
yy1295:
|
||||
yyaccept = 28;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -18542,7 +18542,7 @@ yy1315:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 18546 "<stdout>"
|
||||
#line 18546 "ext/date/lib/parse_date.c"
|
||||
yy1317:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -19927,7 +19927,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 19931 "<stdout>"
|
||||
#line 19931 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'N') {
|
||||
@@ -20344,7 +20344,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 20348 "<stdout>"
|
||||
#line 20348 "ext/date/lib/parse_date.c"
|
||||
yy1418:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'Y') {
|
||||
@@ -20385,7 +20385,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 20389 "<stdout>"
|
||||
#line 20389 "ext/date/lib/parse_date.c"
|
||||
yy1421:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'S') {
|
||||
@@ -22325,7 +22325,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22329 "<stdout>"
|
||||
#line 22329 "ext/date/lib/parse_date.c"
|
||||
yy1501:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'N') {
|
||||
@@ -22467,7 +22467,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22471 "<stdout>"
|
||||
#line 22471 "ext/date/lib/parse_date.c"
|
||||
yy1509:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
@@ -22988,7 +22988,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22992 "<stdout>"
|
||||
#line 22992 "ext/date/lib/parse_date.c"
|
||||
yy1532:
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
||||
+583
-432
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1075,7 +1075,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
|
||||
dom_object *intern = ecalloc(1, sizeof(dom_object) + zend_object_properties_size(class_type));
|
||||
|
||||
zend_class_entry *base_class = class_type;
|
||||
while (base_class->type != ZEND_INTERNAL_CLASS && base_class->parent != NULL) {
|
||||
while ((base_class->type != ZEND_INTERNAL_CLASS || base_class->info.internal.module->module_number != dom_module_entry.module_number) && base_class->parent != NULL) {
|
||||
base_class = base_class->parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #57547 Settings options on file doesn't give same result as constructor options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$filenames = array("..", __FILE__);
|
||||
|
||||
foreach ($filenames as $filename) {
|
||||
$finfo = new finfo(FILEINFO_MIME);
|
||||
var_dump($finfo->file($filename));
|
||||
|
||||
$finfo2 = new finfo();
|
||||
var_dump($finfo2->file($filename, FILEINFO_MIME));
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(9) "directory"
|
||||
string(9) "directory"
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
===DONE===
|
||||
+3
-3
@@ -1036,7 +1036,7 @@ void php_gd_error_method(int type, const char *format, va_list args)
|
||||
default:
|
||||
type = E_ERROR;
|
||||
}
|
||||
php_verror(NULL, "", type, format, args TSRMLS_CC);
|
||||
php_verror(NULL, "", type, format, args);
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
@@ -3040,7 +3040,7 @@ PHP_FUNCTION(imagegammacorrect)
|
||||
}
|
||||
|
||||
if ( input <= 0.0 || output <= 0.0 ) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Gamma values should be positive");
|
||||
php_error_docref(NULL, E_WARNING, "Gamma values should be positive");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -4668,7 +4668,7 @@ PHP_FUNCTION(imagecropauto)
|
||||
|
||||
case GD_CROP_THRESHOLD:
|
||||
if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color argument missing with threshold mode");
|
||||
php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
im_crop = gdImageCropThreshold(im, color, (float) threshold);
|
||||
|
||||
+17
-1
@@ -57,6 +57,16 @@ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
|
||||
} /* }}} */
|
||||
|
||||
static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
|
||||
{
|
||||
if(ctx->data) {
|
||||
ctx->data = NULL;
|
||||
}
|
||||
if(ctx) {
|
||||
efree(ctx);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
|
||||
{
|
||||
|
||||
if(ctx->data) {
|
||||
@@ -82,6 +92,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
gdIOCtx *ctx = NULL;
|
||||
zval *to_zval = NULL;
|
||||
php_stream *stream;
|
||||
int close_stream = 1;
|
||||
|
||||
/* The third (quality) parameter for Wbmp stands for the threshold when called from image2wbmp().
|
||||
* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
|
||||
@@ -120,6 +131,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
close_stream = 0;
|
||||
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
|
||||
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
|
||||
@@ -156,7 +168,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
ctx = emalloc(sizeof(gdIOCtx));
|
||||
ctx->putC = _php_image_stream_putc;
|
||||
ctx->putBuf = _php_image_stream_putbuf;
|
||||
ctx->gd_free = _php_image_stream_ctxfree;
|
||||
if (close_stream) {
|
||||
ctx->gd_free = _php_image_stream_ctxfreeandclose;
|
||||
} else {
|
||||
ctx->gd_free = _php_image_stream_ctxfree;
|
||||
}
|
||||
ctx->data = (void *)stream;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73549 (Use after free when stream is passed to imagepng)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png', 'w');
|
||||
$im = imagecreatetruecolor(8, 8);
|
||||
var_dump(imagepng($im, $stream));
|
||||
var_dump($stream);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(%d) of type (stream)
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
|
||||
?>
|
||||
@@ -4,6 +4,7 @@ Font charmap order is deterministic based on order in the font, use the selected
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
|
||||
if(gd_info()['JIS-mapped Japanese Font Support']) die('skip JIS-mapped Japanese Font Support not supported');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -676,8 +676,10 @@ PHP_FUNCTION(grapheme_stristr)
|
||||
static inline int32_t
|
||||
grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, prev_pos = 0;
|
||||
int ret_pos = 0, prev_ret_pos = 0;
|
||||
int pos = 0;
|
||||
int ret_pos = 0;
|
||||
int break_pos, prev_break_pos;
|
||||
int count = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
pos = ubrk_next(bi);
|
||||
@@ -686,23 +688,24 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char
|
||||
break;
|
||||
}
|
||||
|
||||
for ( break_pos = ret_pos; break_pos < pos; ) {
|
||||
count++;
|
||||
prev_break_pos = break_pos;
|
||||
U8_FWD_1(pstr, break_pos, str_len);
|
||||
|
||||
if ( prev_break_pos == break_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
csize = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we are beyond our limit, then the loop is done */
|
||||
if ( pos > csize ) {
|
||||
if ( count > csize ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* update our pointer in the original UTF-8 buffer by as many characters
|
||||
as ubrk_next iterated over */
|
||||
|
||||
prev_ret_pos = ret_pos;
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos);
|
||||
|
||||
if ( prev_ret_pos == ret_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
break;
|
||||
}
|
||||
|
||||
prev_pos = pos;
|
||||
ret_pos = break_pos;
|
||||
}
|
||||
|
||||
return ret_pos;
|
||||
@@ -713,8 +716,8 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char
|
||||
static inline int32_t
|
||||
grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, prev_pos = 0;
|
||||
int ret_pos = 0, prev_ret_pos = 0;
|
||||
int pos = 0;
|
||||
int ret_pos = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
pos = ubrk_next(bi);
|
||||
@@ -723,20 +726,11 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char
|
||||
break;
|
||||
}
|
||||
|
||||
prev_ret_pos = ret_pos;
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos);
|
||||
|
||||
if ( ret_pos > bsize ) {
|
||||
ret_pos = prev_ret_pos;
|
||||
if ( pos > bsize ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( prev_ret_pos == ret_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
break;
|
||||
}
|
||||
|
||||
prev_pos = pos;
|
||||
ret_pos = pos;
|
||||
}
|
||||
|
||||
return ret_pos;
|
||||
@@ -747,7 +741,7 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char
|
||||
static inline int32_t
|
||||
grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, next_pos = 0;
|
||||
int next_pos = 0;
|
||||
int ret_pos = 0;
|
||||
|
||||
while ( size ) {
|
||||
@@ -756,16 +750,10 @@ grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pst
|
||||
if ( UBRK_DONE == next_pos ) {
|
||||
break;
|
||||
}
|
||||
pos = next_pos;
|
||||
ret_pos = next_pos;
|
||||
size--;
|
||||
}
|
||||
|
||||
/* pos is one past the last UChar - and represent the number of code units to
|
||||
advance in the utf-8 buffer
|
||||
*/
|
||||
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos);
|
||||
|
||||
return ret_pos;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -785,9 +773,8 @@ static grapheme_extract_iter grapheme_extract_iters[] = {
|
||||
PHP_FUNCTION(grapheme_extract)
|
||||
{
|
||||
char *str, *pstr;
|
||||
UChar *ustr;
|
||||
UText ut = UTEXT_INITIALIZER;
|
||||
size_t str_len;
|
||||
int32_t ustr_len;
|
||||
zend_long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
|
||||
zend_long lstart = 0; /* starting position in str in bytes */
|
||||
int32_t start = 0;
|
||||
@@ -871,21 +858,15 @@ PHP_FUNCTION(grapheme_extract)
|
||||
RETURN_STRINGL(pstr, nsize);
|
||||
}
|
||||
|
||||
/* convert the strings to UTF-16. */
|
||||
ustr = NULL;
|
||||
ustr_len = 0;
|
||||
status = U_ZERO_ERROR;
|
||||
intl_convert_utf8_to_utf16(&ustr, &ustr_len, pstr, str_len, &status );
|
||||
utext_openUTF8(&ut, pstr, str_len, &status);
|
||||
|
||||
if ( U_FAILURE( status ) ) {
|
||||
/* Set global error code. */
|
||||
intl_error_set_code( NULL, status );
|
||||
|
||||
/* Set error messages. */
|
||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 );
|
||||
|
||||
if ( NULL != ustr )
|
||||
efree( ustr );
|
||||
intl_error_set_custom_msg( NULL, "Error opening UTF-8 text", 0 );
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -894,8 +875,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||
status = U_ZERO_ERROR;
|
||||
bi = grapheme_get_break_iterator(u_break_iterator_buffer, &status );
|
||||
|
||||
ubrk_setText(bi, ustr, ustr_len, &status);
|
||||
|
||||
ubrk_setUText(bi, &ut, &status);
|
||||
/* if the caller put us in the middle of a grapheme, we can't detect it in all cases since we
|
||||
can't back up. So, we will not do anything. */
|
||||
|
||||
@@ -903,9 +883,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||
/* it's ok to convert str_len to in32_t since if it were too big intl_convert_utf8_to_utf16 above would fail */
|
||||
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, (unsigned char *)pstr, (int32_t)str_len);
|
||||
|
||||
if (ustr) {
|
||||
efree(ustr);
|
||||
}
|
||||
utext_close(&ut);
|
||||
ubrk_close(bi);
|
||||
|
||||
if ( NULL != next ) {
|
||||
|
||||
@@ -1628,7 +1628,7 @@ PHP_FUNCTION(locale_accept_from_http)
|
||||
len = end ? end-start : http_accept_len-(start-http_accept);
|
||||
if(len > ULOC_FULLNAME_CAPACITY) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"locale_accept_from_http: locale string too long", 0 TSRMLS_CC );
|
||||
"locale_accept_from_http: locale string too long", 0 );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if(end) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #68447: grapheme_extract take an extra trailing character
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$katsushikaku = "葛󠄁飾区";
|
||||
echo grapheme_extract($katsushikaku, 1) . "\n";
|
||||
|
||||
$haiyore = "這󠄀いよれ";
|
||||
echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_COUNT) . "\n";
|
||||
echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_COUNT) . "\n";
|
||||
echo grapheme_extract($haiyore, 6, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 9, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 12, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
echo grapheme_extract($haiyore, 3, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
--EXPECT--
|
||||
葛󠄁
|
||||
這󠄀
|
||||
這󠄀い
|
||||
|
||||
這󠄀
|
||||
這󠄀い
|
||||
|
||||
這󠄀
|
||||
這󠄀い
|
||||
+3
-3
@@ -148,7 +148,7 @@ static PHP_GINIT_FUNCTION(json)
|
||||
#endif
|
||||
json_globals->encoder_depth = 0;
|
||||
json_globals->error_code = 0;
|
||||
json_globals->encode_max_depth = 0;
|
||||
json_globals->encode_max_depth = PHP_JSON_PARSER_DEFAULT_DEPTH;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -261,12 +261,12 @@ static PHP_FUNCTION(json_decode)
|
||||
}
|
||||
|
||||
if (depth <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be greater than zero");
|
||||
php_error_docref(NULL, E_WARNING, "Depth must be greater than zero");
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (depth > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be lower than %d", INT_MAX);
|
||||
php_error_docref(NULL, E_WARNING, "Depth must be lower than %d", INT_MAX);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,10 @@ mbfl_memory_device_output(int c, void *data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -169,6 +173,10 @@ mbfl_memory_device_output2(int c, void *data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -194,6 +202,10 @@ mbfl_memory_device_output4(int c, void* data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -227,7 +239,12 @@ mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc)
|
||||
if ((device->pos + len) >= device->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char);
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -254,7 +271,12 @@ mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len
|
||||
if ((device->pos + len) >= device->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -281,7 +303,12 @@ mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src)
|
||||
if ((dest->pos + src->pos) >= dest->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -336,6 +363,10 @@ mbfl_wchar_device_output(int c, void *data)
|
||||
unsigned int *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
|
||||
@@ -3825,7 +3825,7 @@ detect_end:
|
||||
if (elist != NULL) {
|
||||
efree((void *)elist);
|
||||
}
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references");
|
||||
php_error_docref(NULL, E_WARNING, "Cannot handle recursive references");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(stack);
|
||||
@@ -3942,7 +3942,7 @@ conv_end:
|
||||
}
|
||||
}
|
||||
efree(stack);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references");
|
||||
php_error_docref(NULL, E_WARNING, "Cannot handle recursive references");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(stack);
|
||||
|
||||
+2
-2
@@ -642,7 +642,7 @@ PHP_FUNCTION(mcrypt_generic)
|
||||
block_size = mcrypt_enc_get_block_size(pm->td);
|
||||
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
|
||||
if (data_size <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Integer overflow in data size");
|
||||
php_error_docref(NULL, E_WARNING, "Integer overflow in data size");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
data_str = zend_string_alloc(data_size, 0);
|
||||
@@ -696,7 +696,7 @@ PHP_FUNCTION(mdecrypt_generic)
|
||||
block_size = mcrypt_enc_get_block_size(pm->td);
|
||||
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
|
||||
if (data_size <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Integer overflow in data size");
|
||||
php_error_docref(NULL, E_WARNING, "Integer overflow in data size");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
data_s = emalloc((size_t)data_size + 1);
|
||||
|
||||
@@ -41,7 +41,7 @@ open_basedir=
|
||||
if (!$link->query("SELECT 1 FROM DUAL"))
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
|
||||
if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) {
|
||||
if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) {
|
||||
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
||||
echo "bug\n";
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
--TEST--
|
||||
Bug (Incorrectly decoding bit values / Malformed server packet. Field length pointing)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
|
||||
if (!$link->query("DROP TABLE IF EXISTS bug_bits")) {
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$link->query("CREATE TABLE `bug_bits` (`inty` bigint(20) unsigned NOT NULL DEFAULT '0', `bitty` bit(64) NOT NULL DEFAULT b'0')")) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
$insertQuery = "INSERT INTO `bug_bits` VALUES (18446744073709551615, 18446744073709551615)".
|
||||
",(18446744073709551614, 18446744073709551614)".
|
||||
",(4294967296, 4294967296)".
|
||||
",(4294967295, 4294967295)".
|
||||
",(2147483648, 2147483648)".
|
||||
",(2147483647, 2147483647)".
|
||||
",(1, 1)";
|
||||
if (!$link->query($insertQuery)) {
|
||||
printf("[004] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!($res = $link->query("SELECT * FROM `bug_bits`"))) {
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
$link->close();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
|
||||
if (!mysqli_query($link, "DROP TABLE IF EXISTS bug_bits"))
|
||||
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(20) "18446744073709551615"
|
||||
["bitty"]=>
|
||||
string(20) "18446744073709551615"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(20) "18446744073709551614"
|
||||
["bitty"]=>
|
||||
string(20) "18446744073709551614"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(10) "4294967296"
|
||||
["bitty"]=>
|
||||
string(10) "4294967296"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(10) "4294967295"
|
||||
["bitty"]=>
|
||||
string(10) "4294967295"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(10) "2147483648"
|
||||
["bitty"]=>
|
||||
string(10) "2147483648"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(10) "2147483647"
|
||||
["bitty"]=>
|
||||
string(10) "2147483647"
|
||||
}
|
||||
array(2) {
|
||||
["inty"]=>
|
||||
string(1) "1"
|
||||
["bitty"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Done
|
||||
@@ -127,10 +127,10 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: mysqli_real_connect(): (HY000/1862): %s in %s on line %d
|
||||
Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d
|
||||
[001] Cannot connect [1862] %s
|
||||
|
||||
Warning: mysqli_real_connect(): (HY000/1862): %s in %s on line %d
|
||||
Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d
|
||||
[003] Cannot connect [1862] %s
|
||||
[006] Connect allowed, query fail, [1820] %s
|
||||
[008] Connect allowed, pw set, [0%A
|
||||
|
||||
@@ -88,6 +88,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
|
||||
} else {
|
||||
DBG_INF("stringify");
|
||||
tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
|
||||
DBG_INF_FMT("value=%s", tmp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1607,7 +1607,8 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
|
||||
zval *current_field, *end_field, *start_field;
|
||||
zend_uchar * p = row_buffer->ptr;
|
||||
size_t data_size = row_buffer->app;
|
||||
zend_uchar * bit_area = (zend_uchar*) row_buffer->ptr + data_size + 1; /* we allocate from here */
|
||||
/* we allocate from here. In pre-7.0 it was +1, as there was an additional \0 for the last string in the packet - because of the zval optimizations - using no-copy */
|
||||
zend_uchar * bit_area = (zend_uchar*) row_buffer->ptr + data_size;
|
||||
const zend_uchar * const packet_end = (zend_uchar*) row_buffer->ptr + data_size;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_rowp_read_text_protocol_aux");
|
||||
@@ -1734,9 +1735,25 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
|
||||
*/
|
||||
p -= len;
|
||||
if (Z_TYPE_P(current_field) == IS_LONG) {
|
||||
/*
|
||||
Andrey : See below. No need of bit_area, as we can use on stack for this.
|
||||
The bit area should be removed - the `prealloc_more_bytes` in php_mysqlnd_read_row_ex()
|
||||
|
||||
char tmp[22];
|
||||
const size_t tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, Z_LVAL_P(current_field));
|
||||
ZVAL_STRINGL(current_field, tmp, tmp_len);
|
||||
*/
|
||||
bit_area += 1 + sprintf((char *)start, ZEND_LONG_FMT, Z_LVAL_P(current_field));
|
||||
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
|
||||
} else if (Z_TYPE_P(current_field) == IS_STRING){
|
||||
} else if (Z_TYPE_P(current_field) == IS_STRING) {
|
||||
/*
|
||||
Andrey : This is totally sensless, but I am not gonna remove it in a production version.
|
||||
This copies the data from the zval to the bit area. The destroys the original value
|
||||
and creates the same one from the bit area. No need. It was making sense in pre-7.0
|
||||
when we used zval IS_STRING with no-copy that referred to the bit area.
|
||||
The bit area has no sense in both the case of IS_LONG and IS_STRING as 7.0 zval
|
||||
IS_STRING always copies.
|
||||
*/
|
||||
memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field));
|
||||
bit_area += Z_STRLEN_P(current_field);
|
||||
*bit_area++ = '\0';
|
||||
@@ -1815,7 +1832,15 @@ php_mysqlnd_rowp_read(void * _packet, MYSQLND_CONN_DATA * conn)
|
||||
packet_type_to_statistic_packet_count[PROT_ROW_PACKET],
|
||||
1);
|
||||
|
||||
/* packet->row_buffer->ptr is of size 'data_size + 1' */
|
||||
/*
|
||||
packet->row_buffer->ptr is of size 'data_size'
|
||||
in pre-7.0 it was really 'data_size + 1' although it was counted as 'data_size'
|
||||
The +1 was for the additional byte needed to \0 terminate the last string in the row.
|
||||
This was needed as the zvals of pre-7.0 could use external memory (no copy param to ZVAL_STRINGL).
|
||||
However, in 7.0+ the strings always copy. Thus this +1 byte was removed. Also the optimization or \0
|
||||
terminating every string, which did overwrite the lengths from the packet. For this reason we needed
|
||||
to keep (and copy) the lengths externally.
|
||||
*/
|
||||
packet->header.size = data_size;
|
||||
packet->row_buffer->app = data_size;
|
||||
|
||||
|
||||
@@ -582,7 +582,7 @@ static void accel_use_shm_interned_strings(void)
|
||||
|
||||
for (j = 0; j < ce->constants_table.nNumUsed; j++) {
|
||||
q = ce->constants_table.arData + j;
|
||||
if (!Z_TYPE(q->val) == IS_UNDEF) continue;
|
||||
if (Z_TYPE(q->val) == IS_UNDEF) continue;
|
||||
if (q->key) {
|
||||
q->key = accel_new_interned_string(q->key);
|
||||
}
|
||||
@@ -592,7 +592,7 @@ static void accel_use_shm_interned_strings(void)
|
||||
/* constant hash keys */
|
||||
for (idx = 0; idx < EG(zend_constants)->nNumUsed; idx++) {
|
||||
p = EG(zend_constants)->arData + idx;
|
||||
if (!Z_TYPE(p->val) == IS_UNDEF) continue;
|
||||
if (Z_TYPE(p->val) == IS_UNDEF) continue;
|
||||
if (p->key) {
|
||||
p->key = accel_new_interned_string(p->key);
|
||||
}
|
||||
@@ -1769,10 +1769,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
|
||||
file_handle->type == ZEND_HANDLE_FILENAME &&
|
||||
UNEXPECTED(access(ZSTR_VAL(persistent_script->full_path), R_OK) != 0)) {
|
||||
if (type == ZEND_REQUIRE) {
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
|
||||
zend_bailout();
|
||||
} else {
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -20,28 +20,43 @@ function php_cli_server_start($ini = "") {
|
||||
$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);
|
||||
}
|
||||
$error = "Unable to connect to servers\n";
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
usleep(25000); // 25ms per try
|
||||
$status = proc_get_status($handle);
|
||||
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
|
||||
// Failure, the server is no longer running
|
||||
if (!($status && $status['running'])) {
|
||||
$error = "Server is not running\n";
|
||||
break;
|
||||
}
|
||||
// Success, Connected to servers
|
||||
if ($fp) {
|
||||
$error = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
echo $error;
|
||||
proc_terminate($handle);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
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.
|
||||
$handle
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -107,8 +107,6 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
|
||||
#else
|
||||
char *base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
zend_long megabyte, overflow;
|
||||
double dummy;
|
||||
|
||||
/* keep the compiler happy */
|
||||
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
@@ -132,10 +130,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
|
||||
|
||||
ini_entry->value = zend_string_init(new_new_value, 1, 1);
|
||||
}
|
||||
megabyte = 1024 * 1024;
|
||||
ZEND_SIGNED_MULTIPLY_LONG(memsize, megabyte, *p, dummy, overflow);
|
||||
if (UNEXPECTED(overflow)) {
|
||||
if (UNEXPECTED(memsize > ZEND_ULONG_MAX / (1024 * 1024))) {
|
||||
*p = ZEND_ULONG_MAX;
|
||||
} else {
|
||||
*p = memsize * (1024 * 1024);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,12 @@ class ServerClientTestCase
|
||||
|
||||
private function spawnWorkerProcess($code)
|
||||
{
|
||||
$cmd = sprintf('%s "%s" %s', PHP_BINARY, __FILE__, WORKER_ARGV_VALUE);
|
||||
|
||||
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
|
||||
$ini = php_ini_loaded_file();
|
||||
$cmd = sprintf('%s %s "%s" %s', PHP_BINARY, $ini ? "-n -c $ini" : "", __FILE__, WORKER_ARGV_VALUE);
|
||||
} else {
|
||||
$cmd = sprintf('%s "%s" %s', PHP_BINARY, __FILE__, WORKER_ARGV_VALUE);
|
||||
}
|
||||
$this->workerHandle = proc_open($cmd, [['pipe', 'r'], ['pipe', 'w'], STDERR], $pipes);
|
||||
$this->workerStdIn = $pipes[0];
|
||||
$this->workerStdOut = $pipes[1];
|
||||
|
||||
@@ -89,7 +89,7 @@ var_dump($dh_details['g']);
|
||||
var_dump(strlen($dh_details['pub_key']));
|
||||
var_dump(strlen($dh_details['priv_key']));
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -98,9 +98,9 @@ int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(20)
|
||||
int(128)
|
||||
int(%d)
|
||||
int(%d)
|
||||
int(0)
|
||||
string(1) "2"
|
||||
int(128)
|
||||
int(128)
|
||||
int(%d)
|
||||
int(%d)
|
||||
|
||||
@@ -3,6 +3,14 @@ openssl_x509_parse() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("openssl")) print "skip";
|
||||
if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0");
|
||||
if(substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$exp = "W. Europe Standard Time";
|
||||
$cmd = "powershell -command [System.TimeZoneInfo]::Local.Id";
|
||||
$r = trim(shell_exec($cmd));
|
||||
if ($exp !== $r) {
|
||||
die("skip expect '$exp', got '$r'");
|
||||
}
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
+15
-2
@@ -1599,8 +1599,8 @@ int php_openssl_setup_crypto(php_stream *stream,
|
||||
if (sslsock->is_client) {
|
||||
SSL_CTX_set_alpn_protos(sslsock->ctx, alpn, alpn_len);
|
||||
} else {
|
||||
sslsock->alpn_ctx = (php_openssl_alpn_ctx *) emalloc(sizeof(php_openssl_alpn_ctx));
|
||||
sslsock->alpn_ctx->data = (unsigned char*)estrndup((const char*)alpn, alpn_len);
|
||||
sslsock->alpn_ctx = (php_openssl_alpn_ctx *) pemalloc(sizeof(php_openssl_alpn_ctx), php_stream_is_persistent(stream));
|
||||
sslsock->alpn_ctx->data = (unsigned char *) pestrndup((const char*)alpn, alpn_len, php_stream_is_persistent(stream));
|
||||
sslsock->alpn_ctx->len = alpn_len;
|
||||
SSL_CTX_set_alpn_select_cb(sslsock->ctx, server_alpn_callback, sslsock);
|
||||
}
|
||||
@@ -1632,6 +1632,13 @@ int php_openssl_setup_crypto(php_stream *stream,
|
||||
php_error_docref(NULL, E_WARNING, "SSL handle creation failure");
|
||||
SSL_CTX_free(sslsock->ctx);
|
||||
sslsock->ctx = NULL;
|
||||
#ifdef HAVE_TLS_ALPN
|
||||
if (sslsock->alpn_ctx) {
|
||||
pefree(sslsock->alpn_ctx->data, php_stream_is_persistent(stream));
|
||||
pefree(sslsock->alpn_ctx, php_stream_is_persistent(stream));
|
||||
sslsock->alpn_ctx = NULL;
|
||||
}
|
||||
#endif
|
||||
return FAILURE;
|
||||
} else {
|
||||
SSL_set_ex_data(sslsock->ssl_handle, php_openssl_get_ssl_stream_data_index(), stream);
|
||||
@@ -2137,6 +2144,12 @@ static int php_openssl_sockop_close(php_stream *stream, int close_handle) /* {{{
|
||||
SSL_CTX_free(sslsock->ctx);
|
||||
sslsock->ctx = NULL;
|
||||
}
|
||||
#ifdef HAVE_TLS_ALPN
|
||||
if (sslsock->alpn_ctx) {
|
||||
pefree(sslsock->alpn_ctx->data, php_stream_is_persistent(stream));
|
||||
pefree(sslsock->alpn_ctx, php_stream_is_persistent(stream));
|
||||
}
|
||||
#endif
|
||||
#ifdef PHP_WIN32
|
||||
if (sslsock->s.socket == -1)
|
||||
sslsock->s.socket = SOCK_ERR;
|
||||
|
||||
+70
-37
@@ -114,9 +114,6 @@ static void php_free_pcre_cache(zval *data) /* {{{ */
|
||||
}
|
||||
#if HAVE_SETLOCALE
|
||||
if ((void*)pce->tables) pefree((void*)pce->tables, 1);
|
||||
if (pce->locale) {
|
||||
zend_string_release(pce->locale);
|
||||
}
|
||||
#endif
|
||||
pefree(pce, 1);
|
||||
}
|
||||
@@ -320,27 +317,30 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
pcre_cache_entry *pce;
|
||||
pcre_cache_entry new_entry;
|
||||
int rc;
|
||||
zend_string *key;
|
||||
|
||||
#if HAVE_SETLOCALE
|
||||
if (BG(locale_string) &&
|
||||
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
|
||||
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
|
||||
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
|
||||
memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
key = regex;
|
||||
}
|
||||
|
||||
/* Try to lookup the cached regex entry, and if successful, just pass
|
||||
back the compiled pattern, otherwise go on and compile it. */
|
||||
pce = zend_hash_find_ptr(&PCRE_G(pcre_cache), regex);
|
||||
pce = zend_hash_find_ptr(&PCRE_G(pcre_cache), key);
|
||||
if (pce) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (pce->locale == BG(locale_string) ||
|
||||
(pce->locale && BG(locale_string) &&
|
||||
ZSTR_LEN(pce->locale) == ZSTR_LEN(BG(locale_string)) &&
|
||||
!memcmp(ZSTR_VAL(pce->locale), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(pce->locale))) ||
|
||||
(!pce->locale &&
|
||||
ZSTR_LEN(BG(locale_string)) == 1 &&
|
||||
ZSTR_VAL(BG(locale_string))[0] == 'C') ||
|
||||
(!BG(locale_string) &&
|
||||
ZSTR_LEN(pce->locale) == 1 &&
|
||||
ZSTR_VAL(pce->locale)[0] == 'C')) {
|
||||
return pce;
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#else
|
||||
return pce;
|
||||
#endif
|
||||
return pce;
|
||||
}
|
||||
|
||||
p = ZSTR_VAL(regex);
|
||||
@@ -349,6 +349,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
get to the end without encountering a delimiter. */
|
||||
while (isspace((int)*(unsigned char *)p)) p++;
|
||||
if (*p == 0) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
php_error_docref(NULL, E_WARNING,
|
||||
p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression");
|
||||
return NULL;
|
||||
@@ -358,6 +363,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
or a backslash. */
|
||||
delimiter = *p++;
|
||||
if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash");
|
||||
return NULL;
|
||||
}
|
||||
@@ -397,6 +407,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
}
|
||||
|
||||
if (*pp == 0) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) {
|
||||
php_error_docref(NULL,E_WARNING, "Null byte in regex");
|
||||
} else if (start_delimiter == end_delimiter) {
|
||||
@@ -453,13 +468,17 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
php_error_docref(NULL,E_WARNING, "Null byte in regex");
|
||||
}
|
||||
efree(pattern);
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_SETLOCALE
|
||||
if (BG(locale_string) &&
|
||||
(ZSTR_LEN(BG(locale_string)) != 1 || ZSTR_VAL(BG(locale_string))[0] != 'C')) {
|
||||
if (key != regex) {
|
||||
tables = pcre_maketables();
|
||||
}
|
||||
#endif
|
||||
@@ -472,6 +491,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
tables);
|
||||
|
||||
if (re == NULL) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %d", error, erroffset);
|
||||
efree(pattern);
|
||||
if (tables) {
|
||||
@@ -516,7 +540,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
* these are supposedly the oldest ones (but not necessarily the least used
|
||||
* ones).
|
||||
*/
|
||||
if (zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) {
|
||||
if (!pce && zend_hash_num_elements(&PCRE_G(pcre_cache)) == PCRE_CACHE_SIZE) {
|
||||
int num_clean = PCRE_CACHE_SIZE / 8;
|
||||
zend_hash_apply_with_argument(&PCRE_G(pcre_cache), pcre_clean_cache, &num_clean);
|
||||
}
|
||||
@@ -527,23 +551,29 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
new_entry.preg_options = poptions;
|
||||
new_entry.compile_options = coptions;
|
||||
#if HAVE_SETLOCALE
|
||||
new_entry.locale = BG(locale_string) ?
|
||||
((GC_FLAGS(BG(locale_string)) & IS_STR_PERSISTENT) ?
|
||||
zend_string_copy(BG(locale_string)) :
|
||||
zend_string_init(ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), 1)) :
|
||||
NULL;
|
||||
new_entry.locale = NULL;
|
||||
new_entry.tables = tables;
|
||||
#endif
|
||||
new_entry.refcount = 0;
|
||||
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &new_entry.capture_count);
|
||||
if (rc < 0) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, &new_entry.name_count);
|
||||
if (rc < 0) {
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc);
|
||||
return NULL;
|
||||
}
|
||||
@@ -556,15 +586,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
|
||||
* as hash keys especually for this table.
|
||||
* See bug #63180
|
||||
*/
|
||||
if (!ZSTR_IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) {
|
||||
zend_string *str = zend_string_init(ZSTR_VAL(regex), ZSTR_LEN(regex), 1);
|
||||
GC_REFCOUNT(str) = 0; /* will be incremented by zend_hash_update_mem() */
|
||||
ZSTR_H(str) = ZSTR_H(regex);
|
||||
regex = str;
|
||||
if (!ZSTR_IS_INTERNED(key) || !(GC_FLAGS(key) & IS_STR_PERMANENT)) {
|
||||
pce = zend_hash_str_update_mem(&PCRE_G(pcre_cache),
|
||||
ZSTR_VAL(key), ZSTR_LEN(key), &new_entry, sizeof(pcre_cache_entry));
|
||||
#if HAVE_SETLOCALE
|
||||
if (key != regex) {
|
||||
zend_string_release(key);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
pce = zend_hash_update_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry));
|
||||
}
|
||||
|
||||
pce = zend_hash_update_mem(&PCRE_G(pcre_cache), regex, &new_entry, sizeof(pcre_cache_entry));
|
||||
|
||||
return pce;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -693,7 +726,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
|
||||
/* Overwrite the passed-in value for subpatterns with an empty array. */
|
||||
if (subpats != NULL) {
|
||||
zval_dtor(subpats);
|
||||
zval_ptr_dtor(subpats);
|
||||
array_init(subpats);
|
||||
}
|
||||
|
||||
@@ -1559,7 +1592,7 @@ static PHP_FUNCTION(preg_replace)
|
||||
|
||||
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 0);
|
||||
if (zcount) {
|
||||
zval_dtor(zcount);
|
||||
zval_ptr_dtor(zcount);
|
||||
ZVAL_LONG(zcount, replace_count);
|
||||
}
|
||||
}
|
||||
@@ -1594,7 +1627,7 @@ static PHP_FUNCTION(preg_replace_callback)
|
||||
|
||||
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 1, 0);
|
||||
if (zcount) {
|
||||
zval_dtor(zcount);
|
||||
zval_ptr_dtor(zcount);
|
||||
ZVAL_LONG(zcount, replace_count);
|
||||
}
|
||||
}
|
||||
@@ -1656,7 +1689,7 @@ static PHP_FUNCTION(preg_replace_callback_array)
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (zcount) {
|
||||
zval_dtor(zcount);
|
||||
zval_ptr_dtor(zcount);
|
||||
ZVAL_LONG(zcount, replace_count);
|
||||
}
|
||||
}
|
||||
@@ -1687,7 +1720,7 @@ static PHP_FUNCTION(preg_filter)
|
||||
|
||||
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 1);
|
||||
if (zcount) {
|
||||
zval_dtor(zcount);
|
||||
zval_ptr_dtor(zcount);
|
||||
ZVAL_LONG(zcount, replace_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #73483 (Segmentation fault on pcre_replace_callback)
|
||||
--FILE--
|
||||
<?php
|
||||
$regex = "#dummy#";
|
||||
setlocale(LC_ALL, "C");
|
||||
var_dump(preg_replace_callback($regex, function (array $matches) use($regex) {
|
||||
setlocale(LC_ALL, "en_US");
|
||||
$ret = preg_replace($regex, "okey", $matches[0]);
|
||||
setlocale(LC_ALL, "C");
|
||||
return $ret;
|
||||
}, "dummy"));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "okey"
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #73612 (preg_*() may leak memory)
|
||||
--FILE--
|
||||
<?php
|
||||
$obj = new stdClass;
|
||||
$obj->obj = $obj;
|
||||
preg_match('/./', 'x', $obj);
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->obj = $obj;
|
||||
preg_replace('/./', '', 'x', -1, $obj);
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->obj = $obj;
|
||||
preg_replace_callback('/./', 'count', 'x', -1, $obj);
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->obj = $obj;
|
||||
preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->obj = $obj;
|
||||
preg_filter('/./', '', 'x', -1, $obj);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+1
-1
@@ -2568,7 +2568,7 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
|
||||
int res;
|
||||
zval val;
|
||||
|
||||
fetch_value(stmt, &val, colno, NULL TSRMLS_CC);
|
||||
fetch_value(stmt, &val, colno, NULL);
|
||||
res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
|
||||
zval_dtor(&val);
|
||||
|
||||
|
||||
@@ -13,8 +13,12 @@ PDOTest::skip();
|
||||
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
|
||||
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
||||
$db = PDOTest::factory();
|
||||
|
||||
$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one");
|
||||
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
|
||||
case 'oci': $from = 'from dual'; break;
|
||||
case 'firebird': $from = 'from rdb$database'; break;
|
||||
default: $from = ''; break;
|
||||
}
|
||||
$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from");
|
||||
$statement->execute();
|
||||
$row = $statement->fetch(PDO::FETCH_LAZY);
|
||||
var_dump(
|
||||
|
||||
@@ -238,14 +238,16 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq
|
||||
/* execute the statement */
|
||||
if (isc_dsql_execute2(H->isc_status, &H->tr, &stmt, PDO_FB_SQLDA_VERSION, &in_sqlda, &out_sqlda)) {
|
||||
RECORD_ERROR(dbh);
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto free_statement;
|
||||
}
|
||||
|
||||
/* find out how many rows were affected */
|
||||
if (isc_dsql_sql_info(H->isc_status, &stmt, sizeof(info_count), const_cast(info_count),
|
||||
sizeof(result), result)) {
|
||||
RECORD_ERROR(dbh);
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto free_statement;
|
||||
}
|
||||
|
||||
if (result[0] == isc_info_sql_records) {
|
||||
@@ -265,6 +267,12 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq
|
||||
RECORD_ERROR(dbh);
|
||||
}
|
||||
|
||||
free_statement:
|
||||
|
||||
if (isc_dsql_free_statement(H->isc_status, &stmt, DSQL_drop)) {
|
||||
RECORD_ERROR(dbh);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -98,9 +98,22 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
|
||||
break;
|
||||
}
|
||||
S->cursor_open = 0;
|
||||
/* assume all params have been bound */
|
||||
|
||||
if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) {
|
||||
/* allocate storage for the output data */
|
||||
if (S->out_sqlda.sqld) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < S->out_sqlda.sqld; i++) {
|
||||
XSQLVAR *var = &S->out_sqlda.sqlvar[i];
|
||||
var->sqlind = (void*)ecalloc(1, var->sqllen + 2 * sizeof(short));
|
||||
var->sqldata = &((char*)var->sqlind)[sizeof(short)];
|
||||
}
|
||||
}
|
||||
|
||||
if (S->statement_type == isc_info_sql_stmt_exec_procedure) {
|
||||
if (isc_dsql_execute2(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda, &S->out_sqlda)) {
|
||||
break;
|
||||
}
|
||||
} else if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -139,8 +152,8 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
|
||||
}
|
||||
|
||||
*S->name = 0;
|
||||
S->cursor_open = (S->out_sqlda.sqln > 0); /* A cursor is opened, when more than zero columns returned */
|
||||
S->exhausted = !S->cursor_open;
|
||||
S->cursor_open = S->out_sqlda.sqln && (S->statement_type != isc_info_sql_stmt_exec_procedure);
|
||||
S->exhausted = !S->out_sqlda.sqln; /* There are data to fetch */
|
||||
|
||||
return 1;
|
||||
} while (0);
|
||||
@@ -162,6 +175,11 @@ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */
|
||||
strcpy(stmt->error_code, "HY000");
|
||||
H->last_app_error = "Cannot fetch from a closed cursor";
|
||||
} else if (!S->exhausted) {
|
||||
if (S->statement_type == isc_info_sql_stmt_exec_procedure) {
|
||||
stmt->row_count = 1;
|
||||
S->exhausted = 1;
|
||||
return 1;
|
||||
}
|
||||
if (isc_dsql_fetch(H->isc_status, &S->stmt, PDO_FB_SQLDA_VERSION, &S->out_sqlda)) {
|
||||
if (H->isc_status[0] && H->isc_status[1]) {
|
||||
RECORD_ERROR(stmt);
|
||||
@@ -169,9 +187,6 @@ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */
|
||||
S->exhausted = 1;
|
||||
return 0;
|
||||
}
|
||||
if (S->statement_type == isc_info_sql_stmt_exec_procedure) {
|
||||
S->exhausted = 1;
|
||||
}
|
||||
stmt->row_count++;
|
||||
return 1;
|
||||
}
|
||||
@@ -188,10 +203,6 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */
|
||||
int colname_len;
|
||||
char *cp;
|
||||
|
||||
/* allocate storage for the column */
|
||||
var->sqlind = (void*)ecalloc(1, var->sqllen + 2*sizeof(short));
|
||||
var->sqldata = &((char*)var->sqlind)[sizeof(short)];
|
||||
|
||||
colname_len = (S->H->fetch_table_names && var->relname_length)
|
||||
? (var->aliasname_length + var->relname_length + 1)
|
||||
: (var->aliasname_length);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
PDO_Firebird: Bug 72931 Insert returning fails on Firebird 3
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die;
|
||||
$C->exec('create table tablea (id integer)');
|
||||
$S = $C->prepare('insert into tablea (id) values (1) returning id');
|
||||
$S->execute();
|
||||
$D = $S->fetch(PDO::FETCH_NUM);
|
||||
echo $D[0][0];
|
||||
unset($S);
|
||||
unset($C);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die;
|
||||
$C->exec('DROP table tablea');
|
||||
?>
|
||||
--EXPECT--
|
||||
1
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
PDO_Firebird: cursor should not be marked as opened on singleton statements
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'testdb.inc';
|
||||
$C = new PDO('firebird:dbname='.$test_base, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING]) or die;
|
||||
@$C->exec('drop table ta_table');
|
||||
$C->exec('create table ta_table (id integer)');
|
||||
$S = $C->prepare('insert into ta_table (id) values (:id) returning id');
|
||||
$S->execute(['id' => 1]);
|
||||
$S->execute(['id' => 2]);
|
||||
unset($S);
|
||||
unset($C);
|
||||
echo 'OK';
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -16,6 +16,17 @@ if (count($tmp) < 2)
|
||||
if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
|
||||
die("skip Test cannot be run against remote database server");
|
||||
|
||||
$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
|
||||
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
|
||||
if (!is_writable($row['value']))
|
||||
die("skip secure_file_priv directory not writable: {$row['value']}");
|
||||
|
||||
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
|
||||
|
||||
if (file_exists($filename) && !is_writable($filename))
|
||||
die("skip {$filename} not writable");
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -16,6 +16,17 @@ if (count($tmp) < 2)
|
||||
if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
|
||||
die("skip Test cannot be run against remote database server");
|
||||
|
||||
$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
|
||||
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
|
||||
if (!is_writable($row['value']))
|
||||
die("skip secure_file_priv directory not writable: {$row['value']}");
|
||||
|
||||
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
|
||||
|
||||
if (file_exists($filename) && !is_writable($filename))
|
||||
die("skip {$filename} not writable");
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -115,4 +126,4 @@ Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: %s in %s on li
|
||||
1 => %d,
|
||||
2 => %s,
|
||||
)
|
||||
done!
|
||||
done!
|
||||
|
||||
@@ -71,7 +71,7 @@ var_dump($db->pgsqlGetNotify());
|
||||
$t = microtime(1);
|
||||
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
|
||||
$diff = microtime(1) - $t;
|
||||
var_dump($diff >= 1 || 1 - abs($diff) < .01);
|
||||
var_dump($diff >= 1 || 1 - abs($diff) < .05);
|
||||
var_dump($notify);
|
||||
|
||||
// Test second parameter, should return immediately because a notify is queued
|
||||
@@ -79,7 +79,7 @@ $db->exec("NOTIFY notifies_phpt");
|
||||
$t = microtime(1);
|
||||
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
|
||||
$diff = microtime(1) - $t;
|
||||
var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
|
||||
var_dump($diff < 1 || abs(1 - abs($diff)) < .05);
|
||||
var_dump(count($notify));
|
||||
|
||||
?>
|
||||
|
||||
+2
-2
@@ -4096,7 +4096,7 @@ PHP_FUNCTION(pg_copy_to)
|
||||
free_pg_null = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
@@ -4229,7 +4229,7 @@ PHP_FUNCTION(pg_copy_from)
|
||||
pg_null_as_free = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ else {
|
||||
echo pg_last_error()."\n";
|
||||
}
|
||||
|
||||
// Create view here
|
||||
pg_query($db,$view_def);
|
||||
|
||||
pg_close($db);
|
||||
|
||||
echo "OK";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
|
||||
$rows = pg_copy_to($db, "(select * from {$view_name})");
|
||||
|
||||
var_dump(gettype($rows));
|
||||
var_dump(count($rows) > 0);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "array"
|
||||
bool(true)
|
||||
@@ -9,6 +9,7 @@ PostgreSQL drop db
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
pg_query($db, "DROP VIEW {$view_name}");
|
||||
pg_query($db, "DROP TABLE ".$table_name);
|
||||
@pg_query($db, "DROP TABLE ".$table_name_92);
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will be created
|
||||
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
|
||||
$num_test_record = 1000; // Number of records to create
|
||||
|
||||
// Test view
|
||||
$view_name = "php_pgsql_viewtest";
|
||||
$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
|
||||
|
||||
// Test table
|
||||
$table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
|
||||
$table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);";
|
||||
|
||||
+21
-7
@@ -3287,19 +3287,33 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
|
||||
|
||||
/* zip or tar-based phar */
|
||||
spprintf(&name, 4096, "phar://%s/%s", file_handle->filename, ".phar/stub.php");
|
||||
if (SUCCESS == phar_orig_zend_open((const char *)name, file_handle)) {
|
||||
if (SUCCESS == phar_orig_zend_open((const char *)name, &f)) {
|
||||
|
||||
efree(name);
|
||||
name = NULL;
|
||||
file_handle->filename = f.filename;
|
||||
if (file_handle->opened_path) {
|
||||
efree(file_handle->opened_path);
|
||||
|
||||
f.filename = file_handle->filename;
|
||||
if (f.opened_path) {
|
||||
efree(f.opened_path);
|
||||
}
|
||||
f.opened_path = file_handle->opened_path;
|
||||
f.free_filename = file_handle->free_filename;
|
||||
|
||||
switch (file_handle->type) {
|
||||
case ZEND_HANDLE_STREAM:
|
||||
case ZEND_HANDLE_MAPPED:
|
||||
if (file_handle->handle.stream.closer && file_handle->handle.stream.handle) {
|
||||
file_handle->handle.stream.closer(file_handle->handle.stream.handle);
|
||||
}
|
||||
file_handle->handle.stream.handle = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
file_handle->opened_path = f.opened_path;
|
||||
file_handle->free_filename = f.free_filename;
|
||||
} else {
|
||||
*file_handle = f;
|
||||
}
|
||||
} else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
|
||||
zend_file_handle_dtor(file_handle);
|
||||
/* compressed phar */
|
||||
file_handle->type = ZEND_HANDLE_STREAM;
|
||||
/* we do our own reading directly from the phar, don't change the next line */
|
||||
|
||||
+153
-66
@@ -61,8 +61,8 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
|
||||
HashTable *_SERVER;
|
||||
zval *stuff;
|
||||
char *path_info;
|
||||
int basename_len = strlen(basename);
|
||||
int code;
|
||||
size_t basename_len = strlen(basename);
|
||||
size_t code;
|
||||
zval temp;
|
||||
|
||||
/* "tweak" $_SERVER variables requested in earlier call to Phar::mungServer() */
|
||||
@@ -150,7 +150,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
|
||||
sapi_header_line ctr = {0};
|
||||
size_t got;
|
||||
zval dummy;
|
||||
int name_len;
|
||||
size_t name_len;
|
||||
zend_file_handle file_handle;
|
||||
zend_op_array *new_op_array;
|
||||
zval result;
|
||||
@@ -162,9 +162,9 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
|
||||
efree(basename);
|
||||
/* highlight source */
|
||||
if (entry[0] == '/') {
|
||||
name_len = spprintf(&name, 4096, "phar://%s%s", arch, entry);
|
||||
spprintf(&name, 4096, "phar://%s%s", arch, entry);
|
||||
} else {
|
||||
name_len = spprintf(&name, 4096, "phar://%s/%s", arch, entry);
|
||||
spprintf(&name, 4096, "phar://%s/%s", arch, entry);
|
||||
}
|
||||
php_get_highlight_struct(&syntax_highlighter_ini);
|
||||
|
||||
@@ -248,10 +248,10 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
|
||||
PHAR_G(cwd_len) = 0;
|
||||
PHAR_G(cwd) = NULL;
|
||||
} else if (entry[0] == '/') {
|
||||
PHAR_G(cwd_len) = cwd - (entry + 1);
|
||||
PHAR_G(cwd_len) = (int)(cwd - (entry + 1));
|
||||
PHAR_G(cwd) = estrndup(entry + 1, PHAR_G(cwd_len));
|
||||
} else {
|
||||
PHAR_G(cwd_len) = cwd - entry;
|
||||
PHAR_G(cwd_len) = (int)(cwd - entry);
|
||||
PHAR_G(cwd) = estrndup(entry, PHAR_G(cwd_len));
|
||||
}
|
||||
}
|
||||
@@ -322,7 +322,7 @@ static void phar_do_403(char *entry, int entry_len) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len) /* {{{ */
|
||||
static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, int f404_len, char *entry, size_t entry_len) /* {{{ */
|
||||
{
|
||||
sapi_header_line ctr = {0};
|
||||
phar_entry_info *info;
|
||||
@@ -398,7 +398,7 @@ static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, in
|
||||
}
|
||||
|
||||
u[0] = '\0';
|
||||
u_len = strlen(u + 1);
|
||||
u_len = (int)strlen(u + 1);
|
||||
e_len -= u_len + 1;
|
||||
|
||||
if (e_len < 0) {
|
||||
@@ -426,7 +426,7 @@ PHP_METHOD(Phar, running)
|
||||
}
|
||||
|
||||
fname = (char*)zend_get_executed_filename();
|
||||
fname_len = strlen(fname);
|
||||
fname_len = (int)strlen(fname);
|
||||
|
||||
if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
|
||||
efree(entry);
|
||||
@@ -463,8 +463,12 @@ PHP_METHOD(Phar, mount)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(path_len) || ZEND_SIZE_T_INT_OVFL(actual_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
fname = (char*)zend_get_executed_filename();
|
||||
fname_len = strlen(fname);
|
||||
fname_len = (int)strlen(fname);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
phar_unixify_path_separators(fname, fname_len);
|
||||
@@ -495,7 +499,7 @@ carry_on2:
|
||||
return;
|
||||
}
|
||||
carry_on:
|
||||
if (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) {
|
||||
if (SUCCESS != phar_mount_entry(pphar, actual, (int)actual_len, path, (int)path_len)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s within phar %s failed", path, actual, arch);
|
||||
if (path && path == entry) {
|
||||
efree(entry);
|
||||
@@ -525,7 +529,7 @@ carry_on:
|
||||
}
|
||||
|
||||
goto carry_on;
|
||||
} else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
|
||||
} else if (SUCCESS == phar_split_fname(path, (int)path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
|
||||
path = entry;
|
||||
path_len = entry_len;
|
||||
goto carry_on2;
|
||||
@@ -564,7 +568,12 @@ PHP_METHOD(Phar, webPhar)
|
||||
fname = (char*)zend_get_executed_filename();
|
||||
fname_len = strlen(fname);
|
||||
|
||||
if (phar_open_executed_filename(alias, alias_len, &error) != SUCCESS) {
|
||||
if (ZEND_SIZE_T_INT_OVFL(alias_len)
|
||||
|| ZEND_SIZE_T_INT_OVFL(f404_len) || ZEND_SIZE_T_INT_OVFL(index_php_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (phar_open_executed_filename(alias, (int)alias_len, &error) != SUCCESS) {
|
||||
if (error) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
|
||||
efree(error);
|
||||
@@ -605,7 +614,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
|
||||
if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) &&
|
||||
IS_STRING == Z_TYPE_P(z_path_info)) {
|
||||
entry_len = Z_STRLEN_P(z_path_info);
|
||||
entry_len = (int)Z_STRLEN_P(z_path_info);
|
||||
entry = estrndup(Z_STRVAL_P(z_path_info), entry_len);
|
||||
path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1);
|
||||
memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name));
|
||||
@@ -632,7 +641,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
|
||||
if (path_info) {
|
||||
entry = path_info;
|
||||
entry_len = strlen(entry);
|
||||
entry_len = (int)strlen(entry);
|
||||
spprintf(&path_info, 0, "%s%s", testit, path_info);
|
||||
free_pathinfo = 1;
|
||||
} else {
|
||||
@@ -653,7 +662,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
return;
|
||||
}
|
||||
|
||||
entry_len = strlen(path_info);
|
||||
entry_len = (int)strlen(path_info);
|
||||
entry_len -= (pt - path_info) + (fname_len - (basename - fname));
|
||||
entry = estrndup(pt + (fname_len - (basename - fname)), entry_len);
|
||||
|
||||
@@ -706,8 +715,12 @@ PHP_METHOD(Phar, webPhar)
|
||||
switch (Z_TYPE(retval)) {
|
||||
case IS_STRING:
|
||||
efree(entry);
|
||||
if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN_P(fci.retval))) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback returned oversized value");
|
||||
return;
|
||||
}
|
||||
entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval));
|
||||
entry_len = Z_STRLEN_P(fci.retval);
|
||||
entry_len = (int)Z_STRLEN_P(fci.retval);
|
||||
break;
|
||||
case IS_TRUE:
|
||||
case IS_FALSE:
|
||||
@@ -730,7 +743,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
|
||||
if (entry_len) {
|
||||
phar_postprocess_ru_web(fname, fname_len, &entry, &entry_len, &ru, &ru_len);
|
||||
phar_postprocess_ru_web(fname, (int)fname_len, &entry, &entry_len, &ru, &ru_len);
|
||||
}
|
||||
|
||||
if (!entry_len || (entry_len == 1 && entry[0] == '/')) {
|
||||
@@ -738,7 +751,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
/* direct request */
|
||||
if (index_php_len) {
|
||||
entry = index_php;
|
||||
entry_len = index_php_len;
|
||||
entry_len = (int)index_php_len;
|
||||
if (entry[0] != '/') {
|
||||
spprintf(&entry, 0, "/%s", index_php);
|
||||
++entry_len;
|
||||
@@ -749,9 +762,9 @@ PHP_METHOD(Phar, webPhar)
|
||||
entry_len = sizeof("/index.php")-1;
|
||||
}
|
||||
|
||||
if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) ||
|
||||
if (FAILURE == phar_get_archive(&phar, fname, (int)fname_len, NULL, 0, NULL) ||
|
||||
(info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) {
|
||||
phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
|
||||
phar_do_404(phar, fname, (int)fname_len, f404, (int)f404_len, entry, entry_len);
|
||||
|
||||
if (free_pathinfo) {
|
||||
efree(path_info);
|
||||
@@ -795,9 +808,9 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) ||
|
||||
if (FAILURE == phar_get_archive(&phar, fname, (int)fname_len, NULL, 0, NULL) ||
|
||||
(info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) {
|
||||
phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
|
||||
phar_do_404(phar, fname, (int)fname_len, f404, (int)f404_len, entry, entry_len);
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
#endif
|
||||
@@ -816,7 +829,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
case IS_LONG:
|
||||
if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) {
|
||||
mime_type = "";
|
||||
code = Z_LVAL_P(val);
|
||||
code = (int)Z_LVAL_P(val);
|
||||
} else {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed");
|
||||
if (free_pathinfo) {
|
||||
@@ -965,9 +978,12 @@ PHP_METHOD(Phar, mapPhar)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(alias_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
phar_request_initialize();
|
||||
|
||||
RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error) == SUCCESS);
|
||||
RETVAL_BOOL(phar_open_executed_filename(alias, (int)alias_len, &error) == SUCCESS);
|
||||
|
||||
if (error) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
|
||||
@@ -986,9 +1002,12 @@ PHP_METHOD(Phar, loadPhar)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(alias_len) || ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
phar_request_initialize();
|
||||
|
||||
RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, &error) == SUCCESS);
|
||||
RETVAL_BOOL(phar_open_from_filename(fname, (int)fname_len, alias, (int)alias_len, REPORT_ERRORS, NULL, &error) == SUCCESS);
|
||||
|
||||
if (error) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
|
||||
@@ -1066,8 +1085,12 @@ PHP_METHOD(Phar, isValidPharFilename)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
is_executable = executable;
|
||||
RETVAL_BOOL(phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, is_executable, 2, 1) == SUCCESS);
|
||||
RETVAL_BOOL(phar_detect_phar_fname_ext(fname, (int)fname_len, &ext_str, &ext_len, is_executable, 2, 1) == SUCCESS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1143,6 +1166,9 @@ PHP_METHOD(Phar, __construct)
|
||||
}
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(alias_len) || ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (phar_obj->archive) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice");
|
||||
return;
|
||||
@@ -1166,7 +1192,7 @@ PHP_METHOD(Phar, __construct)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (phar_open_or_create_filename(fname, fname_len, alias, alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) {
|
||||
if (phar_open_or_create_filename(fname, (int)fname_len, alias, (int)alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) {
|
||||
|
||||
if (fname == arch && fname != save_fname) {
|
||||
efree(arch);
|
||||
@@ -1311,12 +1337,15 @@ PHP_METHOD(Phar, unlinkArchive)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (!fname_len) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"\"");
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILURE == phar_open_from_filename(fname, fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) {
|
||||
if (FAILURE == phar_open_from_filename(fname, (int)fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) {
|
||||
if (error) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"%s\": %s", fname, error);
|
||||
efree(error);
|
||||
@@ -1327,7 +1356,7 @@ PHP_METHOD(Phar, unlinkArchive)
|
||||
}
|
||||
|
||||
zname = (char*)zend_get_executed_filename();
|
||||
zname_len = strlen(zname);
|
||||
zname_len = (int)strlen(zname);
|
||||
|
||||
if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS == phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
|
||||
if (arch_len == fname_len && !memcmp(arch, fname, arch_len)) {
|
||||
@@ -1403,9 +1432,10 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
zval *value;
|
||||
zend_bool close_fp = 1;
|
||||
struct _phar_t *p_obj = (struct _phar_t*) puser;
|
||||
uint str_key_len, base_len = p_obj->l, fname_len;
|
||||
uint base_len = p_obj->l, str_key_len;
|
||||
phar_entry_data *data;
|
||||
php_stream *fp;
|
||||
php_stat_len fname_len;
|
||||
size_t contents_len;
|
||||
char *fname, *error = NULL, *base = p_obj->b, *save = NULL, *temp = NULL;
|
||||
zend_string *opened;
|
||||
@@ -1450,7 +1480,13 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
str_key_len = Z_STRLEN(key);
|
||||
if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN(key))) {
|
||||
zval_dtor(&key);
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (too long)", ZSTR_VAL(ce->name));
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
str_key_len = (int)Z_STRLEN(key);
|
||||
str_key = estrndup(Z_STRVAL(key), str_key_len);
|
||||
|
||||
save = str_key;
|
||||
@@ -1477,7 +1513,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
switch (intern->type) {
|
||||
case SPL_FS_DIR:
|
||||
test = spl_filesystem_object_get_path(intern, NULL);
|
||||
fname_len = spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name);
|
||||
fname_len = (php_stat_len)spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name);
|
||||
php_stat(fname, fname_len, FS_IS_DIR, &dummy);
|
||||
|
||||
if (Z_TYPE(dummy) == IS_TRUE) {
|
||||
@@ -1491,7 +1527,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
|
||||
if (test) {
|
||||
fname = test;
|
||||
fname_len = strlen(fname);
|
||||
fname_len = (php_stat_len)strlen(fname);
|
||||
} else {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Could not resolve file path");
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
@@ -1507,7 +1543,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
fname_len = strlen(fname);
|
||||
fname_len = (php_stat_len)strlen(fname);
|
||||
save = fname;
|
||||
goto phar_spl_fileinfo;
|
||||
}
|
||||
@@ -1519,7 +1555,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
|
||||
}
|
||||
|
||||
fname = Z_STRVAL_P(value);
|
||||
fname_len = Z_STRLEN_P(value);
|
||||
fname_len = (php_stat_len)Z_STRLEN_P(value);
|
||||
|
||||
phar_spl_fileinfo:
|
||||
if (base_len) {
|
||||
@@ -1533,7 +1569,7 @@ phar_spl_fileinfo:
|
||||
}
|
||||
|
||||
base = temp;
|
||||
base_len = strlen(base);
|
||||
base_len = (int)strlen(base);
|
||||
|
||||
if (strstr(fname, base)) {
|
||||
str_key_len = fname_len - base_len;
|
||||
@@ -1578,7 +1614,13 @@ phar_spl_fileinfo:
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
str_key_len = Z_STRLEN(key);
|
||||
if (ZEND_SIZE_T_INT_OVFL(Z_STRLEN(key))) {
|
||||
zval_dtor(&key);
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (too long)", ZSTR_VAL(ce->name));
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
str_key_len = (int)Z_STRLEN(key);
|
||||
str_key = estrndup(Z_STRVAL(key), str_key_len);
|
||||
|
||||
save = str_key;
|
||||
@@ -1743,6 +1785,10 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_UINT_OVFL(dir_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (SUCCESS != object_init_ex(&iter, spl_ce_RecursiveDirectoryIterator)) {
|
||||
zval_ptr_dtor(&iter);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
|
||||
@@ -1801,7 +1847,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
pass.c = apply_reg ? Z_OBJCE(regexiter) : Z_OBJCE(iteriter);
|
||||
pass.p = phar_obj;
|
||||
pass.b = dir;
|
||||
pass.l = dir_len;
|
||||
pass.l = (uint)dir_len;
|
||||
pass.count = 0;
|
||||
pass.ret = return_value;
|
||||
pass.fp = php_stream_fopen_tmpfile();
|
||||
@@ -1875,6 +1921,10 @@ PHP_METHOD(Phar, buildFromIterator)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_UINT_OVFL(base_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
|
||||
return;
|
||||
@@ -1885,7 +1935,7 @@ PHP_METHOD(Phar, buildFromIterator)
|
||||
pass.c = Z_OBJCE_P(obj);
|
||||
pass.p = phar_obj;
|
||||
pass.b = base;
|
||||
pass.l = base_len;
|
||||
pass.l = (uint)base_len;
|
||||
pass.ret = return_value;
|
||||
pass.count = 0;
|
||||
pass.fp = php_stream_fopen_tmpfile();
|
||||
@@ -2008,7 +2058,7 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext, ze
|
||||
char *error;
|
||||
const char *pcr_error;
|
||||
int ext_len = ext ? strlen(ext) : 0;
|
||||
int oldname_len;
|
||||
size_t new_len, oldname_len;
|
||||
phar_archive_data *pphar = NULL;
|
||||
php_stream_statbuf ssb;
|
||||
|
||||
@@ -2084,10 +2134,16 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext, ze
|
||||
spprintf(&newname, 0, "%s.%s", strtok(basename, "."), ext);
|
||||
efree(basename);
|
||||
|
||||
|
||||
|
||||
basepath = estrndup(oldpath, (strlen(oldpath) - oldname_len));
|
||||
phar->fname_len = spprintf(&newpath, 0, "%s%s", basepath, newname);
|
||||
new_len = spprintf(&newpath, 0, "%s%s", basepath, newname);
|
||||
if (ZEND_SIZE_T_INT_OVFL(new_len)) {
|
||||
efree(oldpath);
|
||||
efree(basepath);
|
||||
efree(newpath);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "New name is too long");
|
||||
return NULL;
|
||||
}
|
||||
phar->fname_len = (int)new_len;
|
||||
phar->fname = newpath;
|
||||
phar->ext = newpath + phar->fname_len - strlen(ext) - 1;
|
||||
efree(basepath);
|
||||
@@ -2140,7 +2196,7 @@ its_ok:
|
||||
phar->alias_len = 0;
|
||||
} else {
|
||||
phar->alias = estrndup(newpath, strlen(newpath));
|
||||
phar->alias_len = strlen(newpath);
|
||||
phar->alias_len = (int)strlen(newpath);
|
||||
phar->is_temporary_alias = 1;
|
||||
zend_hash_str_update_ptr(&(PHAR_G(phar_alias_map)), newpath, phar->fname_len, phar);
|
||||
}
|
||||
@@ -2403,7 +2459,7 @@ PHP_METHOD(Phar, convertToExecutable)
|
||||
|
||||
is_data = phar_obj->archive->is_data;
|
||||
phar_obj->archive->is_data = 0;
|
||||
ret = phar_convert_to_other(phar_obj->archive, format, ext, flags);
|
||||
ret = phar_convert_to_other(phar_obj->archive, (int)format, ext, flags);
|
||||
phar_obj->archive->is_data = is_data;
|
||||
|
||||
if (ret) {
|
||||
@@ -2506,7 +2562,7 @@ PHP_METHOD(Phar, convertToData)
|
||||
|
||||
is_data = phar_obj->archive->is_data;
|
||||
phar_obj->archive->is_data = 1;
|
||||
ret = phar_convert_to_other(phar_obj->archive, format, ext, flags);
|
||||
ret = phar_convert_to_other(phar_obj->archive, (int)format, ext, flags);
|
||||
phar_obj->archive->is_data = is_data;
|
||||
|
||||
if (ret) {
|
||||
@@ -2687,12 +2743,15 @@ PHP_METHOD(Phar, setAlias)
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS) {
|
||||
if (ZEND_SIZE_T_INT_OVFL(alias_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (alias_len == phar_obj->archive->alias_len && memcmp(phar_obj->archive->alias, alias, alias_len) == 0) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len))) {
|
||||
spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", alias, fd_ptr->fname);
|
||||
if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) {
|
||||
if (SUCCESS == phar_free_alias(fd_ptr, alias, (int)alias_len)) {
|
||||
efree(error);
|
||||
goto valid_alias;
|
||||
}
|
||||
@@ -2700,7 +2759,7 @@ PHP_METHOD(Phar, setAlias)
|
||||
efree(error);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (!phar_validate_alias(alias, alias_len)) {
|
||||
if (!phar_validate_alias(alias, (int)alias_len)) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
|
||||
"Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname);
|
||||
RETURN_FALSE;
|
||||
@@ -2725,13 +2784,13 @@ valid_alias:
|
||||
phar_obj->archive->alias = NULL;
|
||||
}
|
||||
|
||||
phar_obj->archive->alias_len = alias_len;
|
||||
phar_obj->archive->alias_len = (int)alias_len;
|
||||
phar_obj->archive->is_temporary_alias = 0;
|
||||
phar_flush(phar_obj->archive, NULL, 0, 0, &error);
|
||||
|
||||
if (error) {
|
||||
phar_obj->archive->alias = oldalias;
|
||||
phar_obj->archive->alias_len = oldalias_len;
|
||||
phar_obj->archive->alias_len = (int)oldalias_len;
|
||||
phar_obj->archive->is_temporary_alias = old_temp;
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
|
||||
if (readd) {
|
||||
@@ -3003,6 +3062,11 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(key_len)) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
|
||||
"Cannot set signature algorithm, key too long");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (algo) {
|
||||
case PHAR_SIG_SHA256:
|
||||
@@ -3019,10 +3083,10 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
|
||||
return;
|
||||
}
|
||||
phar_obj->archive->sig_flags = algo;
|
||||
phar_obj->archive->sig_flags = (php_uint32)algo;
|
||||
phar_obj->archive->is_modified = 1;
|
||||
PHAR_G(openssl_privatekey) = key;
|
||||
PHAR_G(openssl_privatekey_len) = key_len;
|
||||
PHAR_G(openssl_privatekey_len) = (int)key_len;
|
||||
|
||||
phar_flush(phar_obj->archive, 0, 0, 0, &error);
|
||||
if (error) {
|
||||
@@ -3403,7 +3467,9 @@ PHP_METHOD(Phar, copy)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(newfile_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
|
||||
"Cannot copy \"%s\" to \"%s\", phar is read-only", oldfile, newfile);
|
||||
@@ -3463,7 +3529,7 @@ PHP_METHOD(Phar, copy)
|
||||
}
|
||||
|
||||
newentry.filename = estrndup(newfile, newfile_len);
|
||||
newentry.filename_len = newfile_len;
|
||||
newentry.filename_len = (int)newfile_len;
|
||||
newentry.fp_refcount = 0;
|
||||
|
||||
if (oldentry->fp_type != PHAR_FP) {
|
||||
@@ -3503,6 +3569,9 @@ PHP_METHOD(Phar, offsetExists)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) {
|
||||
if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) {
|
||||
@@ -3542,8 +3611,12 @@ PHP_METHOD(Phar, offsetGet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* security is 0 here so that we can get a better error message than "entry doesn't exist" */
|
||||
if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0))) {
|
||||
if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, (int)fname_len, 1, &error, 0))) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist%s%s", fname, error?", ":"", error?error:"");
|
||||
} else {
|
||||
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
|
||||
@@ -3689,7 +3762,9 @@ PHP_METHOD(Phar, offsetSet)
|
||||
&& zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname);
|
||||
return;
|
||||
@@ -3705,7 +3780,7 @@ PHP_METHOD(Phar, offsetSet)
|
||||
return;
|
||||
}
|
||||
|
||||
phar_add_file(&(phar_obj->archive), fname, fname_len, cont_str, cont_len, zresource);
|
||||
phar_add_file(&(phar_obj->archive), fname, (int)fname_len, cont_str, cont_len, zresource);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3727,6 +3802,9 @@ PHP_METHOD(Phar, offsetUnset)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) {
|
||||
if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) {
|
||||
@@ -3774,13 +3852,16 @@ PHP_METHOD(Phar, addEmptyDir)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &dirname, &dirname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(dirname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create a directory in magic \".phar\" directory");
|
||||
return;
|
||||
}
|
||||
|
||||
phar_mkdir(&phar_obj->archive, dirname, dirname_len);
|
||||
phar_mkdir(&phar_obj->archive, dirname, (int)dirname_len);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3799,6 +3880,9 @@ PHP_METHOD(Phar, addFile)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
#if PHP_API_VERSION < 20100412
|
||||
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
|
||||
@@ -3823,7 +3907,7 @@ PHP_METHOD(Phar, addFile)
|
||||
}
|
||||
|
||||
php_stream_to_zval(resource, &zresource);
|
||||
phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource);
|
||||
phar_add_file(&(phar_obj->archive), fname, (int)fname_len, NULL, 0, &zresource);
|
||||
zval_ptr_dtor(&zresource);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3841,8 +3925,11 @@ PHP_METHOD(Phar, addFromString)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(localname_len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL);
|
||||
phar_add_file(&(phar_obj->archive), localname, (int)localname_len, cont_str, cont_len, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4063,7 +4150,7 @@ PHP_METHOD(Phar, delMetadata)
|
||||
static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error) /* {{{ */
|
||||
{
|
||||
php_stream_statbuf ssb;
|
||||
int len;
|
||||
size_t len;
|
||||
php_stream *fp;
|
||||
char *fullpath;
|
||||
const char *slash;
|
||||
@@ -4333,7 +4420,7 @@ PHP_METHOD(Phar, extractTo)
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0,
|
||||
"Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_P(zval_file), phar_obj->archive->fname);
|
||||
}
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0,
|
||||
"Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error);
|
||||
efree(error);
|
||||
@@ -4354,7 +4441,7 @@ PHP_METHOD(Phar, extractTo)
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0,
|
||||
"Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error);
|
||||
efree(error);
|
||||
@@ -4370,7 +4457,7 @@ all_files:
|
||||
}
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) {
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
|
||||
if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0,
|
||||
"Extraction from phar \"%s\" failed: %s", phar->fname, error);
|
||||
efree(error);
|
||||
|
||||
@@ -344,6 +344,15 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
|
||||
{
|
||||
reflection_object *intern = Z_REFLECTION_P(obj);
|
||||
*gc_data = &intern->obj;
|
||||
*gc_data_count = 1;
|
||||
return zend_std_get_properties(obj);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_object *reflection_objects_new(zend_class_entry *class_type) /* {{{ */
|
||||
{
|
||||
reflection_object *intern;
|
||||
@@ -6524,6 +6533,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
|
||||
reflection_object_handlers.free_obj = reflection_free_objects_storage;
|
||||
reflection_object_handlers.clone_obj = NULL;
|
||||
reflection_object_handlers.write_property = _reflection_write_property;
|
||||
reflection_object_handlers.get_gc = reflection_get_gc;
|
||||
|
||||
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
|
||||
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #46103: ReflectionObject memory leak
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->r = new ReflectionObject($obj);
|
||||
var_dump($obj);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (1) {
|
||||
["r"]=>
|
||||
object(ReflectionObject)#2 (1) {
|
||||
["name"]=>
|
||||
string(8) "stdClass"
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ static void ps_files_open(ps_files *data, const char *key)
|
||||
}
|
||||
|
||||
if (!ps_files_path_create(buf, sizeof(buf), data, key)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN);
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ static void ps_files_open(ps_files *data, const char *key)
|
||||
if (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid())) {
|
||||
close(data->fd);
|
||||
data->fd = -1;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session data file is not created by your uid");
|
||||
php_error_docref(NULL, E_WARNING, "Session data file is not created by your uid");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66481: Calls to session_name() segfault when session.name is null, Windows.
|
||||
--INI--
|
||||
session.name=
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
<?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(session_name("foo"));
|
||||
var_dump(session_name("bar"));
|
||||
--EXPECTF--
|
||||
Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0
|
||||
string(9) "PHPSESSID"
|
||||
string(3) "foo"
|
||||
PHP Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0
|
||||
@@ -4,7 +4,6 @@ Bug #66481: Calls to session_name() segfault when session.name is null.
|
||||
session.name=
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
<?php if(substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
session rfc1867 invalid settings
|
||||
--INI--
|
||||
session.upload_progress.freq=-1
|
||||
error_log=
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include('skipif.inc');
|
||||
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||
die("skip windows only test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(ini_get("session.upload_progress.freq"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s
|
||||
string(2) "1%"
|
||||
PHP Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user