Compare commits

..
Author SHA1 Message Date
Derick Rethans 5fc6a706f5 Update versions for PHP 7.4.10RC1 2020-08-18 06:59:13 +00:00
Derick Rethans c4433bb974 Update NEWS for PHP 7.4.10RC1 2020-08-18 06:59:13 +00:00
722 changed files with 49383 additions and 52707 deletions

No files matched your search

+1 -227
View File
@@ -1,232 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
07 Jan 2021, PHP 7.4.14
- Core:
. Fixed bug #74558 (Can't rebind closure returned by Closure::fromCallable()).
(cmb)
. Fixed bug #80345 (PHPIZE configuration has outdated PHP_RELEASE_VERSION).
(cmb)
. Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb)
. Fixed bug #80362 (Running dtrace scripts can cause php to crash).
(al at coralnet dot name)
. Fixed bug #80393 (Build of PHP extension fails due to configuration gap
with libtool). (kir dot morozov at gmail dot com)
. Fixed bug #80402 (configure filtering out -lpthread). (Nikita)
. Fixed bug #77069 (stream filter loses final block of data). (cmb)
- Fileinfo:
. Fixed bug #77961 (finfo_open crafted magic parsing SIGABRT). (cmb)
- FPM:
. Fixed bug #69625 (FPM returns 200 status on request without
SCRIPT_FILENAME env). (Jakub Zelenka)
- Intl:
. Fixed bug #80425 (MessageFormatAdapter::getArgTypeList redefined). (Nikita)
- OpenSSL:
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to
lack of OCB support). (Nikita)
- Phar:
. Fixed bug #73809 (Phar Zip parse crash - mmap fail). (cmb)
. Fixed bug #75102 (`PharData` says invalid checksum for valid tar). (cmb)
. Fixed bug #77322 (PharData::addEmptyDir('/') Possible integer overflow).
(cmb)
- PDO MySQL:
. Fixed bug #80458 (PDOStatement::fetchAll() throws for upsert queries).
(Kamil Tekiela)
. Fixed bug #63185 (nextRowset() ignores MySQL errors with native prepared
statements). (Nikita)
. Fixed bug #78152 (PDO::exec() - Bad error handling with multiple commands).
(Nikita)
. Fixed bug #70066 (Unexpected "Cannot execute queries while other unbuffered
queries"). (Nikita)
. Fixed bug #71145 (Multiple statements in init command triggers unbuffered
query error). (Nikita)
. Fixed bug #76815 (PDOStatement cannot be GCed/closeCursor-ed when a
PROCEDURE resultset SIGNAL). (Nikita)
- Standard:
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
(CVE-2020-7071) (cmb)
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
. Fixed bug #80411 (References to null-serialized object break serialize()).
(Nikita)
- Tidy:
. Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
- Zlib:
. Fixed #48725 (Support for flushing in zlib stream). (cmb)
26 Nov 2020, PHP 7.4.13
- Core:
. Fixed bug #80280 (ADD_EXTENSION_DEP() fails for ext/standard and ext/date).
(cmb)
. Fixed bug #80258 (Windows Deduplication Enabled, randon permission errors).
(cmb)
- COM:
. Fixed bug #62474 (com_event_sink crashes on certain arguments). (cmb)
- DOM:
. Fixed bug #80268 (loadHTML() truncates at NUL bytes). (cmb)
- FFI:
. Fixed bug #79177 (FFI doesn't handle well PHP exceptions within callback).
(cmb, Dmitry, Nikita)
- IMAP:
. Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb)
. Fixed bug #76618 (segfault on imap_reopen). (girgias)
. Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb)
. Fixed minor regression caused by fixing bug #80220. (cmb)
. Fixed bug #80242 (imap_mail_compose() segfaults for multipart with rfc822).
(cmb)
- MySQLi:
. Fixed bug #79375 (mysqli_store_result does not report error from lock wait
timeout). (Kamil Tekiela, Nikita)
. Fixed bug #76525 (mysqli::commit does not throw if MYSQLI_REPORT_ERROR
enabled and mysqlnd used). (Kamil Tekiela)
. Fixed bug #72413 (mysqlnd segfault (fetch_row second parameter
typemismatch)). (Kamil Tekiela)
- ODBC:
. Fixed bug #44618 (Fetching may rely on uninitialized data). (cmb)
- Opcache:
. Fixed bug #79643 (PHP with Opcache crashes when a file with specific name
is included). (twosee)
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
- OpenSSL:
. Fixed bug #79983 (openssl_encrypt / openssl_decrypt fail with OCB mode).
(Nikita)
- PDO MySQL:
. Fixed bug #66528 (No PDOException or errorCode if database becomes
unavailable before PDO::commit). (Nikita)
. Fixed bug #65825 (PDOStatement::fetch() does not throw exception on broken
server connection). (Nikita)
- SNMP:
. Fixed bug #70461 (disable md5 code when it is not supported in net-snmp).
(Alexander Bergmann, cmb)
- Standard:
. Fixed bug #80266 (parse_url silently drops port number 0). (cmb, Nikita)
29 Oct 2020, PHP 7.4.12
- Core:
. Fixed bug #80061 (Copying large files may have suboptimal performance).
(cmb)
. Fixed bug #79423 (copy command is limited to size of file it can copy).
(cmb)
. Fixed bug #80126 (Covariant return types failing compilation). (Nikita)
. Fixed bug #80186 (Segfault when iterating over FFI object). (Nikita)
- Calendar:
. Fixed bug #80185 (jdtounix() fails after 2037). (cmb)
- IMAP:
. Fixed bug #80213 (imap_mail_compose() segfaults on certain $bodies). (cmb)
. Fixed bug #80215 (imap_mail_compose() may modify by-val parameters). (cmb)
. Fixed bug #80220 (imap_mail_compose() may leak memory). (cmb)
. Fixed bug #80223 (imap_mail_compose() leaks envelope on malformed bodies).
(cmb)
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
(cmb)
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
- MySQLnd:
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with
slashes). (cmb)
. Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
compression is enabled). (Nikita)
- ODBC:
. Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
. Fixed bug #80147 (BINARY strings may not be properly zero-terminated).
(cmb)
. Fixed bug #80150 (Failure to fetch error message). (cmb)
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
- OPcache:
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
binding). (Nikita)
. Fixed bug #80194 (Assertion failure during block assembly of unreachable
free with leading nop). (Nikita)
- PCRE:
. Updated to PCRE 10.35. (cmb)
. Fixed bug #80118 (Erroneous whitespace match with JIT only). (cmb)
- PDO_ODBC:
. Fixed bug #67465 (NULL Pointer dereference in odbc_handle_preparer). (cmb)
- Standard:
. Fixed bug #80114 (parse_url does not accept URLs with port 0). (cmb, twosee)
. Fixed bug #76943 (Inconsistent stream_wrapper_restore() errors). (cmb)
. Fixed bug #76735 (Incorrect message in fopen on invalid mode). (cmb)
- Tidy:
. Fixed bug #77040 (tidyNode::isHtml() is completely broken). (cmb)
01 Oct 2020, PHP 7.4.11
- Core:
. Fixed bug #79979 (passing value to by-ref param via CUFA crashes). (cmb,
Nikita)
. Fixed bug #80037 (Typed property must not be accessed before initialization
when __get() declared). (Nikita)
. Fixed bug #80048 (Bug #69100 has not been fixed for Windows). (cmb)
. Fixed bug #80049 (Memleak when coercing integers to string via variadic
argument). (Nikita)
. Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-`
cookies can be sent). (CVE-2020-7070) (Stas)
- Calendar:
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
(Andy Postnikov)
- COM:
. Fixed bug #64130 (COM obj parameters passed by reference are not updated).
(cmb)
- OPcache:
. Fixed bug #80002 (calc free space for new interned string is wrong).
(t-matsuno)
. Fixed bug #80046 (FREE for SWITCH_STRING optimized away). (Nikita)
. Fixed bug #79825 (opcache.file_cache causes SIGSEGV when custom opcode
handlers changed). (SammyK)
- OpenSSL:
. Fixed bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12
bytes IV). (CVE-2020-7069) (Jakub Zelenka)
- PDO:
. Fixed bug #80027 (Terrible performance using $query->fetch on queries with
many bind parameters). (Matteo)
- SOAP:
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
"Transfer-Encoding: chunked"). (Matteo)
- Standard:
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
. Fixed bug #80077 (getmxrr test bug). (Rainer Jung)
. Fixed bug #72941 (Modifying bucket->data by-ref has no effect any longer).
(cmb)
. Fixed bug #80067 (Omitting the port in bindto setting errors). (cmb)
03 Sep 2020, PHP 7.4.10
20 Aug 2020, PHP 7.4.10RC1
- Core:
. Fixed bug #79884 (PHP_CONFIG_FILE_PATH is meaningless). (cmb)
-5
View File
@@ -125,11 +125,6 @@ DOM:
After: ReflectionMethod::getClosure($object = null)
The new signature is also (LSP) compatible with older PHP versions.
- SAPI:
. Starting with 7.4.11, incoming cookie names are not url-decoded. This was never
required by the standard, outgoing cookie names aren't encoded and this leads
to security issues (CVE-2020-7070).
- SPL:
. Calling get_object_vars() on an ArrayObject instance will now always return
the properties of the ArrayObject itself (or a subclass). Previously it
+4 -4
View File
@@ -164,16 +164,16 @@ int main()
double d = (double) LONG_MIN * LONG_MIN + 2e9;
if ((long) d == 2e9 && (long) -d == -2e9) {
return 0;
exit(0);
}
} else if (sizeof(long) == 8) {
double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
return 0;
exit(0);
}
}
return 1;
exit(1);
}
]])], [
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
@@ -284,7 +284,7 @@ int main()
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
fclose(fp);
return 0;
exit(0);
}
]])], [
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Array addition should not add INDIRECT elements
--FILE--
<?php
$x = 1;
$ary = ['y' => 1];
$ary += $GLOBALS;
var_dump($ary['x']);
$x = 2;
var_dump($ary['x']);
?>
--EXPECT--
int(1)
int(1)
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Add $GLOBALS to itself
--FILE--
<?php
$GLOBALS += $GLOBALS;
$x = $GLOBALS + $GLOBALS;
?>
===DONE===
--EXPECT--
===DONE===
@@ -1,13 +0,0 @@
--TEST--
Assign concat of array and empty string
--FILE--
<?php
$a = [0];
$a .= '';
var_dump($a);
?>
--EXPECTF--
Notice: Array to string conversion in %s on line %d
string(5) "Array"
+1 -1
View File
@@ -7,4 +7,4 @@ $x = (new ReflectionFunction("substr"))->getClosure();
$x->call(new a);
?>
--EXPECTF--
Warning: Cannot rebind scope of closure created from function in %s on line %d
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
+1 -1
View File
@@ -18,5 +18,5 @@ var_dump($c);
Warning: Cannot bind method SplDoublyLinkedList::count() to object of class cls in %s on line %d
NULL
Warning: Cannot rebind scope of closure created from method in %s on line %d
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
NULL
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #79979 (passing value to by-ref param via CUF(A) crashes)
--FILE--
<?php
call_user_func_array("str_replace", ["a", "b", "c", 0]);
$cufa = "call_user_func_array";
$cufa("str_replace", ["a", "b", "c", 0]);
call_user_func_array($cufa, ["str_replace", ["a", "b", "c", 0]]);
?>
--EXPECTF--
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Bug #80037: Typed property must not be accessed before initialization when __get() declared
--FILE--
<?php
final class A
{
public string $a;
public static function fromArray(array $props): self
{
$me = new static;
foreach ($props as $k => &$v) {
$me->{$k} = &$v; # try to remove &
}
return $me;
}
public function __get($name)
{
throw new \LogicException("Property '$name' is not defined.");
}
}
var_dump(A::fromArray(['a' => 'foo']));
?>
--EXPECT--
object(A)#1 (1) {
["a"]=>
string(3) "foo"
}
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #80046: FREE for SWITCH_STRING optimized away
--FILE--
<?php
function test($foo) {
switch ($foo . 'Bar') {
case 'A':
throw new Exception('A');
default:
throw new Exception('Default');
}
}
try {
test('Foo');
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Default
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #80049: Memleak when coercing integers to string via variadic argument
--FILE--
<?php
function coerceToString(string ...$strings) {
var_dump($strings);
}
coerceToString(...[123]);
?>
--EXPECT--
array(1) {
[0]=>
string(3) "123"
}
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #80126: Covariant return types failing compilation
--FILE--
<?php
interface I {
public function method(): I;
}
abstract class A implements I {
public function method(): I { }
}
class C extends A { }
class C2 extends C {
public function method(): C2 { }
}
?>
===DONE===
--EXPECT--
===DONE===
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #80126: Covariant return types failing compilation (variation 2)
--FILE--
<?php
interface I {
public function method(): I;
}
abstract class A implements I {
public function method(): I {
return new static();
}
}
class C extends A { }
interface I2 { }
class C2 extends C implements I2 {
public function method(): C2 { }
}
?>
===DONE===
--EXPECT--
===DONE===
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #80194: Assertion failure during block assembly of unreachable free with leading nop
--FILE--
<?php
function test($x) {
switch ($x->y) {
default:
throw new Exception;
case 'foobar':
return new stdClass();
break;
}
}
$x = (object)['y' => 'foobar'];
var_dump(test($x));
?>
--EXPECT--
object(stdClass)#2 (0) {
}
+12 -12
View File
@@ -118,10 +118,10 @@ bindTo(new Cls, null):
Success!
bindTo(new Cls, Cls::class):
Cannot rebind scope of closure created from function
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, Cls::class):
Cannot rebind scope of closure created from function
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, stdClass::class):
Cannot bind closure to scope of internal class stdClass
@@ -139,10 +139,10 @@ bindTo(new Cls, null):
Success!
bindTo(new Cls, Cls::class):
Cannot rebind scope of closure created from function
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, Cls::class):
Cannot rebind scope of closure created from function
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, stdClass::class):
Cannot bind closure to scope of internal class stdClass
@@ -163,13 +163,13 @@ bindTo(new Cls, Cls::class):
Cannot bind an instance to a static closure
bindTo(null, null):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, ClsChild::class):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(null, ClsUnrelated::class):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
(new Cls)->method()
-------------------
@@ -189,13 +189,13 @@ bindTo(new ClsUnrelated, Cls::class):
Cannot bind method Cls::method() to object of class ClsUnrelated
bindTo(new Cls, null):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(new Cls, ClsUnrelated::class):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(new Cls, ClsChild::class):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
(new SplDoublyLinkedList)->count()
----------------------------------
@@ -216,10 +216,10 @@ bindTo(null, SplDoublyLinkedList::class):
Cannot unbind $this of internal method
bindTo(new SplDoublyLinkedList, null):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
bindTo(new SplDoublyLinkedList, ClsUnrelated::class):
Cannot rebind scope of closure created from method
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
(function() {})()
-----------------
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Make sure type inference upholds invariants for dead arrays
--FILE--
<?php
function test() {
foreach ($a as $v) {
$b[] = $v;
}
}
test();
?>
--EXPECTF--
Notice: Undefined variable: a in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
@@ -1,25 +0,0 @@
--TEST--
EX(func) can be null during write_property in an edge case
--FILE--
<?php
class a {
public static $i = 0;
function __destruct() {
if (self::$i++ != 0) throw new Exception;
$b = new a;
echo $b;
}
}
new a;
?>
--EXPECTF--
Fatal error: Uncaught Error: Object of class a could not be converted to string in %s:%d
Stack trace:
#0 %s(%d): a->__destruct()
#1 {main}
Next Exception in %s:%d
Stack trace:
#0 %s(%d): a->__destruct()
#1 {main}
thrown in %s on line %d
@@ -1,23 +0,0 @@
--TEST--
Exception thrown by __get() during =& assignment
--FILE--
<?php
class Test {
private $x;
public function &__get($name) {
throw new Exception("Foobar");
}
}
$test = new Test;
$y = 5;
try {
$test->x =& $y;
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Foobar
@@ -1,25 +0,0 @@
--TEST--
GC on running generator
--FILE--
<?php
function gen() {
yield;
// Trigger GC while $v is being reassigned.
$ary = [new stdClass, new stdClass, new stdClass];
$ary[0]->foo = $ary;
foreach ($ary as &$v) { }
}
for ($i = 0; $i < 10000; $i++) {
// Make sure gen is registered as a GC root.
$gen = gen();
$gen2 = $gen;
unset($gen);
foreach ($gen2 as $v) {}
}
?>
===DONE===
--EXPECT--
===DONE===
@@ -1,18 +0,0 @@
--TEST--
Yield from non-iterable
--FILE--
<?php
function gen() {
yield from new stdClass;
}
try {
gen()->current();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Can use "yield from" only with arrays and Traversables
@@ -1,30 +0,0 @@
--TEST--
Exception from valid() during yield from
--FILE--
<?php
class FooBar implements Iterator {
function rewind() {}
function current() {}
function key() {}
function next() {}
function valid() {
throw new Exception("Exception from valid()");
}
}
function gen() {
try {
// the fact that the yield from result is used is relevant.
var_dump(yield from new FooBar);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
}
$x = gen();
$x->current();
?>
--EXPECT--
Exception from valid()
@@ -1,16 +0,0 @@
--TEST--
String offset error during list() by-ref assignment
--FILE--
<?php
$a = [0];
$v = 'b';
$i = 0;
list(&$a[$i++]) = $v;
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Missing live range if part of phi
--FILE--
<?php
function doThrow() {
throw new Exception("Test");
}
function test($k) {
// The 0 gives the QM_ASSIGN a non-refcounted type.
$res[$k ? $k : 0] = doThrow();
}
try {
test(new stdClass);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Test
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Test property guard hash value assumption
--FILE--
<?php
class Test {
function __get($var) {
return $this->{$var.''};
}
}
$test = new Test;
var_dump($test->x);
?>
--EXPECTF--
Notice: Undefined property: Test::$x in %s on line %d
NULL
@@ -1,14 +0,0 @@
--TEST--
Regression test for incorrect update of pi node users when removing a predecessor block
--FILE--
<?php
function test() {
for (; $n--; )
C;
}
test();
?>
--EXPECTF--
Notice: Undefined variable: n in %s on line %d
@@ -6,7 +6,6 @@ No warnings should be thrown during heredoc scan-ahead
<<<TEST
${x}
\400
${"\400"}
${/*}
TEST;
@@ -16,8 +15,6 @@ Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Unterminated comment starting line %d in %s on line %d
Parse error: syntax error, unexpected end of file in %s on line %d
+1 -3
View File
@@ -1309,9 +1309,7 @@ static ZEND_COLD void zend_error_va_list(
#ifdef HAVE_DTRACE
if (DTRACE_ERROR_ENABLED()) {
char *dtrace_error_buffer;
va_copy(usr_copy, args);
zend_vspprintf(&dtrace_error_buffer, 0, format, usr_copy);
va_end(usr_copy);
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
efree(dtrace_error_buffer);
}
+41 -4
View File
@@ -4367,7 +4367,7 @@ ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
{
current->handling = EG(error_handling);
current->exception = EG(exception_class);
ZVAL_UNDEF(&current->user_handler);
ZVAL_COPY(&current->user_handler, &EG(user_error_handler));
}
/* }}} */
@@ -4375,17 +4375,54 @@ ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling,
{
if (current) {
zend_save_error_handling(current);
if (error_handling != EH_NORMAL && Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_error_handler));
}
}
ZEND_ASSERT(error_handling == EH_THROW || exception_class == NULL);
EG(error_handling) = error_handling;
EG(exception_class) = exception_class;
EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL;
}
/* }}} */
static int same_zval(zval *zv1, zval *zv2) /* {{{ */
{
if (Z_TYPE_P(zv1) != Z_TYPE_P(zv2)) {
return 0;
}
switch (Z_TYPE_P(zv1)) {
case IS_UNDEF:
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
return 1;
case IS_LONG:
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_DOUBLE:
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_STRING:
case IS_ARRAY:
case IS_OBJECT:
case IS_RESOURCE:
return Z_COUNTED_P(zv1) == Z_COUNTED_P(zv2);
default:
return 0;
}
}
/* }}} */
ZEND_API void zend_restore_error_handling(zend_error_handling *saved) /* {{{ */
{
EG(error_handling) = saved->handling;
EG(exception_class) = saved->exception;
EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL;
if (Z_TYPE(saved->user_handler) != IS_UNDEF
&& !same_zval(&saved->user_handler, &EG(user_error_handler))) {
zval_ptr_dtor(&EG(user_error_handler));
ZVAL_COPY_VALUE(&EG(user_error_handler), &saved->user_handler);
} else if (Z_TYPE(saved->user_handler)) {
zval_ptr_dtor(&saved->user_handler);
}
ZVAL_UNDEF(&saved->user_handler);
}
/* }}} */
+1 -5
View File
@@ -104,11 +104,7 @@ static zend_bool zend_valid_closure_binding(
}
if (is_fake_closure && scope != func->common.scope) {
if (func->common.scope == NULL) {
zend_error(E_WARNING, "Cannot rebind scope of closure created from function");
} else {
zend_error(E_WARNING, "Cannot rebind scope of closure created from method");
}
zend_error(E_WARNING, "Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()");
return 0;
}
+1 -6
View File
@@ -1050,12 +1050,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
return FAILURE;
}
function = (zend_function*)Z_PTR_P(zv);
if (UNEXPECTED(function->common.fn_flags & ZEND_ACC_PRELOADED)
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
zv = zend_hash_add(EG(function_table), Z_STR_P(lcname), zv);
} else {
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
}
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
if (UNEXPECTED(!zv)) {
do_bind_function_error(Z_STR_P(lcname), &function->op_array, 0);
return FAILURE;
-43
View File
@@ -73,44 +73,6 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
}
#endif
#if defined(__i386__) || defined(__x86_64__)
/* Function based on compiler-rt implementation. */
static unsigned get_xcr0_eax() {
# if defined(__GNUC__) || defined(__clang__)
// Check xgetbv; this uses a .byte sequence instead of the instruction
// directly because older assemblers do not include support for xgetbv and
// there is no easy way to conditionally compile based on the assembler used.
unsigned eax, edx;
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
return eax;
# elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
# else
return 0;
# endif
}
static zend_bool is_avx_supported() {
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_AVX)) {
/* No support for AVX */
return 0;
}
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_OSXSAVE)) {
/* The operating system does not support XSAVE. */
return 0;
}
if ((get_xcr0_eax() & 0x6) != 0x6) {
/* XCR0 SSE and AVX bits must be set. */
return 0;
}
return 1;
}
#else
static zend_bool is_avx_supported() {
return 0;
}
#endif
void zend_cpu_startup(void)
{
if (!cpuinfo.initialized) {
@@ -133,11 +95,6 @@ void zend_cpu_startup(void)
} else {
cpuinfo.ebx = 0;
}
if (!is_avx_supported()) {
cpuinfo.edx &= ~ZEND_CPU_FEATURE_AVX;
cpuinfo.ebx &= ~(ZEND_CPU_FEATURE_AVX2 & ~ZEND_CPU_EBX_MASK);
}
}
}
-5
View File
@@ -1512,7 +1512,6 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(EXECUTE_DATA_D)
msg = "Cannot create references to/from string offsets";
break;
}
opline++;
}
break;
EMPTY_SWITCH_DEFAULT_CASE();
@@ -2873,10 +2872,6 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
return;
}
if (UNEXPECTED(EG(exception))) {
ZVAL_ERROR(result);
return;
}
} else if (UNEXPECTED(Z_ISERROR_P(ptr))) {
ZVAL_ERROR(result);
return;
+4 -11
View File
@@ -757,7 +757,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
for (i=0; i<fci->param_count; i++) {
zval *param;
zval *arg = &fci->params[i];
zend_bool must_wrap = 0;
if (ARG_SHOULD_BE_SENT_BY_REF(func, i + 1)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
@@ -766,13 +765,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
ZVAL_NEW_REF(arg, arg);
} else if (!ARG_MAY_BE_SENT_BY_REF(func, i + 1)) {
/* By-value send is not allowed -- emit a warning,
* and perform the call with the value wrapped in a reference. */
* but still perform the call with a by-value send. */
zend_error(E_WARNING,
"Parameter %d to %s%s%s() expected to be a reference, value given", i+1,
func->common.scope ? ZSTR_VAL(func->common.scope->name) : "",
func->common.scope ? "::" : "",
ZSTR_VAL(func->common.function_name));
must_wrap = 1;
if (UNEXPECTED(EG(exception))) {
ZEND_CALL_NUM_ARGS(call) = i;
zend_vm_stack_free_args(call);
@@ -793,12 +791,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
}
param = ZEND_CALL_ARG(call, i+1);
if (EXPECTED(!must_wrap)) {
ZVAL_COPY(param, arg);
} else {
Z_TRY_ADDREF_P(arg);
ZVAL_NEW_REF(param, arg);
}
ZVAL_COPY(param, arg);
}
if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
@@ -1294,7 +1287,7 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */
t_r.it_value.tv_sec = seconds;
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
# if defined(__CYGWIN__) || defined(__PASE__)
# ifdef __CYGWIN__
setitimer(ITIMER_REAL, &t_r, NULL);
}
signo = SIGALRM;
@@ -1356,7 +1349,7 @@ void zend_unset_timeout(void) /* {{{ */
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
# if defined(__CYGWIN__) || defined(__PASE__)
# ifdef __CYGWIN__
setitimer(ITIMER_REAL, &no_timeout, NULL);
# else
setitimer(ITIMER_PROF, &no_timeout, NULL);
+1 -14
View File
@@ -340,16 +340,6 @@ static HashTable *zend_generator_get_gc(zval *object, zval **table, int *n) /* {
return NULL;
}
if (generator->flags & ZEND_GENERATOR_CURRENTLY_RUNNING) {
/* If the generator is currently running, we certainly won't be able to GC any values it
* holds on to. The execute_data state might be inconsistent during execution (e.g. because
* GC has been triggered in the middle of a variable reassignment), so we should not try
* to inspect it here. */
*table = NULL;
*n = 0;
return NULL;
}
op_array = &EX(func)->op_array;
gc_buffer_size = calc_gc_buffer_size(generator);
if (generator->gc_buffer_size < gc_buffer_size) {
@@ -738,9 +728,6 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
}
if (iter->funcs->valid(iter) == FAILURE) {
if (UNEXPECTED(EG(exception) != NULL)) {
goto exception;
}
/* reached end of iteration */
goto failure;
}
@@ -769,7 +756,7 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
return SUCCESS;
exception:
zend_generator_throw_exception(generator, NULL);
zend_rethrow_exception(generator->execute_data);
failure:
zval_ptr_dtor(&generator->values);
+13 -17
View File
@@ -2124,7 +2124,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
{
uint32_t idx;
Bucket *p;
zval *t, *s;
zval *t;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
@@ -2133,20 +2133,18 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
if (overwrite) {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
s = &p->val;
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
s = Z_INDIRECT_P(s);
}
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
}
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_UPDATE | HASH_UPDATE_INDIRECT);
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_UPDATE | HASH_UPDATE_INDIRECT);
if (pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_update(target, p->h, s);
t = zend_hash_index_update(target, p->h, &p->val);
if (pCopyConstructor) {
pCopyConstructor(t);
}
@@ -2155,20 +2153,18 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
} else {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
s = &p->val;
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
s = Z_INDIRECT_P(s);
}
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
}
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_ADD | HASH_UPDATE_INDIRECT);
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_ADD | HASH_UPDATE_INDIRECT);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_add(target, p->h, s);
t = zend_hash_index_add(target, p->h, &p->val);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
+12 -10
View File
@@ -259,6 +259,8 @@ static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name
/* Instanceof that's safe to use on unlinked classes. */
static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) {
zend_class_entry *ce;
if (ce1 == ce2) {
return 1;
}
@@ -267,18 +269,18 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
return instanceof_function(ce1, ce2);
}
if (ce1->parent) {
zend_class_entry *parent_ce;
if (ce1->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
parent_ce = ce1->parent;
ce = ce1;
while (ce->parent) {
if (ce->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
ce = ce->parent;
} else {
parent_ce = zend_lookup_class_ex(ce1->parent_name, NULL,
ce = zend_lookup_class_ex(ce->parent_name, NULL,
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (!ce) {
break;
}
}
/* It's not sufficient to only check the parent chain itself, as need to do a full
* recursive instanceof in case the parent interfaces haven't been copied yet. */
if (parent_ce && unlinked_instanceof(parent_ce, ce2)) {
if (ce == ce2) {
return 1;
}
}
@@ -295,7 +297,7 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
}
} else {
for (i = 0; i < ce1->num_interfaces; i++) {
zend_class_entry *ce = zend_lookup_class_ex(
ce = zend_lookup_class_ex(
ce1->interface_names[i].name, ce1->interface_names[i].lc_name,
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (ce && unlinked_instanceof(ce, ce2)) {
+1 -1
View File
@@ -321,7 +321,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
{
zend_ini_entry *ini_entry;
zend_string *duplicate;
uint8_t modifiable;
zend_bool modifiable;
zend_bool modified;
if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL) {
+2 -1
View File
@@ -1072,7 +1072,8 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
octal_buf[2] = *(++s);
}
}
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
if (octal_buf[2] &&
(octal_buf[0] > '3')) {
/* 3 octit values must not overflow 0xFF (\377) */
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
}
+6 -14
View File
@@ -619,8 +619,8 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
if (EXPECTED(Z_TYPE_P(zv) == IS_STRING)) {
zend_string *str = Z_STR_P(zv);
if (EXPECTED(str == member) ||
/* "str" always has a pre-calculated hash value here */
(EXPECTED(ZSTR_H(str) == zend_string_hash_val(member)) &&
/* hash values are always pred-calculated here */
(EXPECTED(ZSTR_H(str) == ZSTR_H(member)) &&
EXPECTED(zend_string_equal_content(str, member)))) {
return &Z_PROPERTY_GUARD_P(zv);
} else if (EXPECTED(Z_PROPERTY_GUARD_P(zv) == 0)) {
@@ -809,13 +809,6 @@ exit:
}
/* }}} */
static zend_always_inline zend_bool property_uses_strict_types() {
zend_execute_data *execute_data = EG(current_execute_data);
return execute_data
&& execute_data->func
&& ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data));
}
ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
{
zend_object *zobj;
@@ -840,7 +833,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
if (UNEXPECTED(prop_info)) {
ZVAL_COPY_VALUE(&tmp, value);
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, property_uses_strict_types()))) {
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, EG(current_execute_data) && ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
Z_TRY_DELREF_P(value);
variable_ptr = &EG(error_zval);
goto exit;
@@ -849,7 +842,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
}
found:
zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, property_uses_strict_types());
zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EG(current_execute_data) && ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)));
goto exit;
}
if (Z_PROP_FLAG_P(variable_ptr) == IS_PROP_UNINIT) {
@@ -905,7 +898,7 @@ write_std_property:
if (UNEXPECTED(prop_info)) {
ZVAL_COPY_VALUE(&tmp, value);
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, property_uses_strict_types()))) {
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
zval_ptr_dtor(value);
goto exit;
}
@@ -1058,8 +1051,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
retval = OBJ_PROP(zobj, property_offset);
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
if (EXPECTED(!zobj->ce->__get) ||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET) ||
UNEXPECTED(prop_info && Z_PROP_FLAG_P(retval) == IS_PROP_UNINIT)) {
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
if (UNEXPECTED(prop_info)) {
zend_throw_error(NULL,
+1 -4
View File
@@ -934,7 +934,7 @@ ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op) /* {{{ */
static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zval *op1, zval *op2) /* {{{ */
{
if (result == op1 && Z_ARR_P(op1) == Z_ARR_P(op2)) {
if ((result == op1) && (result == op2)) {
/* $a += $a */
return;
}
@@ -1871,9 +1871,6 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
}
} else if (UNEXPECTED(Z_STRLEN_P(op2) == 0)) {
if (EXPECTED(result != op1)) {
if (result == orig_op1) {
i_zval_ptr_dtor(result);
}
ZVAL_COPY(result, op1);
}
} else {
+1 -2
View File
@@ -62,8 +62,7 @@ ZEND_API zend_signal_globals_t zend_signal_globals;
static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context);
static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*));
#if defined(__CYGWIN__) || defined(__PASE__)
/* Matches zend_excute_API.c; these platforms don't support ITIMER_PROF. */
#ifdef __CYGWIN__
#define TIMEOUT_SIG SIGALRM
#else
#define TIMEOUT_SIG SIGPROF
+8 -12
View File
@@ -186,13 +186,12 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -207,13 +206,12 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -228,13 +226,12 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -248,13 +245,12 @@ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s,
ZSTR_LEN(ret) = (n * m) + l;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_safe_alloc(n, m, l, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
+1 -4
View File
@@ -498,7 +498,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
HANDLE hFind = INVALID_HANDLE_VALUE;
ALLOCA_FLAG(use_heap_large)
wchar_t *pathw = NULL;
int may_retry_reparse_point;
#define FREE_PATHW() \
do { free(pathw); } while(0);
@@ -598,7 +597,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
#ifdef ZEND_WIN32
retry_reparse_point:
may_retry_reparse_point = 0;
if (save) {
pathw = php_win32_ioutil_any_to_w(path);
if (!pathw) {
@@ -693,7 +691,6 @@ retry_reparse_tag_cloud:
CloseHandle(hLink);
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
may_retry_reparse_point = 1;
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
isabsolute = pbuffer->SymbolicLinkReparseBuffer.Flags == 0;
#if VIRTUAL_CWD_DEBUG
@@ -830,7 +827,7 @@ retry_reparse_tag_cloud:
free_alloca(pbuffer, use_heap_large);
free(substitutename);
if (may_retry_reparse_point) {
{
DWORD attrs;
FREE_PATHW()
+9 -42
View File
@@ -5128,7 +5128,6 @@ ZEND_VM_C_LABEL(send_array):
arg_num = 1;
param = ZEND_CALL_ARG(EX(call), 1);
ZEND_HASH_FOREACH_VAL(ht, arg) {
zend_bool must_wrap = 0;
if (skip > 0) {
skip--;
continue;
@@ -5140,7 +5139,6 @@ ZEND_VM_C_LABEL(send_array):
/* By-value send is not allowed -- emit a warning,
* but still perform the call. */
zend_param_must_be_ref(EX(call)->func, arg_num);
must_wrap = 1;
}
}
} else {
@@ -5150,12 +5148,7 @@ ZEND_VM_C_LABEL(send_array):
arg = Z_REFVAL_P(arg);
}
}
if (EXPECTED(!must_wrap)) {
ZVAL_COPY(param, arg);
} else {
Z_TRY_ADDREF_P(arg);
ZVAL_NEW_REF(param, arg);
}
ZVAL_COPY(param, arg);
ZEND_CALL_NUM_ARGS(EX(call))++;
arg_num++;
param++;
@@ -5167,14 +5160,12 @@ ZEND_VM_C_LABEL(send_array):
arg_num = 1;
param = ZEND_CALL_ARG(EX(call), 1);
ZEND_HASH_FOREACH_VAL(ht, arg) {
zend_bool must_wrap = 0;
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
/* By-value send is not allowed -- emit a warning,
* but still perform the call. */
zend_param_must_be_ref(EX(call)->func, arg_num);
must_wrap = 1;
}
}
} else {
@@ -5184,12 +5175,7 @@ ZEND_VM_C_LABEL(send_array):
arg = Z_REFVAL_P(arg);
}
}
if (EXPECTED(!must_wrap)) {
ZVAL_COPY(param, arg);
} else {
Z_TRY_ADDREF_P(arg);
ZVAL_NEW_REF(param, arg);
}
ZVAL_COPY(param, arg);
ZEND_CALL_NUM_ARGS(EX(call))++;
arg_num++;
param++;
@@ -5310,7 +5296,6 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
@@ -6317,7 +6302,11 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_NEXT_OPCODE();
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (OP1_TYPE != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (Z_OBJ_P(array_ptr)->properties
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
@@ -6325,21 +6314,8 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
properties = Z_OBJPROP_P(array_ptr);
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (OP1_TYPE != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(result) = (uint32_t) -1;
FREE_OP1_IF_VAR();
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -6406,7 +6382,6 @@ ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_NEXT_OPCODE();
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
if (array_ptr == array_ref) {
ZVAL_NEW_REF(array_ref, array_ref);
@@ -6425,15 +6400,8 @@ ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
properties = Z_OBJPROP_P(array_ptr);
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
FREE_OP1_VAR_PTR();
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
FREE_OP1_VAR_PTR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -7924,7 +7892,6 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
FREE_OP1();
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
+30 -123
View File
@@ -2072,7 +2072,6 @@ send_array:
arg_num = 1;
param = ZEND_CALL_ARG(EX(call), 1);
ZEND_HASH_FOREACH_VAL(ht, arg) {
zend_bool must_wrap = 0;
if (skip > 0) {
skip--;
continue;
@@ -2084,7 +2083,6 @@ send_array:
/* By-value send is not allowed -- emit a warning,
* but still perform the call. */
zend_param_must_be_ref(EX(call)->func, arg_num);
must_wrap = 1;
}
}
} else {
@@ -2094,12 +2092,7 @@ send_array:
arg = Z_REFVAL_P(arg);
}
}
if (EXPECTED(!must_wrap)) {
ZVAL_COPY(param, arg);
} else {
Z_TRY_ADDREF_P(arg);
ZVAL_NEW_REF(param, arg);
}
ZVAL_COPY(param, arg);
ZEND_CALL_NUM_ARGS(EX(call))++;
arg_num++;
param++;
@@ -2111,14 +2104,12 @@ send_array:
arg_num = 1;
param = ZEND_CALL_ARG(EX(call), 1);
ZEND_HASH_FOREACH_VAL(ht, arg) {
zend_bool must_wrap = 0;
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
/* By-value send is not allowed -- emit a warning,
* but still perform the call. */
zend_param_must_be_ref(EX(call)->func, arg_num);
must_wrap = 1;
}
}
} else {
@@ -2128,12 +2119,7 @@ send_array:
arg = Z_REFVAL_P(arg);
}
}
if (EXPECTED(!must_wrap)) {
ZVAL_COPY(param, arg);
} else {
Z_TRY_ADDREF_P(arg);
ZVAL_NEW_REF(param, arg);
}
ZVAL_COPY(param, arg);
ZEND_CALL_NUM_ARGS(EX(call))++;
arg_num++;
param++;
@@ -3192,7 +3178,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
@@ -4140,7 +4125,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
ZEND_VM_NEXT_OPCODE();
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_CONST != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (Z_OBJ_P(array_ptr)->properties
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
@@ -4148,21 +4137,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_CONST != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(result) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -4228,7 +4203,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
ZEND_VM_NEXT_OPCODE();
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
if (array_ptr == array_ref) {
ZVAL_NEW_REF(array_ref, array_ref);
@@ -4247,15 +4221,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -4503,7 +4469,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -18211,7 +18176,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
ZEND_VM_NEXT_OPCODE();
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_TMP_VAR != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (Z_OBJ_P(array_ptr)->properties
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
@@ -18219,21 +18188,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_TMP_VAR != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(result) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -18300,7 +18255,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
ZEND_VM_NEXT_OPCODE();
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
if (array_ptr == array_ref) {
ZVAL_NEW_REF(array_ref, array_ref);
@@ -18319,15 +18273,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -18579,7 +18525,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
zval_ptr_dtor_nogc(free_op1);
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -21320,7 +21265,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_VAR != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (Z_OBJ_P(array_ptr)->properties
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
@@ -21328,21 +21277,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
properties = Z_OBJPROP_P(array_ptr);
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_VAR != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(result) = (uint32_t) -1;
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -21409,7 +21345,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
if (array_ptr == array_ref) {
ZVAL_NEW_REF(array_ref, array_ref);
@@ -21428,15 +21363,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
properties = Z_OBJPROP_P(array_ptr);
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -22012,7 +21940,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
zval_ptr_dtor_nogc(free_op1);
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -37847,7 +37774,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
ZEND_VM_NEXT_OPCODE();
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_CV != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (Z_OBJ_P(array_ptr)->properties
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
@@ -37855,21 +37786,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
if (IS_CV != IS_TMP_VAR) {
Z_ADDREF_P(array_ptr);
}
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(result) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -37935,7 +37852,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
ZEND_VM_NEXT_OPCODE();
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
HashTable *properties;
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
if (array_ptr == array_ref) {
ZVAL_NEW_REF(array_ref, array_ref);
@@ -37954,15 +37870,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
}
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
}
properties = Z_OBJPROP_P(array_ptr);
if (zend_hash_num_elements(properties) == 0) {
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -38201,7 +38109,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
+3 -10
View File
@@ -11,19 +11,12 @@ trigger:
- UPGRADING
- UPGRADING.INTERNALS
schedules:
- cron: "0 1 * * *"
displayName: Nightly build
branches:
include:
- PHP-7.4
- master
jobs:
# We specify --with-mm here, because it cannot be used together with --enable-maintainer-zts.
- template: azure/job.yml
parameters:
configurationName: DEBUG_NTS
configurationParameters: '--enable-debug --disable-maintainer-zts'
configurationParameters: '--enable-debug --disable-maintainer-zts --with-mm'
- template: azure/job.yml
parameters:
configurationName: RELEASE_ZTS
@@ -44,7 +37,7 @@ jobs:
- template: azure/job.yml
parameters:
configurationName: RELEASE_NTS
configurationParameters: '--disable-debug --disable-maintainer-zts'
configurationParameters: '--disable-debug --disable-maintainer-zts --with-mm'
- template: azure/i386/job.yml
parameters:
configurationName: I386_DEBUG_NTS
+1 -10
View File
@@ -59,7 +59,7 @@ jobs:
php vendor/bin/phpunit
displayName: 'Test Laravel'
- script: |
git clone https://github.com/symfony/symfony.git --depth=1
git clone https://github.com/symfony/symfony.git --branch=master --depth=1
cd symfony
php7.3 /usr/bin/composer install --no-progress
php7.3 ./phpunit install
@@ -81,12 +81,3 @@ jobs:
php vendor/bin/phpunit
displayName: 'Test Amphp'
condition: or(succeeded(), failed())
- script: |
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
cd symfony_demo
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
displayName: 'Symfony Preloading'
condition: or(succeeded(), failed())
+1 -4
View File
@@ -32,13 +32,10 @@ jobs:
runTestsParameters: >-
${{ parameters.runTestsParameters }}
-d zend_extension=opcache.so
- script: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload ${{ parameters.configurationName }} Test Coverage to Codecov.io'
condition: or(succeeded(), failed())
- script: |
make gcovr-xml
mv gcovr.xml coverage.xml
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage Cobertura XML Report'
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage'
condition: or(succeeded(), failed())
- task: PublishCodeCoverageResults@1
inputs:
+1 -3
View File
@@ -7,10 +7,8 @@ steps:
sudo apt-get update -y | true
sudo apt-get install -y gcc-multilib
sudo apt-get install -y g++-multilib
sudo apt-get purge -y libxml2
sudo apt-get purge -y libxml2 libsqlite3-0
# TODO: Reenable postgresql + postgresql-contrib packages once they work again.
sudo apt-get purge -y libpq5
sudo apt-get install -y libc6:i386
sudo apt-get install -y bison \
re2c \
locales \
+13 -3
View File
@@ -2,11 +2,12 @@ parameters:
packages: ''
steps:
- script: brew update
displayName: 'Update Homebrew'
- script: |
brew install pkg-config \
autoconf \
bison \
re2c
bison
displayName: 'Install Build Tools'
- script: |
brew install openssl@1.1 \
@@ -23,11 +24,20 @@ steps:
zlib \
t1lib \
gd \
libzip \
gmp \
tidyp \
libxml2 \
libxslt \
postgresql
# Make sure we don't get broken libzip 1.7.0
brew upgrade libzip
brew link icu4c gettext --force
displayName: 'Install Build Dependencies'
- script: |
wget https://github.com/skvadrik/re2c/releases/download/2.0.1/re2c-2.0.1.tar.xz
tar -xf re2c-2.0.1.tar.xz
cd re2c-2.0.1
./configure
make -j$(sysctl -n hw.ncpu)
make install
displayName: 'Build re2c'
+8 -4
View File
@@ -340,7 +340,7 @@ AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
*)
10.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
@@ -978,6 +978,10 @@ else
# endif
#endif
#ifdef __cplusplus
extern "C" void exit (int);
#endif
void fnord() { int i=42;}
int main ()
{
@@ -993,7 +997,7 @@ int main ()
else
puts (dlerror ());
return (status);
exit (status);
}]
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
@@ -1521,7 +1525,7 @@ darwin* | rhapsody*)
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
ifelse([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
@@ -5799,7 +5803,7 @@ _LT_EOF
10.[[012]])
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
;;
*)
10.*)
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
;;
esac
+14 -22
View File
@@ -498,7 +498,7 @@ dnl Internal, don't use.
dnl
AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
case $1 in
c|c_r[)] ;;
c|c_r|pthread*[)] ;;
*[)] ifelse($3,,[
_PHP_X_ADD_LIBRARY($1,$2,$5)
],[
@@ -1176,14 +1176,14 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
#include <unistd.h>
#include <errno.h>
$1
int main() {
main() {
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
if (fd < 0) return 1;
if (pwrite(fd, "text", 4, 0) != 4) return 1;
if (fd < 0) exit(1);
if (pwrite(fd, "text", 4, 0) != 4) exit(1);
/* Linux glibc breakage until 2.2.5 */
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1;
return 0;
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
exit(0);
}
]])],[
@@ -1209,14 +1209,14 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
#include <unistd.h>
#include <errno.h>
$1
int main() {
main() {
char buf[3];
int fd = open("conftest_in", O_RDONLY);
if (fd < 0) return 1;
if (pread(fd, buf, 2, 0) != 2) return 1;
if (fd < 0) exit(1);
if (pread(fd, buf, 2, 0) != 2) exit(1);
/* Linux glibc breakage until 2.2.5 */
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1;
return 0;
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
exit(0);
}
]])],[
ac_cv_pread=yes
@@ -1478,13 +1478,13 @@ int seeker(void *cookie, off64_t *position, int whence)
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
int main() {
main() {
struct cookiedata g = { 0 };
FILE *fp = fopencookie(&g, "r", funcs);
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
return 0;
return 1;
exit(0);
exit(1);
}
]])], [
@@ -1783,9 +1783,6 @@ AC_DEFUN([PHP_PROG_BISON], [
AC_MSG_CHECKING([for bison version])
php_bison_version=$($YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | tr -d a-z)
if test -z "$php_bison_version"; then
php_bison_version=0.0.0
fi
ac_IFS=$IFS; IFS="."
set $php_bison_version
IFS=$ac_IFS
@@ -1849,9 +1846,6 @@ AC_DEFUN([PHP_PROG_RE2C],[
AC_MSG_CHECKING([for re2c version])
php_re2c_version=$($RE2C --version | cut -d ' ' -f 2 2>/dev/null)
if test -z "$php_re2c_version"; then
php_re2c_version=0.0.0
fi
ac_IFS=$IFS; IFS="."
set $php_re2c_version
IFS=$ac_IFS
@@ -1913,8 +1907,6 @@ AC_DEFUN([PHP_SETUP_ICU],[
if test "$PKG_CONFIG icu-io --atleast-version=60"; then
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
fi
ICU_CFLAGS="$ICU_CFLAGS -DU_DEFINE_FALSE_AND_TRUE=1"
])
dnl
+6 -7
View File
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
AC_INIT([PHP],[7.4.14],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[7.4.10RC1],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -662,7 +662,6 @@ dnl getaddrinfo.
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#ifndef AF_INET
@@ -675,11 +674,11 @@ int main(void) {
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
return 1;
exit(1);
}
if (ai == 0) {
return 1;
exit(1);
}
pai = ai;
@@ -687,16 +686,16 @@ int main(void) {
while (pai) {
if (pai->ai_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
return 1;
exit(1);
}
if (pai->ai_addr->sa_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
return 1;
exit(1);
}
pai = pai->ai_next;
}
freeaddrinfo(ai);
return 0;
exit(0);
}
]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [ac_cv_func_getaddrinfo=no])],
[ac_cv_func_getaddrinfo=no])])
+2 -2
View File
@@ -83,12 +83,12 @@ bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
bool(false)
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
bool(false)
+5 -10
View File
@@ -23,25 +23,20 @@
#include "sdncal.h"
#include <time.h>
#define SECS_PER_DAY (24 * 3600)
/* {{{ proto int unixtojd([int timestamp])
Convert UNIX timestamp to Julian Day */
PHP_FUNCTION(unixtojd)
{
time_t ts = 0;
zend_long tl = 0;
struct tm *ta, tmbuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &tl) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
return;
}
if (!tl) {
if (!ts) {
ts = time(NULL);
} else if (tl >= 0) {
ts = (time_t) tl;
} else {
} else if (ts < 0) {
RETURN_FALSE;
}
@@ -64,10 +59,10 @@ PHP_FUNCTION(jdtounix)
}
uday -= 2440588 /* J.D. of 1.1.1970 */;
if (uday < 0 || uday > ZEND_LONG_MAX / SECS_PER_DAY) { /* before beginning of unix epoch or greater than representable */
if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */
RETURN_FALSE;
}
RETURN_LONG(uday * SECS_PER_DAY);
RETURN_LONG(uday * 24 * 3600);
}
/* }}} */
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #80185 (jdtounix() fails after 2037)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
if (PHP_INT_SIZE != 8) die("skip for 64bit platforms only");
?>
--FILE--
<?php
var_dump(jdtounix(2465712));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
?>
--EXPECT--
int(2170713600)
int(9223372036854720000)
bool(false)
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #80185 (jdtounix() fails after 2037)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
if (PHP_INT_SIZE != 4) die("skip for 32bit platforms only");
?>
--FILE--
<?php
var_dump(jdtounix(2465712));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
?>
--EXPECT--
bool(false)
int(2147472000)
bool(false)
+8 -19
View File
@@ -61,7 +61,7 @@ PHP_FUNCTION(com_create_instance)
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS(), "sa/|ls",
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
@@ -85,9 +85,7 @@ PHP_FUNCTION(com_create_instance)
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
"Server", sizeof("Server")-1))) {
if (!try_convert_to_string(tmp)) {
return;
}
convert_to_string_ex(tmp);
server_name = Z_STRVAL_P(tmp);
server_name_len = Z_STRLEN_P(tmp);
ctx = CLSCTX_REMOTE_SERVER;
@@ -95,27 +93,21 @@ PHP_FUNCTION(com_create_instance)
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
"Username", sizeof("Username")-1))) {
if (!try_convert_to_string(tmp)) {
return;
}
convert_to_string_ex(tmp);
user_name = Z_STRVAL_P(tmp);
user_name_len = Z_STRLEN_P(tmp);
}
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
"Password", sizeof("Password")-1))) {
if (!try_convert_to_string(tmp)) {
return;
}
convert_to_string_ex(tmp);
password = Z_STRVAL_P(tmp);
password_len = Z_STRLEN_P(tmp);
}
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
"Domain", sizeof("Domain")-1))) {
if (!try_convert_to_string(tmp)) {
return;
}
convert_to_string_ex(tmp);
domain_name = Z_STRVAL_P(tmp);
domain_name_len = Z_STRLEN_P(tmp);
}
@@ -229,6 +221,7 @@ PHP_FUNCTION(com_create_instance)
if (server_name) {
if (info.pwszName) efree(info.pwszName);
if (authid.User) efree(authid.User);
}
efree(moniker);
@@ -447,9 +440,8 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
if (obj->typeinfo) {
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
if (FAILED(hr)) {
HRESULT hr1 = hr;
hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
if (SUCCEEDED(hr) && hr1 != E_NOTIMPL) {
if (SUCCEEDED(hr)) {
/* fall back on IDispatch direct */
ITypeInfo_Release(obj->typeinfo);
obj->typeinfo = NULL;
@@ -596,7 +588,6 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
}
}
efree(vargs);
if (byref_vals) efree(byref_vals);
}
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
@@ -728,9 +719,7 @@ PHP_FUNCTION(com_event_sink)
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(sink), 1)) != NULL && Z_TYPE_P(tmp) == IS_STRING)
dispname = Z_STRVAL_P(tmp);
} else if (sink != NULL) {
if (!try_convert_to_string(sink)) {
return;
}
convert_to_string(sink);
dispname = Z_STRVAL_P(sink);
}
+4 -11
View File
@@ -38,12 +38,10 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
obj = CDNO_FETCH(object);
if (V_VT(&obj->v) == VT_DISPATCH) {
if (!try_convert_to_string(member)) {
return rv;
}
VariantInit(&v);
convert_to_string_ex(member);
res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1);
@@ -68,12 +66,9 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
obj = CDNO_FETCH(object);
if (V_VT(&obj->v) == VT_DISPATCH) {
if (!try_convert_to_string(member)) {
return value;
}
VariantInit(&v);
convert_to_string_ex(member);
if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) {
VariantClear(&v);
@@ -210,9 +205,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
obj = CDNO_FETCH(object);
if (V_VT(&obj->v) == VT_DISPATCH) {
if (!try_convert_to_string(member)) {
return 0;
}
convert_to_string_ex(member);
if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid))) {
/* TODO: distinguish between property and method! */
return 1;
+4 -12
View File
@@ -108,18 +108,13 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
}
ZVAL_COPY_VALUE(&args[i-1], offset);
if (!try_convert_to_string(&proxy->indices[0])) {
efree(args);
return rv;
}
convert_to_string(&proxy->indices[0]);
VariantInit(&v);
res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
proxy->dimensions, args, 0);
efree(args);
if (res == SUCCESS) {
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
VariantClear(&v);
@@ -226,10 +221,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
ZVAL_COPY_VALUE(&args[i-1], offset);
ZVAL_COPY_VALUE(&args[i], value);
if (!try_convert_to_string(&proxy->indices[0])) {
efree(args);
return;
}
convert_to_string(&proxy->indices[0]);
VariantInit(&v);
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
@@ -398,7 +390,7 @@ static zend_object* saproxy_clone(zval *object)
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
Z_ADDREF_P(cloneproxy->zobj);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
clone_indices(cloneproxy, proxy, proxy->dimensions);
return &cloneproxy->std;
@@ -448,7 +440,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
}
Z_ADDREF_P(proxy->zobj);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
if (rel) {
clone_indices(proxy, rel, rel->dimensions);
+19 -23
View File
@@ -311,20 +311,18 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
if (obj) {
if (dispname == NULL && sink) {
if (V_VT(&obj->v) == VT_DISPATCH) {
IProvideClassInfo2 *pci2;
IProvideClassInfo *pci;
IProvideClassInfo2 *pci2;
IProvideClassInfo *pci;
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
IProvideClassInfo2_Release(pci2);
}
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
/* examine the available interfaces */
/* TODO: write some code here */
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
IProvideClassInfo_Release(pci);
}
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
IProvideClassInfo2_Release(pci2);
}
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
/* examine the available interfaces */
/* TODO: write some code here */
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
IProvideClassInfo_Release(pci);
}
} else if (dispname == NULL) {
if (obj->typeinfo) {
@@ -341,17 +339,15 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(obj->typeinfo, &typelib, &idx);
} else if (typelibname == NULL) {
if (V_VT(&obj->v) == VT_DISPATCH) {
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
if (dispname) {
unsigned int idx;
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
if (dispname) {
unsigned int idx;
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
if (typelib) {
ITypeInfo_Release(typeinfo);
typeinfo = NULL;
}
if (typelib) {
ITypeInfo_Release(typeinfo);
typeinfo = NULL;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #62474 (com_event_sink crashes on certain arguments)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
var_dump(com_event_sink(new variant, function() {}, array()));
var_dump(com_event_sink(new variant, new variant, 'a'));
?>
--EXPECT--
bool(false)
bool(false)
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #64130 (COM obj parameters passed by reference are not updated)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
if (PHP_INT_SIZE != 4) die('skip for 32bit platforms only');
try {
$ie = new com('InternetExplorer.Application');
} catch (com_exception $ex) {
die("skip {$ex->getMessage()}");
}
$ie->quit();
?>
--FILE--
<?php
$ie = new com('InternetExplorer.Application');
$x = 0;
$y = 0;
try {
$ie->clientToWindow($x, $y);
} catch (com_exception $ex) {}
var_dump($x > 0, $y > 0);
$ie->quit();
?>
--EXPECT--
bool(true)
bool(true)
+4 -4
View File
@@ -7,7 +7,7 @@ TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--FILE--
<?php
$url = substr(uniqid(),0,7)."://www.".uniqid().".".uniqid();
$url = uniqid()."://www.".uniqid().".".uniqid();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@@ -18,6 +18,6 @@ curl_close($ch);
?>
--EXPECTF--
string(%d) "%Srotocol%s"
int(1)
--EXPECTREGEX--
string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)"
int\(\d\)
-1
View File
@@ -1,7 +1,6 @@
// vim:ft=javascript
EXTENSION("date", "php_date.c", false, "/Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_TIMELIB_CONFIG_H=1");
PHP_DATE = "yes";
ADD_SOURCES("ext/date/lib", "astro.c timelib.c dow.c parse_date.c parse_tz.c tm2unixtime.c unixtime2tm.c parse_iso_intervals.c interval.c", "date");
ADD_FLAG('CFLAGS_DATE', "/wd4244");
+22819 -20030
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1001,7 +1001,7 @@ reltextnumber = 'first'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eig
reltexttext = 'next'|'last'|'previous'|'this';
reltextunit = 'ms' | 'µs' | (('msec'|'millisecond'|'µsec'|'microsecond'|'usec'|'sec'|'second'|'min'|'minute'|'hour'|'day'|'fortnight'|'forthnight'|'month'|'year') 's'?) | 'weeks' | daytext;
relnumber = ([+-]*[ \t]*[0-9]{1,13});
relnumber = ([+-]*[ \t]*[0-9]+);
relative = relnumber space? (reltextunit | 'week' );
relativetext = (reltextnumber|reltexttext) space reltextunit;
relativetextweek = reltexttext space 'week';
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -322,9 +322,9 @@ typedef struct _timelib_tzdb {
# define timelib_free free
#endif
#define TIMELIB_VERSION 201804
#define TIMELIB_EXTENDED_VERSION 20180401
#define TIMELIB_ASCII_VERSION "2018.04"
#define TIMELIB_VERSION 201803
#define TIMELIB_EXTENDED_VERSION 20180301
#define TIMELIB_ASCII_VERSION "2018.03"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
+923 -795
View File
File diff suppressed because it is too large. Load diff
-8
View File
@@ -367,14 +367,6 @@ static timelib_sll do_years(timelib_sll year)
timelib_sll eras;
eras = (year - 1970) / 40000;
/* Hack to make sure we don't overflow. Right now, we can't easily thrown a
* warning in this case, so we'll just return some rubbish. Sucks, but at
* least it doesn't show UBSAN warnings anymore */
if (eras < -1000000 || eras > 1000000) {
return eras > 0 ? LLONG_MAX/10 : LLONG_MIN/10;
}
if (eras != 0) {
year = year - (eras * 40000);
res += (SECS_PER_ERA * eras * 100);
+1 -4
View File
@@ -2390,10 +2390,7 @@ static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */
o1 = Z_PHPTIMEZONE_P(tz1);
o2 = Z_PHPTIMEZONE_P(tz2);
if (!o1->initialized || !o2->initialized) {
php_error_docref(NULL, E_WARNING, "Trying to compare uninitialized DateTimeZone objects");
return 1;
}
ZEND_ASSERT(o1->initialized && o2->initialized);
if (o1->type != o2->type) {
php_error_docref(NULL, E_WARNING, "Trying to compare different kinds of DateTimeZone objects");
@@ -29,17 +29,6 @@ function compare_timezones($timezone1, $timezone2)
var_dump($tz1 > $tz2);
}
// Test comparison of uninitialized DateTimeZone objects.
class MyDateTimeZone extends DateTimeZone {
function __construct() {
// parent ctor not called
}
}
$tz1 = new MyDateTimeZone();
$tz2 = new MyDateTimeZone();
var_dump($tz1 == $tz2);
?>
--EXPECTF--
compare +0200 with +0200
@@ -69,6 +58,3 @@ compare Europe/Amsterdam with Europe/Berlin
Warning: main(): Trying to compare different kinds of DateTimeZone objects in %s on line %d
bool(false)
Warning: main(): Trying to compare uninitialized DateTimeZone objects in %s on line %d
bool(false)
+3 -3
View File
@@ -6,12 +6,12 @@ Handling of large year values
<?php
date_default_timezone_set("America/Toronto");
$t = mktime(0,0,0,1,1,2922770265);
$t = mktime(0,0,0,1,1,292277026596);
var_dump(date("r", $t));
echo "OK\n";
?>
--EXPECTF--
string(%d) "%s, 01 Jan 2922770265 00:00:00 -0500"
--EXPECT--
string(39) "Fri, 01 Jan 292277026596 00:00:00 -0500"
OK
+7 -7
View File
@@ -4,7 +4,7 @@ Bug #48097 (date_timezone_set function produces wrong datetime result)
date.timezone=UTC
--FILE--
<?php
$d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
$d = date_create( "Mon, 23 May 1955 00:00:00 +0200" );
var_dump( $d );
echo $d->format( DATE_ISO8601 ), "\n";
echo $d->format( 'U' ), "\n\n";
@@ -16,23 +16,23 @@ echo $d->format( 'U' ), "\n\n";
--EXPECT--
object(DateTime)#1 (3) {
["date"]=>
string(26) "1955-05-22 02:00:00.000000"
string(26) "1955-05-23 00:00:00.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+02:00"
}
1955-05-22T02:00:00+0200
-461203200
1955-05-23T00:00:00+0200
-461124000
object(DateTime)#1 (3) {
["date"]=>
string(26) "1955-05-22 01:00:00.000000"
string(26) "1955-05-22 23:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(15) "Europe/Budapest"
}
1955-05-22T01:00:00+0100
1955-05-22T23:00:00+0100
-461203200
-461124000
+1
View File
@@ -2050,6 +2050,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
ctxt = htmlCreateFileParserCtxt(source, NULL);
} else {
source_len = xmlStrlen((xmlChar *) source);
if (ZEND_SIZE_T_INT_OVFL(source_len)) {
php_error_docref(NULL, E_WARNING, "Input string is too long");
RETURN_FALSE;
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #80268 (loadHTML() truncates at NUL bytes)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$doc = new DOMDocument;
$doc->loadHTML("<p>foo\0bar</p>");
$html = $doc->saveHTML();
var_dump(strpos($html, '<p>foo</p>') !== false);
file_put_contents(__DIR__ . '/80268.html', "<p>foo\0bar</p>");
$doc = new DOMDocument;
$doc->loadHTMLFile(__DIR__ . '/80268.html');
$html = $doc->saveHTML();
var_dump(strpos($html, '<p>foo</p>') !== false);
?>
--CLEAN--
<?php
unlink(__DIR__ . '/80268.html');
?>
--EXPECT--
bool(true)
bool(true)
+16 -40
View File
@@ -64,8 +64,7 @@ typedef unsigned char uchar;
#define EFREE_IF(ptr) if (ptr) efree(ptr)
#define MAX_IFD_NESTING_LEVEL 10
#define MAX_IFD_TAGS 1000
#define MAX_IFD_NESTING_LEVEL 200
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
@@ -2023,7 +2022,6 @@ typedef struct {
int read_thumbnail;
int read_all;
int ifd_nesting_level;
int ifd_count;
int num_errors;
/* internal */
file_section_list file;
@@ -2714,7 +2712,6 @@ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
/* forward declarations */
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag);
static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table);
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index);
/* {{{ exif_get_markername
Get name of marker */
@@ -3286,7 +3283,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
/* {{{ exif_process_IFD_TAG
* Process one of the nested IFDs directories. */
static int exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
size_t length;
unsigned int tag, format, components;
@@ -3299,6 +3296,13 @@ static int exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entry
int dump_free;
#endif /* EXIF_DEBUG */
/* Protect against corrupt headers */
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
return FALSE;
}
ImageInfo->ifd_nesting_level++;
tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
@@ -3618,24 +3622,6 @@ static int exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entry
}
/* }}} */
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
int result;
/* Protect against corrupt headers */
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum IFD tag count reached");
return FALSE;
}
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
return FALSE;
}
ImageInfo->ifd_nesting_level++;
result = exif_process_IFD_TAG_impl(ImageInfo, dir_entry, offset_base, IFDlength, displacement, section_index, ReadNextIFD, tag_table);
ImageInfo->ifd_nesting_level--;
return result;
}
/* {{{ exif_process_IFD_in_JPEG
* Process one of the nested IFDs directories. */
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag)
@@ -4069,7 +4055,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
/* {{{ exif_process_IFD_in_TIFF
* Parse the TIFF header; */
static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_offset, int section_index)
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
{
int i, sn, num_entries, sub_section_index = 0;
unsigned char *dir_entry;
@@ -4077,6 +4063,10 @@ static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_
int entry_tag , entry_type;
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
#ifdef EXIF_DEBUG
@@ -4220,6 +4210,7 @@ static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s @x%04X", exif_get_sectionname(sub_section_index), entry_offset);
#endif
ImageInfo->ifd_nesting_level++;
exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index);
if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) {
if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
@@ -4263,6 +4254,7 @@ static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next_offset);
#endif
ImageInfo->ifd_nesting_level++;
exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
@@ -4299,21 +4291,6 @@ static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_
}
/* }}} */
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
{
int result;
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
return FALSE;
}
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
ImageInfo->ifd_nesting_level++;
result = exif_process_IFD_in_TIFF_impl(ImageInfo, dir_offset, section_index);
ImageInfo->ifd_nesting_level--;
return result;
}
/* {{{ exif_scan_FILE_header
* Parse the marker stream until SOS or EOI is seen; */
static int exif_scan_FILE_header(image_info_type *ImageInfo)
@@ -4469,7 +4446,6 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
ImageInfo->ifd_nesting_level = 0;
ImageInfo->ifd_count = 0;
ImageInfo->num_errors = 0;
/* Scan the headers */
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Should not cause OOM
--FILE--
<?php
var_dump(@exif_read_data(__DIR__ . '/nesting_level_oom.tiff'));
?>
--EXPECT--
bool(false)
Binary file not shown.
+9 -15
View File
@@ -886,10 +886,6 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
}
free_alloca(fci.params, use_heap);
if (EG(exception)) {
zend_error(E_ERROR, "Throwing from FFI callbacks is not allowed");
}
ret_type = ZEND_FFI_TYPE(callback_data->type->func.ret_type);
if (ret_type->kind != ZEND_FFI_TYPE_VOID) {
zend_ffi_zval_to_cdata(ret, ret_type, &retval);
@@ -7431,11 +7427,11 @@ void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len)
val->ch = '\t';
} else if (str[2] == 'v' && str_len == 4) {
val->ch = '\v';
} else if (str[2] >= '0' && str[2] <= '7') {
} else if (str[2] >= '0' || str[2] <= '7') {
n = str[2] - '0';
if (str[3] >= '0' && str[3] <= '7') {
if (str[3] >= '0' || str[3] <= '7') {
n = n * 8 + (str[3] - '0');
if ((str[4] >= '0' && str[4] <= '7') && str_len == 6) {
if ((str[4] >= '0' || str[4] <= '7') && str_len == 6) {
n = n * 8 + (str[4] - '0');
} else if (str_len != 5) {
val->kind = ZEND_FFI_VAL_ERROR;
@@ -7449,25 +7445,23 @@ void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len)
val->kind = ZEND_FFI_VAL_ERROR;
}
} else if (str[2] == 'x') {
if (str[3] >= '0' && str[3] <= '9') {
if (str[3] >= '0' || str[3] <= '7') {
n = str[3] - '0';
} else if (str[3] >= 'A' && str[3] <= 'F') {
} else if (str[3] >= 'A' || str[3] <= 'F') {
n = str[3] - 'A';
} else if (str[3] >= 'a' && str[3] <= 'f') {
} else if (str[3] >= 'a' || str[3] <= 'f') {
n = str[3] - 'a';
} else {
val->kind = ZEND_FFI_VAL_ERROR;
return;
}
if ((str[4] >= '0' && str[4] <= '9') && str_len == 6) {
if ((str[4] >= '0' || str[4] <= '7') && str_len == 6) {
n = n * 16 + (str[4] - '0');
} else if ((str[4] >= 'A' && str[4] <= 'F') && str_len == 6) {
} else if ((str[4] >= 'A' || str[4] <= 'F') && str_len == 6) {
n = n * 16 + (str[4] - 'A');
} else if ((str[4] >= 'a' && str[4] <= 'f') && str_len == 6) {
} else if ((str[4] >= 'a' || str[4] <= 'f') && str_len == 6) {
n = n * 16 + (str[4] - 'a');
} else if (str_len != 5) {
val->kind = ZEND_FFI_VAL_ERROR;
return;
}
val->ch = n;
} else if (str_len == 4) {
-42
View File
@@ -1,42 +0,0 @@
--TEST--
Bug #79177 (FFI doesn't handle well PHP exceptions within callback)
--SKIPIF--
<?php
if (!extension_loaded('ffi')) die('skip ffi extension not available');
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
?>
--FILE--
<?php
require_once __DIR__ . '/utils.inc';
$header = <<<HEADER
extern int *(*bug79177_cb)(void);
void bug79177(void);
HEADER;
if (PHP_OS_FAMILY !== 'Windows') {
$ffi = FFI::cdef($header);
} else {
try {
$ffi = FFI::cdef($header, 'php_zend_test.dll');
} catch (FFI\Exception $ex) {
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
}
}
$ffi->bug79177_cb = function() {
throw new \RuntimeException('Not allowed');
};
try {
$ffi->bug79177(); // this is supposed to raise a fatal error
} catch (\Throwable $exception) {}
echo "done\n";
?>
--EXPECTF--
Warning: Uncaught RuntimeException: Not allowed in %s:%d
Stack trace:
#0 %s(%d): {closure}()
#1 %s(%d): FFI->bug79177()
#2 {main}
thrown in %s on line %d
Fatal error: Throwing from FFI callbacks is not allowed in %s on line %d
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #80186 (Segfault when iterating over FFI object)
--SKIPIF--
<?php
if (!extension_loaded('ffi')) die('skip ffi extension not available');
?>
--FILE--
<?php
$ffi = FFI::cdef('typedef int dummy;');
foreach ($ffi as $_) { }
foreach ($ffi as &$_) { }
?>
===DONE===
--EXPECT--
===DONE===
-1
View File
@@ -218,7 +218,6 @@ PHP_MINIT_FUNCTION(finfo)
memcpy(&finfo_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
finfo_object_handlers.offset = XtOffsetOf(finfo_object, zo);
finfo_object_handlers.free_obj = finfo_objects_free;
finfo_object_handlers.clone_obj = NULL;
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
+31 -38
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/apprentice.c 2020-11-19 11:50:32.412674100 +0100
+++ libmagic/apprentice.c 2020-02-27 11:45:38.445854000 +0100
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -974,7 +974,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/ascmagic.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/ascmagic.c 2020-02-26 23:18:22.605400700 +0100
@@ -96,7 +96,7 @@
rv = file_ascmagic_with_encoding(ms, &bb,
ubuf, ulen, code, type, text);
@@ -1005,7 +1005,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/buffer.c libmagic/buffer.c
--- libmagic.orig/buffer.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/buffer.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/buffer.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,19 +31,23 @@
#endif /* lint */
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/cdf.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/cdf.c 2020-02-27 11:45:38.445854000 +0100
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -1341,7 +1341,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
#endif
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h 2019-02-20 02:24:19.000000000 +0100
+++ libmagic/cdf.h 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/cdf.h 2020-02-27 11:45:38.445854000 +0100
@@ -35,10 +35,10 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1366,7 +1366,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
#define CDF_SECID_FREE -1
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/cdf_time.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/cdf_time.c 2020-02-26 23:18:22.611402900 +0100
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
@@ -1395,7 +1395,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/compress.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/compress.c 2020-02-27 11:45:38.445854000 +0100
@@ -45,13 +45,11 @@
#endif
#include <string.h>
@@ -1545,7 +1545,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
+#endif
diff -u libmagic.orig/der.c libmagic/der.c
--- libmagic.orig/der.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/der.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/der.c 2020-02-27 11:45:38.445854000 +0100
@@ -51,7 +51,9 @@
#include "magic.h"
#include "der.h"
@@ -1575,7 +1575,7 @@ diff -u libmagic.orig/der.c libmagic/der.c
snprintf(buf + z, blen - z, "%.2x", d[i]);
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
--- libmagic.orig/elfclass.h 2019-02-20 02:30:19.000000000 +0100
+++ libmagic/elfclass.h 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/elfclass.h 2020-02-26 23:18:22.613401700 +0100
@@ -41,7 +41,7 @@
return toomany(ms, "program headers", phnum);
flags |= FLAGS_IS_CORE;
@@ -1605,7 +1605,7 @@ diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
diff -u libmagic.orig/encoding.c libmagic/encoding.c
--- libmagic.orig/encoding.c 2019-04-15 18:48:41.000000000 +0200
+++ libmagic/encoding.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/encoding.c 2020-02-26 23:18:22.614402300 +0100
@@ -89,13 +89,13 @@
*code_mime = "binary";
@@ -1636,7 +1636,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
}
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/file.h 2020-11-23 17:11:36.234964700 +0100
+++ libmagic/file.h 2020-02-27 11:45:38.445854000 +0100
@@ -33,18 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1658,7 +1658,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#ifdef _WIN64
#define SIZE_T_FORMAT "I64"
#else
@@ -57,32 +48,49 @@
@@ -57,19 +48,34 @@
#define INT64_T_FORMAT "ll"
#define INTMAX_T_FORMAT "j"
#endif
@@ -1698,14 +1698,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#include <sys/param.h>
#endif
/* Do this here and now, because struct stat gets re-defined on solaris */
#include <sys/stat.h>
#include <stdarg.h>
+#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
+
#define ENABLE_CONDITIONALS
#ifndef MAGIC
@@ -82,7 +88,7 @@
#define MAGIC "/etc/magic"
#endif
@@ -1714,7 +1707,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#define PATHSEP ';'
#else
#define PATHSEP ':'
@@ -116,12 +124,6 @@
@@ -116,12 +122,6 @@
#endif
#endif
@@ -1727,7 +1720,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
@@ -150,10 +152,10 @@
@@ -150,10 +150,10 @@
struct buffer {
int fd;
@@ -1740,7 +1733,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
void *ebuf;
size_t elen;
};
@@ -243,7 +245,7 @@
@@ -243,7 +243,7 @@
#define FILE_DER 48
#define FILE_NAMES_SIZE 49 /* size of array to contain all names */
@@ -1749,7 +1742,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
((t) == FILE_STRING || \
(t) == FILE_PSTRING || \
(t) == FILE_BESTRING16 || \
@@ -447,28 +449,23 @@
@@ -447,28 +447,23 @@
/* Type for Unicode characters */
typedef unsigned long unichar;
@@ -1783,7 +1776,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected int file_zmagic(struct magic_set *, const struct buffer *,
const char *);
#endif
@@ -491,13 +488,9 @@
@@ -491,13 +486,9 @@
protected void file_badread(struct magic_set *);
protected void file_badseek(struct magic_set *);
protected void file_oomem(struct magic_set *, size_t);
@@ -1800,7 +1793,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected void file_showstr(FILE *, const char *, size_t);
protected size_t file_mbswidth(const char *);
protected const char *file_getbuffer(struct magic_set *);
@@ -513,34 +506,13 @@
@@ -513,34 +504,13 @@
size_t);
#endif /* __EMX__ */
@@ -1838,7 +1831,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
typedef struct {
char *buf;
@@ -550,28 +522,13 @@
@@ -550,28 +520,13 @@
protected file_pushbuf_t *file_push_buffer(struct magic_set *);
protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *);
@@ -1869,7 +1862,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
size_t strlcat(char *, const char *, size_t);
#endif
#ifndef HAVE_STRCASESTR
@@ -587,39 +544,6 @@
@@ -587,39 +542,6 @@
#ifndef HAVE_ASCTIME_R
char *asctime_r(const struct tm *, char *);
#endif
@@ -1909,7 +1902,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
#define QUICK
@@ -645,6 +569,18 @@
@@ -645,6 +567,18 @@
#else
#define FILE_RCSID(id)
#endif
@@ -1930,7 +1923,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2019-05-07 04:26:48.000000000 +0200
+++ libmagic/fsmagic.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/fsmagic.c 2020-02-26 23:18:22.616403500 +0100
@@ -66,26 +66,10 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -2223,7 +2216,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
case S_IFSOCK:
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/funcs.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/funcs.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,7 +31,6 @@
#endif /* lint */
@@ -2579,7 +2572,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/magic.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/magic.c 2020-02-26 23:18:22.621402800 +0100
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -3043,8 +3036,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public const char *
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h 2020-11-23 17:12:12.776465800 +0100
+++ libmagic/magic.h 2020-09-07 00:42:14.447562400 +0200
--- libmagic.orig/magic.h 2020-03-02 15:24:27.253951700 +0100
+++ libmagic/magic.h 2020-02-26 23:18:22.622402300 +0100
@@ -124,6 +124,7 @@
const char *magic_getpath(const char *, int);
@@ -3055,7 +3048,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/print.c 2020-09-07 00:42:14.447562400 +0200
+++ libmagic/print.c 2020-02-26 23:18:22.625401800 +0100
@@ -28,6 +28,7 @@
/*
* print.c - debugging printout routines
@@ -3129,7 +3122,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
goto out;
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/readcdf.c 2020-09-07 00:42:14.463191200 +0200
+++ libmagic/readcdf.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,7 +31,11 @@
#include <assert.h>
@@ -3248,7 +3241,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (i != -1)
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
+++ libmagic/softmagic.c 2020-09-07 00:42:14.463191200 +0200
+++ libmagic/softmagic.c 2020-03-02 15:23:10.176763300 +0100
@@ -43,6 +43,10 @@
#include <time.h>
#include "der.h"
@@ -3615,7 +3608,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c 2014-09-11 17:05:33.000000000 +0200
+++ libmagic/strcasestr.c 2020-08-05 15:01:55.644887300 +0200
+++ libmagic/strcasestr.c 2019-11-29 08:49:38.434136600 +0100
@@ -39,6 +39,8 @@
#include "file.h"
-2
View File
@@ -82,8 +82,6 @@
#include <sys/stat.h>
#include <stdarg.h>
#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
#define ENABLE_CONDITIONALS
#ifndef MAGIC
-50
View File
@@ -1,50 +0,0 @@
0 string 1
>1 regex \^[0-9:,\ ]*-->[0-9:,\ ]* SubRip File
!:mime text/x-srt
0 lelong 0xc3cbc6c5 RISC OS Chunk data
>12 string OBJ_ \b, AOF object
>12 string LIB_ \b, ALF library
0 name mach-o \b [
>0 use mach-o-cpu \b
>(8.L) indirect 8 \b:
>0 belong x \b]
0 belong 0xcafed00d JAR compressed with pack200,
>5 byte x version %d.
>4 byte x \b%d
!:mime application/x-java-pack200
# Objective-C
0 regex \^#import Objective-C source text
!:strength + 25
!:mime text/x-objective-c
0 string \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Source:
>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Graph:
>>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Data: GCOV coverage report
0 name certinfo
>0 der seq
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550406
>>>>&0 der prt_str=x \b, countryName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550408
>>>>&0 der utf8_str=x \b, stateOrProvinceName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=55040a
>>>>&0 der utf8_str=x \b, organizationName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550403
>>>>&0 der utf8_str=x \b, commonName=%s
>>&0 der seq
0 search/1 FONT ASCII vfont text
0 short 0436 Berkeley vfont data
0 short 017001 byte-swapped Berkeley vfont data
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #77961 (finfo_open crafted magic parsing SIGABRT)
--SKIPIF--
<?php
if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
?>
--FILE--
<?php
finfo_open(FILEINFO_NONE, __DIR__ . '/bug77961.magic');
?>
--EXPECTF--
Notice: finfo_open(): Warning: Expected numeric type got `indirect' in %s on line %d
Fatal error: fatal libmagic error in %s on line %d
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Cloning and serializing finfo is not supported
--FILE--
<?php
$finfo = new finfo;
var_dump($finfo->buffer("Test string"));
try {
$finfo2 = clone $finfo;
var_dump($finfo2->buffer("Test string"));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$finfo3 = unserialize(serialize($finfo));
var_dump($finfo3->buffer("Test string"));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
string(%d) "%s"
Trying to clone an uncloneable object of class finfo
Warning: finfo::buffer(): The invalid fileinfo object. in %s on line %d
bool(false)
+4 -8
View File
@@ -1463,8 +1463,6 @@ void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
int cx, cy;
int px, py;
int fline;
const int xuppper = (x > INT_MAX - f->w) ? INT_MAX : x + f->w;
const int yuppper = (y > INT_MAX - f->h) ? INT_MAX : y + f->h;
cx = 0;
cy = 0;
#ifdef CHARSET_EBCDIC
@@ -1474,8 +1472,8 @@ void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
return;
}
fline = (c - f->offset) * f->h * f->w;
for (py = y; py < yuppper; py++) {
for (px = x; px < xuppper; px++) {
for (py = y; (py < (y + f->h)); py++) {
for (px = x; (px < (x + f->w)); px++) {
if (f->data[fline + cy * f->w + cx]) {
gdImageSetPixel(im, px, py, color);
}
@@ -1491,8 +1489,6 @@ void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
int cx, cy;
int px, py;
int fline;
const int xuppper = (x > INT_MAX - f->h) ? INT_MAX : x + f->h;
const int ylower = (y < INT_MIN + f->w) ? INT_MIN : y - f->w;
cx = 0;
cy = 0;
#ifdef CHARSET_EBCDIC
@@ -1502,8 +1498,8 @@ void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
return;
}
fline = (c - f->offset) * f->h * f->w;
for (py = y; py > ylower; py--) {
for (px = x; px < xuppper; px++) {
for (py = y; py > (y - f->w); py--) {
for (px = x; px < (x + f->h); px++) {
if (f->data[fline + cy * f->w + cx]) {
gdImageSetPixel(im, px, py, color);
}
+2 -2
View File
@@ -1136,7 +1136,7 @@ ZEND_FUNCTION(gmp_export)
FETCH_GMP_ZVAL(gmpnumber, gmpnumber_arg, temp_a);
if (mpz_sgn(gmpnumber) == 0) {
RETVAL_EMPTY_STRING();
RETURN_EMPTY_STRING();
} else {
size_t bits_per_word = size * 8;
size_t count = (mpz_sizeinbase(gmpnumber, 2) + bits_per_word - 1) / bits_per_word;
@@ -1145,7 +1145,7 @@ ZEND_FUNCTION(gmp_export)
mpz_export(ZSTR_VAL(out_string), NULL, order, size, endian, 0, gmpnumber);
ZSTR_VAL(out_string)[ZSTR_LEN(out_string)] = '\0';
RETVAL_NEW_STR(out_string);
RETURN_NEW_STR(out_string);
}
FREE_GMP_TEMP(temp_a);
-4
View File
@@ -50,9 +50,6 @@ foreach ($export as $k => $test) {
var_dump($passed);
// Argument converted from int to GMP
var_dump(bin2hex(gmp_export(0xff)));
// Invalid arguments (zpp failure)
var_dump(gmp_export());
@@ -65,7 +62,6 @@ var_dump(gmp_export(123, 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
--EXPECTF--
bool(true)
string(2) "ff"
Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
NULL
+1 -1
View File
@@ -130,7 +130,7 @@ int main() {
int main() {
iconv_t cd;
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
cd = iconv_open( "*blahblah*", "*blahblah*" );
if (cd == (iconv_t)(-1)) {
if (errno == EINVAL) {
return 0;
+34 -76
View File
@@ -1257,9 +1257,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
#endif
ZEND_IGNORE_LEAKS_BEGIN();
imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags);
ZEND_IGNORE_LEAKS_END();
if (imap_stream == NIL) {
php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox));
@@ -1323,7 +1321,7 @@ PHP_FUNCTION(imap_reopen)
imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, ZSTR_VAL(mailbox), flags);
if (imap_le_struct->imap_stream == NIL) {
zend_list_close(Z_RES_P(streamind));
zend_list_delete(Z_RES_P(streamind));
php_error_docref(NULL, E_WARNING, "Couldn't re-open stream");
RETURN_FALSE;
}
@@ -2229,9 +2227,7 @@ PHP_FUNCTION(imap_lsub)
IMAPG(folderlist_style) = FLIST_ARRAY;
IMAPG(imap_sfolders) = NIL;
ZEND_IGNORE_LEAKS_BEGIN();
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
ZEND_IGNORE_LEAKS_END();
if (IMAPG(imap_sfolders) == NIL) {
RETURN_FALSE;
}
@@ -2270,9 +2266,7 @@ PHP_FUNCTION(imap_lsub_full)
IMAPG(folderlist_style) = FLIST_OBJECT;
IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL;
ZEND_IGNORE_LEAKS_BEGIN();
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
ZEND_IGNORE_LEAKS_END();
if (IMAPG(imap_sfolder_objects) == NIL) {
RETURN_FALSE;
}
@@ -2710,9 +2704,8 @@ PHP_FUNCTION(imap_rfc822_write_address)
if (string) {
RETVAL_STR(string);
} else {
RETVAL_FALSE;
RETURN_FALSE;
}
mail_free_address(&addr);
}
/* }}} */
@@ -3093,8 +3086,7 @@ static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
if (out == NIL) {
RETURN_FALSE;
} else {
RETVAL_STRING((char *)out);
fs_give((void**) &out);
RETURN_STRING((char *)out);
}
}
/* }}} */
@@ -3200,9 +3192,6 @@ PHP_FUNCTION(imap_sort)
} else {
spg = mail_newsearchpgm();
}
if (spg == NIL) {
RETURN_FALSE;
}
mypgm = mail_newsortpgm();
mypgm->reverse = rev;
@@ -3211,7 +3200,6 @@ PHP_FUNCTION(imap_sort)
slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL));
mail_free_sortpgm(&mypgm);
if (spg && !(flags & SE_FREE)) {
mail_free_searchpgm(&spg);
}
@@ -3567,7 +3555,7 @@ PHP_FUNCTION(imap_mail_compose)
int toppart = 0;
int first;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/a/", &envelope, &body) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &envelope, &body) == FAILURE) {
return;
}
@@ -3625,7 +3613,6 @@ PHP_FUNCTION(imap_mail_compose)
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "custom_headers", sizeof("custom_headers") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
custom_headers_param = tmp_param = NULL;
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
custom_headers_param = mail_newbody_parameter();
convert_to_string_ex(env_data);
@@ -3645,25 +3632,17 @@ PHP_FUNCTION(imap_mail_compose)
if (Z_TYPE_P(data) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
RETVAL_FALSE;
goto done;
RETURN_FALSE;
}
SEPARATE_ARRAY(data);
bod = mail_newbody();
topbod = bod;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
zend_long type = zval_get_long(pvalue);
if (type >= 0 && type <= TYPEMAX && body_types[type] != NULL) {
bod->type = (short) type;
}
bod->type = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
zend_long encoding = zval_get_long(pvalue);
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
bod->encoding = (short) encoding;
}
bod->encoding = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3676,9 +3655,7 @@ PHP_FUNCTION(imap_mail_compose)
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
if(Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
@@ -3710,9 +3687,7 @@ PHP_FUNCTION(imap_mail_compose)
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
@@ -3724,19 +3699,15 @@ PHP_FUNCTION(imap_mail_compose)
bod->disposition.parameter = disp_param;
}
}
if (bod->type == TYPEMESSAGE && bod->subtype && !strcmp(bod->subtype, "RFC822")) {
bod->nested.msg = mail_newmsg();
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
bod->size.lines = zval_get_long(pvalue);
@@ -3748,14 +3719,10 @@ PHP_FUNCTION(imap_mail_compose)
convert_to_string_ex(pvalue);
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
}
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
short type = 0;
SEPARATE_ARRAY(data);
} else if (Z_TYPE_P(data) == IS_ARRAY) {
short type = -1;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
zend_long tmp_type = zval_get_long(pvalue);
if (tmp_type >= 0 && tmp_type <= TYPEMAX && tmp_type != TYPEMULTIPART && body_types[tmp_type] != NULL) {
type = (short) tmp_type;
}
type = (short) zval_get_long(pvalue);
}
if (!toppart) {
@@ -3768,13 +3735,13 @@ PHP_FUNCTION(imap_mail_compose)
}
bod = &mypart->body;
bod->type = type;
if (type != TYPEMULTIPART) {
bod->type = type;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
zend_long encoding = zval_get_long(pvalue);
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
bod->encoding = (short) encoding;
}
bod->encoding = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3788,9 +3755,7 @@ PHP_FUNCTION(imap_mail_compose)
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
@@ -3822,9 +3787,7 @@ PHP_FUNCTION(imap_mail_compose)
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
@@ -3836,19 +3799,15 @@ PHP_FUNCTION(imap_mail_compose)
bod->disposition.parameter = disp_param;
}
}
if (bod->type == TYPEMESSAGE && bod->subtype && !strcmp(bod->subtype, "RFC822")) {
bod->nested.msg = mail_newmsg();
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
bod->size.lines = zval_get_long(pvalue);
@@ -3865,8 +3824,7 @@ PHP_FUNCTION(imap_mail_compose)
if (first) {
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
RETVAL_FALSE;
goto done;
RETURN_FALSE;
}
if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) {
@@ -3949,7 +3907,7 @@ PHP_FUNCTION(imap_mail_compose)
bod=&part->body;
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data ? (char *) bod->contents.text.data : "", CRLF);
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} while ((part = part->next)); /* until done */
@@ -3959,7 +3917,7 @@ PHP_FUNCTION(imap_mail_compose)
efree(mystring);
mystring=tempstring;
} else if (bod) {
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data ? (char *) bod->contents.text.data : "", CRLF);
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} else {
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #64076 (imap_sort() does not return FALSE on failure)
--SKIPIF--
<?php
require_once __DIR__ . '/skipif.inc';
?>
--FILE--
<?php
require_once __DIR__ . '/imap_include.inc';
$stream = setup_test_mailbox('', 2);
imap_errors(); // clear error stack
var_dump(imap_sort($stream, SORTFROM, 0, 0, 'UNSUPPORTED SEARCH CRITERIUM'));
var_dump(imap_errors() !== false);
?>
--CLEAN--
<?php
require_once __DIR__ . '/clean.inc';
?>
--EXPECT--
Create a temporary mailbox and add 2 msgs
.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created
bool(false)
bool(true)
+1 -1
View File
@@ -11,5 +11,5 @@ imap_mail('1', 1, NULL);
===DONE===
--EXPECTF--
Warning: imap_mail(): No message string in mail command in %s on line %d
%A
%s
===DONE===
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #80213 (imap_mail_compose() segfaults on certain $bodies)
--SKIPIF--
<?php
if (!extension_loaded('imap')) die('skip imap extension not available');
?>
--FILE--
<?php
$envelope = [];
$body = [[
'type.parameters' => ['param'],
'disposition' => ['disp'],
], [
'type.parameters' => ['param'],
'disposition' => ['disp'],
]];
imap_mail_compose($envelope, $body);
echo "done\n";
?>
--EXPECT--
done
-69
View File
@@ -1,69 +0,0 @@
--TEST--
Bug #80215 (imap_mail_compose() may modify by-val parameters)
--SKIPIF--
<?php
if (!extension_loaded('imap')) die('skip imap extension not available');
?>
--FILE--
<?php
$envelope = [
"from" => 1,
"to" => 2,
"custom_headers" => [3],
];
$body = [[
"contents.data" => 4,
"type.parameters" => ['foo' => 5],
"disposition" => ['bar' => 6],
], [
"contents.data" => 7,
"type.parameters" => ['foo' => 8],
"disposition" => ['bar' => 9],
]];
imap_mail_compose($envelope, $body);
var_dump($envelope, $body);
?>
--EXPECT--
array(3) {
["from"]=>
int(1)
["to"]=>
int(2)
["custom_headers"]=>
array(1) {
[0]=>
int(3)
}
}
array(2) {
[0]=>
array(3) {
["contents.data"]=>
int(4)
["type.parameters"]=>
array(1) {
["foo"]=>
int(5)
}
["disposition"]=>
array(1) {
["bar"]=>
int(6)
}
}
[1]=>
array(3) {
["contents.data"]=>
int(7)
["type.parameters"]=>
array(1) {
["foo"]=>
int(8)
}
["disposition"]=>
array(1) {
["bar"]=>
int(9)
}
}
}
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #80216 (imap_mail_compose() does not validate types/encodings)
--SKIPIF--
<?php
if (!extension_loaded('imap')) die('skip imap extension not available');
?>
--FILE--
<?php
imap_mail_compose([], [['type' => TYPEMULTIPART], []]);
imap_mail_compose([], [['type' => 12]]);
imap_mail_compose([], [['type' => TYPEMULTIPART], ['type' => 12]]);
imap_mail_compose([], [['encoding' => 8]]);
imap_mail_compose([], [['type' => TYPEMULTIPART], ['encoding' => 8]]);
echo "done\n";
?>
--EXPECT--
done
Loaded 100 of 722 files, more files were not shown because too many files have changed in this diff. Show more