mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'PHP-7.0' of https://github.com/php/php-src into PHP-7.0
This commit is contained in:
commit
98164714ea
4
.gitignore
vendored
4
.gitignore
vendored
@ -245,10 +245,6 @@ ext/reflection/spl.chm
|
||||
ext/simplexml/examples/security.new.xml
|
||||
ext/spl/examples/.htaccess
|
||||
ext/spl/examples/*.phps
|
||||
ext/sqlite/weztest.sqlite
|
||||
ext/sqlite/libsqlite/src/sqlite.h
|
||||
ext/sqlite/libsqlite/src/parse.out
|
||||
ext/sqlite/libsqlite/src/libsqlite.dsw
|
||||
ext/sqlite3/tests/phpsql*
|
||||
ext/sqlite3/tests/*.db
|
||||
ext/sqlite3/tests/*.tmp
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2015 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2016 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
153
NEWS
153
NEWS
@ -1,11 +1,88 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? Jan 2016 PHP 7.0.2
|
||||
?? ??? 2016 PHP 7.0.4
|
||||
|
||||
|
||||
|
||||
04 Feb 2016 PHP 7.0.3
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71336 (Wrong is_ref on properties as exposed via
|
||||
get_object_vars()). (Laruence)
|
||||
. Fixed bug #71248 (Wrong interface is enforced). (Dmitry)
|
||||
. Fixed bug #71300 (Segfault in zend_fetch_string_offset). (Laruence)
|
||||
. Fixed bug #71221 (Null pointer deref (segfault) in get_defined_vars via
|
||||
ob_start). (hugh at allthethings dot co dot nz)
|
||||
. Fixed bug #71201 (round() segfault on 64-bit builds). (Anatol)
|
||||
. Added support for new HTTP 451 code. (Julien)
|
||||
. Fixed Bug #71275 (Bad method called on cloning an object having a trait).
|
||||
(Bob)
|
||||
. Fixed bug #71273 (A wrong ext directory setup in php.ini leads to crash).
|
||||
(Anatol)
|
||||
. Fixed bug #71297 (Memory leak with consecutive yield from). (Bob)
|
||||
. Fixed bug #71314 (var_export(INF) prints INF.0). (Andrea)
|
||||
|
||||
- Apache2handler:
|
||||
. Fix >2G Content-Length headers in apache2handler. (Adam Harvey)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #71227 (Can't compile php_curl statically). (Anatol)
|
||||
. Fixed bug #71225 (curl_setopt() fails to set CURLOPT_POSTFIELDS with
|
||||
reference to CURLFile). (Laruence)
|
||||
|
||||
- Interbase:
|
||||
. Fixed Bug #71305 (Crash when optional resource is omitted).
|
||||
(Laruence, Anatol)
|
||||
|
||||
- LDAP:
|
||||
. Fixed bug #71249 (ldap_mod_replace/ldap_mod_add store value as string
|
||||
"Array"). (Laruence)
|
||||
|
||||
- mbsgring:
|
||||
. Fixed bug #71397 (mb_send_mail segmentation fault). (Andrea, Yasuo)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70979 (crash with bad soap request). (Anatol)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #71204 (segfault if clean spl_autoload_funcs while autoloading).
|
||||
(Laruence)
|
||||
. Fixed bug #71202 (Autoload function registered by another not activated
|
||||
immediately). (Laruence)
|
||||
|
||||
- Session:
|
||||
. Improved fix for bug #68063 (Empty session IDs do still start sessions). (Yasuo)
|
||||
. Fixed bug #69111 (Crash in SessionHandler::read()) (Yasuo)
|
||||
. Fixed bug #71038 (session_start() returns TRUE on failure).
|
||||
Session save handlers must return 'string' always for successful read.
|
||||
i.e. Non-existing session read must return empty string. PHP 7.0 is made
|
||||
not to tolerate buggy return value. (Yasuo)
|
||||
. Fixed bug #71394 (session_regenerate_id() must close opened session on errors).
|
||||
(Yasuo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #71287 (Error message contains hexadecimal instead of decimal
|
||||
number). (Laruence)
|
||||
. Fixed bug #71264 (file_put_contents() returns unexpected value when
|
||||
filesystem runs full). (Laruence)
|
||||
. Fixed bug #71245 (file_get_contents() ignores "header" context option if
|
||||
it's a reference). (Laruence)
|
||||
. Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start).
|
||||
(hugh at allthethings dot co dot nz)
|
||||
. Fixed bug #71190 (substr_replace converts integers in original $search
|
||||
array to strings). (Laruence)
|
||||
. Fixed bug #71188 (str_replace converts integers in original $search array
|
||||
to strings). (Laruence)
|
||||
. Fixed bug #70720 (strip_tags improper php code parsing). (Julien)
|
||||
. Fixed bug #71132, #71197 (range() segfaults). (Thomas Punt)
|
||||
|
||||
07 Jan 2016 PHP 7.0.2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71165 (-DGC_BENCH=1 doesn't work on PHP7).
|
||||
(y dot uchiyama dot 1015 at gmail dot com)
|
||||
. Fixed bug #71163 (Segmentation Fault: cleanup_unfinished_calls). (Laruence)
|
||||
. Fixed bug #71109 (ZEND_MOD_CONFLICTS("xdebug") doesn't work). (Laruence)
|
||||
. Fixed bug #71105 (Format String Vulnerability in Class Name Error Message).
|
||||
(andrew at jmpesp dot org)
|
||||
. Fixed bug #71092 (Segmentation fault with return type hinting). (Laruence)
|
||||
. Fixed bug memleak in header_register_callback. (Laruence)
|
||||
. Fixed bug #71067 (Local object in class method stays in memory for each
|
||||
@ -16,6 +93,16 @@ PHP NEWS
|
||||
. Fixed bug #71089 (No check to duplicate zend_extension). (Remi)
|
||||
. Fixed bug #71086 (Invalid numeric literal parse error within
|
||||
highlight_string() function). (Nikita)
|
||||
. Fixed bug #71154 (Incorrect HT iterator invalidation causes iterator reuse).
|
||||
(Nikita)
|
||||
. Fixed bug #52355 (Negating zero does not produce negative zero). (Andrea)
|
||||
. Fixed bug #66179 (var_export() exports float as integer). (Andrea)
|
||||
. Fixed bug #70804 (Unary add on negative zero produces positive zero).
|
||||
(Andrea)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #71144 (Sementation fault when using cURL with ZTS).
|
||||
(Michael Maroszek, Laruence)
|
||||
|
||||
- DBA:
|
||||
. Fixed key leak with invalid resource. (Laruence)
|
||||
@ -23,14 +110,28 @@ PHP NEWS
|
||||
- Filter:
|
||||
. Fixed bug #71063 (filter_input(INPUT_ENV, ..) does not work). (Reeze Xia)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
|
||||
Out of Bounds). (emmanuel dot law at gmail dot com).
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #70755 (fpm_log.c memory leak and buffer overflow). (Stas)
|
||||
|
||||
- FTP:
|
||||
. Implement FR #55651 (Option to ignore the returned FTP PASV address).
|
||||
. Implemented FR #55651 (Option to ignore the returned FTP PASV address).
|
||||
(abrender at elitehosts dot com)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #71066 (mb_send_mail: Program terminated with signal SIGSEGV,
|
||||
Segmentation fault). (Laruence)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #71127 (Define in auto_prepend_file is overwrite). (Laruence)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #71178 (preg_replace with arrays creates [0] in replace array
|
||||
if not already set). (Laruence)
|
||||
|
||||
- Readline:
|
||||
. Fixed bug #71094 (readline_completion_function corrupts static array on
|
||||
second TAB). (Nikita)
|
||||
@ -41,13 +142,29 @@ PHP NEWS
|
||||
- SPL:
|
||||
. Fixed bug #71077 (ReflectionMethod for ArrayObject constructor returns
|
||||
wrong number of parameters). (Laruence)
|
||||
. Fixed bug #71153 (Performance Degradation in ArrayIterator with large
|
||||
arrays). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #71270 (Heap BufferOver Flow in escapeshell functions).
|
||||
(emmanuel dot law at gmail dot com)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
|
||||
(taoguangchen at icloud dot com)
|
||||
. Fixed bug #70741 (Session WDDX Packet Deserialization Type Confusion
|
||||
Vulnerability). (taoguangchen at icloud dot com)
|
||||
|
||||
- XMLRPC
|
||||
. Fixed bug #70728 (Type Confusion Vulnerability in PHP_to_XMLRPC_worker).
|
||||
(Julien)
|
||||
|
||||
17 Dec 2015, PHP 7.0.1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70831 (Compile fails on system with 160 CPUs).
|
||||
(Daniel Axtens)
|
||||
. Fixed bug #71105 (Format String Vulnerability in Class Name Error Message).
|
||||
(CVE-2015-8617) (andrew at jmpesp dot org)
|
||||
. Fixed bug #70831 (Compile fails on system with 160 CPUs). (Daniel Axtens)
|
||||
. Fixed bug #71006 (symbol referencing errors on Sparc/Solaris). (Dmitry)
|
||||
. Fixed bug #70997 (When using parentClass:: instead of parent::, static
|
||||
context changed). (Dmitry)
|
||||
@ -60,8 +177,8 @@ PHP NEWS
|
||||
. Fixed bug #70944 (try{ } finally{} can create infinite chains of
|
||||
exceptions). (Laruence)
|
||||
. Fixed bug #70931 (Two errors messages are in conflict). (dams, Laruence)
|
||||
. Fixed bug #70904 (yield from incorrectly marks valid generator as finished).
|
||||
(Bob)
|
||||
. Fixed bug #70904 (yield from incorrectly marks valid generator as
|
||||
finished). (Bob)
|
||||
. Fixed bug #70899 (buildconf failure in extensions). (Bob, Reeze)
|
||||
. Fixed bug #61751 (SAPI build problem on AIX: Undefined symbol:
|
||||
php_register_internal_extensions). (Lior Kaplan)
|
||||
@ -79,7 +196,7 @@ PHP NEWS
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #71020 (Use after free in Collator::sortWithSortKeys).
|
||||
(emmanuel dot law at gmail dot com, Laruence)
|
||||
(CVE-2015-8616) (emmanuel dot law at gmail dot com, Laruence)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction).
|
||||
@ -89,8 +206,8 @@ PHP NEWS
|
||||
connection flag. (Andrey)
|
||||
|
||||
- OCI8:
|
||||
. Fixed LOB implementation size_t/zend_long mismatch reported
|
||||
by gcov. (Senthil)
|
||||
. Fixed LOB implementation size_t/zend_long mismatch reported by gcov.
|
||||
(Senthil)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #71024 (Unable to use PHP 7.0 x64 side-by-side with PHP 5.6 x32
|
||||
@ -100,6 +217,9 @@ PHP NEWS
|
||||
. Fixed bug #70977 (Segmentation fault with opcache.huge_code_pages=1).
|
||||
(Laruence)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #60052 (Integer returned as a 64bit integer on X64_86). (Mariuz)
|
||||
|
||||
- Phpdbg:
|
||||
. Fixed stderr being written to stdout. (Bob)
|
||||
|
||||
@ -109,6 +229,10 @@ PHP NEWS
|
||||
. Fixed bug #70982 (setStaticPropertyValue behaviors inconsistently with
|
||||
5.6). (Laruence)
|
||||
|
||||
- Soap:
|
||||
. Fixed bug #70993 (Array key references break argument processing).
|
||||
(Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #71028 (Undefined index with ArrayIterator). (Laruence)
|
||||
|
||||
@ -125,13 +249,6 @@ PHP NEWS
|
||||
- Streams/Socket:
|
||||
. Add IPV6_V6ONLY constant / make it usable in stream contexts. (Bob)
|
||||
|
||||
- Soap:
|
||||
. Fixed bug #70993 (Array key references break argument processing).
|
||||
(Laruence)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #60052 (Integer returned as a 64bit integer on X64_86). (Mariuz)
|
||||
|
||||
03 Dec 2015, PHP 7.0.0
|
||||
|
||||
- Core:
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #42802 (Namespace not supported in typehints)
|
||||
Bug #42802 (Namespace not supported in types)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace foo;
|
||||
|
20
Zend/tests/bug52355.phpt
Normal file
20
Zend/tests/bug52355.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #52355 (Negating zero does not produce negative zero)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(-0.0);
|
||||
var_dump(-(float)"0");
|
||||
|
||||
$foo = -sin(0);
|
||||
|
||||
var_dump($foo);
|
||||
|
||||
var_dump(@(1.0 / -0.0));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
float(-0)
|
||||
float(-0)
|
||||
float(-0)
|
||||
float(-INF)
|
@ -5,4 +5,4 @@ Bug #69767 (Default parameter value with wrong type segfaults)
|
||||
function foo(String $bar = 0) {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Default value for parameters with a string type hint can only be string or NULL in %sbug69767.php on line %d
|
||||
Fatal error: Default value for parameters with a string type can only be string or NULL in %sbug69767.php on line %d
|
||||
|
26
Zend/tests/bug70083.phpt
Normal file
26
Zend/tests/bug70083.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #70083 (Use after free with assign by ref to overloaded objects)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
private $var;
|
||||
function __get($e) {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
function &noref() { $foo = 1; return $foo; }
|
||||
|
||||
$foo = new foo;
|
||||
$foo->i = &noref();
|
||||
var_dump($foo);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
17
Zend/tests/bug70804.phpt
Normal file
17
Zend/tests/bug70804.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #70804 (Unary add on negative zero produces positive zero)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(+(-0.0));
|
||||
var_dump(+(float)"-0");
|
||||
|
||||
$foo = +(-sin(0));
|
||||
|
||||
var_dump($foo);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
float(-0)
|
||||
float(-0)
|
||||
float(-0)
|
19
Zend/tests/bug71154.phpt
Normal file
19
Zend/tests/bug71154.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #71154: Incorrect HT iterator invalidation causes iterator reuse
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = [1, 2, 3];
|
||||
foreach ($array as &$ref) {
|
||||
/* Free array, causing free of iterator */
|
||||
$array = [];
|
||||
/* Reuse the iterator.
|
||||
* However it will also be reused on next foreach iteration */
|
||||
$it = new ArrayIterator([1, 2, 3]);
|
||||
$it->rewind();
|
||||
}
|
||||
var_dump($it->current());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
25
Zend/tests/bug71163.phpt
Normal file
25
Zend/tests/bug71163.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #71163 (Segmentation Fault (cleanup_unfinished_calls))
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($name) {
|
||||
eval ("class $name extends Exception { public static function foo() {}}");
|
||||
throw new Exception("boom");
|
||||
}
|
||||
|
||||
function test2() {
|
||||
try {
|
||||
Test::foo();
|
||||
} catch (Exception $e) {
|
||||
echo "okey";
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
test2();
|
||||
}
|
||||
|
||||
test();
|
||||
?>
|
||||
--EXPECT--
|
||||
okey
|
10
Zend/tests/bug71221.phpt
Normal file
10
Zend/tests/bug71221.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start("get_defined_vars");
|
||||
ob_end_clean();
|
||||
?>
|
||||
okey
|
||||
--EXPECT--
|
||||
okey
|
28
Zend/tests/bug71248.phpt
Normal file
28
Zend/tests/bug71248.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #71248 (Wrong interface is enforced)
|
||||
--FILE--
|
||||
<?php
|
||||
class Hint1 { }
|
||||
class Hint2 { }
|
||||
|
||||
abstract class Base {
|
||||
public function __construct(Hint1 $x) { }
|
||||
}
|
||||
|
||||
interface Iface {
|
||||
public function __construct(Hint1 $x);
|
||||
}
|
||||
|
||||
class Foo extends Base implements Iface {
|
||||
}
|
||||
|
||||
$code = <<<'PHP'
|
||||
abstract class Bar extends Base {
|
||||
public function __construct(Hint2 $x) { }
|
||||
}
|
||||
PHP;
|
||||
eval($code);
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
27
Zend/tests/bug71275.phpt
Normal file
27
Zend/tests/bug71275.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #71275 (Bad method called on cloning an object having a trait)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait MyTrait {
|
||||
public function _() {
|
||||
throw new RuntimeException('Should not be called');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyClass {
|
||||
use MyTrait;
|
||||
|
||||
public function __clone() {
|
||||
echo "I'm working hard to clone";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$instance = new MyClass();
|
||||
clone $instance;
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
I'm working hard to clone
|
28
Zend/tests/bug71300.phpt
Normal file
28
Zend/tests/bug71300.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #71300 (Segfault in zend_fetch_string_offset)
|
||||
--FILE--
|
||||
<?php
|
||||
function test1() {
|
||||
for ($n = 'a'; $n < 'g'; $n++) {
|
||||
$$n = 1;
|
||||
}
|
||||
$$n = $$n[++$n] = "test";
|
||||
return $$n;
|
||||
}
|
||||
|
||||
var_dump(test1());
|
||||
|
||||
function test2() {
|
||||
/* See #71303 for why not using for loop here */
|
||||
$n = "a";
|
||||
$$n .= $$n[++$n] = "test";
|
||||
return $$n;
|
||||
}
|
||||
|
||||
var_dump(test2());
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(4) "test"
|
||||
|
||||
Notice: Array to string conversion in %sbug71300.php on line %d
|
||||
string(9) "Arraytest"
|
48
Zend/tests/bug71336.phpt
Normal file
48
Zend/tests/bug71336.phpt
Normal file
@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Bug #71336 (Wrong is_ref on properties as exposed via get_object_vars())
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
protected $bar = array('baz');
|
||||
|
||||
function bar()
|
||||
{
|
||||
array_pop($this->bar);
|
||||
$vars = get_object_vars($this);
|
||||
$this->bar[] = array('buz');
|
||||
print_r($vars);
|
||||
}
|
||||
|
||||
function foo() {
|
||||
array_pop($this->bar);
|
||||
$dummy = &$this->bar;
|
||||
$vars = get_object_vars($this);
|
||||
$this->bar[] = array('buz');
|
||||
print_r($vars);
|
||||
}
|
||||
}
|
||||
|
||||
(new A())->bar();
|
||||
(new A())->foo();
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[bar] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[bar] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => buz
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Closure 059: Closure type hinting
|
||||
Closure 059: Closure type declaration
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
errmsg: default value for parameters with array type hint can only be an array or NULL
|
||||
errmsg: default value for parameters with array type can only be an array or NULL
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -11,4 +11,4 @@ class test {
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d
|
||||
Fatal error: Default value for parameters with array type can only be an array or NULL in %s on line %d
|
||||
|
25
Zend/tests/generators/bug71297.phpt
Normal file
25
Zend/tests/generators/bug71297.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #71297 (Memory leak with consecutive yield from)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo() {
|
||||
yield array_fill(0, 10000, 4);
|
||||
}
|
||||
|
||||
function genLeak() {
|
||||
$i = 0;
|
||||
while (1) {
|
||||
yield from foo();
|
||||
print $i++;
|
||||
}
|
||||
}
|
||||
|
||||
$x = 0;
|
||||
foreach (genLeak() as $i) {
|
||||
if ($x++ == 3) break;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
012
|
@ -58,7 +58,7 @@ $gen->next();
|
||||
var_dump($gen->getReturn());
|
||||
|
||||
// Explicit value-less return also results in a NULL generator
|
||||
// return value and there is no interference with type hints
|
||||
// return value and there is no interference with type declarations
|
||||
function gen6() : Generator {
|
||||
return;
|
||||
yield 24;
|
||||
|
19
Zend/tests/memory_get_peak_usage.phpt
Normal file
19
Zend/tests/memory_get_peak_usage.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
int memory_get_peak_usage ([ bool $real_usage = false ] );
|
||||
--CREDITS--
|
||||
marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
|
||||
--INI--
|
||||
memory_limit=-1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($a = memory_get_peak_usage());
|
||||
var_dump(memory_get_peak_usage(true));
|
||||
var_dump(memory_get_peak_usage(false));
|
||||
$array = range(1,1024*1024);
|
||||
var_dump(memory_get_peak_usage() > $a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(%d)
|
||||
int(%d)
|
||||
int(%d)
|
||||
bool(true)
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
055: typehints in namespaces
|
||||
055: types in namespaces
|
||||
--FILE--
|
||||
<?php
|
||||
namespace test\ns1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Return type hinting for internal functions
|
||||
Return type for internal functions
|
||||
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Return type hinting for internal functions 2
|
||||
Return type for internal functions 2
|
||||
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Return type hinting and Reflection::export()
|
||||
Return type and Reflection::export()
|
||||
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Array type hint
|
||||
Array type declaration
|
||||
--FILE--
|
||||
<?php
|
||||
function foo(array $a) {
|
||||
@ -12,8 +12,8 @@ foo(123);
|
||||
--EXPECTF--
|
||||
3
|
||||
|
||||
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php:2
|
||||
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type array, integer given, called in %s on line 7 and defined in %s:2
|
||||
Stack trace:
|
||||
#0 %s(%d): foo(123)
|
||||
#1 {main}
|
||||
thrown in %sarray_type_hint_001.php on line 2
|
||||
thrown in %s on line 2
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type hint#001
|
||||
callable type#001
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -21,7 +21,7 @@ foo($closure);
|
||||
string(6) "strpos"
|
||||
string(3) "foo"
|
||||
|
||||
Deprecated: Non-static method bar::baz() should not be called statically in %scallable_type_hint_001.php on line %d
|
||||
Deprecated: Non-static method bar::baz() should not be called statically in %s on line %d
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "bar"
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type hint#002 - Reflection
|
||||
callable type#002 - Reflection
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type hint#003
|
||||
callable type#003
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Closure with variadic type hint
|
||||
Closure with variadic type declaration
|
||||
--FILE--
|
||||
<?php
|
||||
$f = function (stdClass ...$a) {
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Inexistent class as typehint receiving scalar argument
|
||||
Inexistent class as type receiving scalar argument
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint - internal function strict mode
|
||||
Scalar type - internal function strict mode
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ -32,4 +32,4 @@ try {
|
||||
*** Trying Array Map With Invalid Callback
|
||||
*** Caught array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
|
||||
*** Trying Strlen With Float
|
||||
*** Caught strlen() expects parameter 1 to be string, float given
|
||||
*** Caught strlen() expects parameter 1 to be string, float given
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint basics
|
||||
Scalar type basics
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -45,7 +45,7 @@ $values = [
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
echo PHP_EOL . "*** Trying ";
|
||||
var_dump($value);
|
||||
@ -60,7 +60,7 @@ echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
|
||||
*** Trying int(1)
|
||||
int(1)
|
||||
@ -114,7 +114,7 @@ int(0)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
|
||||
*** Trying int(1)
|
||||
float(1)
|
||||
@ -168,7 +168,7 @@ float(0)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
|
||||
*** Trying int(1)
|
||||
string(1) "1"
|
||||
@ -221,7 +221,7 @@ string(6) "foobar"
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
|
||||
*** Trying int(1)
|
||||
bool(true)
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint - default via constants
|
||||
Scalar type - default via constants
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -80,4 +80,4 @@ string(14) "this is a test"
|
||||
Testing int with default null constant
|
||||
NULL
|
||||
Testing int with null null constant
|
||||
NULL
|
||||
NULL
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint - default via constants - error condition
|
||||
Scalar type - default via constants - error condition
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -17,4 +17,4 @@ Fatal error: Uncaught TypeError: Argument 1 passed to int_val() must be of the t
|
||||
Stack trace:
|
||||
#0 %s(%d): int_val()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
thrown in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Float type hint should allow an integer as default even with strict types
|
||||
Float type should allow an integer as default even with strict types
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Float type hint should allow an integer as default
|
||||
Float type should allow an integer as default
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Float type should not allow invalid types as default
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(float $arg = true)
|
||||
{
|
||||
var_dump($arg);
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Fatal error: Default value for parameters with a float type can only be float, integer, or NULL in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint missing parameters
|
||||
Scalar type missing parameters
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint nullability
|
||||
Scalar type nullability
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint - disallow relative typehints
|
||||
Scalar type - disallow relative types
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (2)
|
||||
Scalar type names cannot be used as class, trait or interface names (2)
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (2) - class_alias
|
||||
Scalar type names cannot be used as class, trait or interface names (2) - class_alias
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (2) - use
|
||||
Scalar type names cannot be used as class, trait or interface names (2) - use
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (3)
|
||||
Scalar type names cannot be used as class, trait or interface names (3)
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (3) - class_alias
|
||||
Scalar type names cannot be used as class, trait or interface names (3) - class_alias
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (3) - use
|
||||
Scalar type names cannot be used as class, trait or interface names (3) - use
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (4)
|
||||
Scalar type names cannot be used as class, trait or interface names (4)
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (4) - class_alias
|
||||
Scalar type names cannot be used as class, trait or interface names (4) - class_alias
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (4) - use
|
||||
Scalar type names cannot be used as class, trait or interface names (4) - use
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (6)
|
||||
Scalar type names cannot be used as class, trait or interface names (6)
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (6) - class_alias
|
||||
Scalar type names cannot be used as class, trait or interface names (6) - class_alias
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (6) - use
|
||||
Scalar type names cannot be used as class, trait or interface names (6) - use
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint names cannot be used as class, trait or interface names (7)
|
||||
Scalar type names cannot be used as class, trait or interface names (7)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace foo;
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Return scalar type hint basics
|
||||
Return scalar type basics
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
@ -48,7 +48,7 @@ $values = [
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
echo "*** Trying ";
|
||||
var_dump($value);
|
||||
@ -63,7 +63,7 @@ foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
*** Trying int(1)
|
||||
int(1)
|
||||
*** Trying string(1) "1"
|
||||
@ -101,7 +101,7 @@ int(0)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type integer, resource returned in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
*** Trying int(1)
|
||||
float(1)
|
||||
*** Trying string(1) "1"
|
||||
@ -139,7 +139,7 @@ float(0)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type float, resource returned in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
*** Trying int(1)
|
||||
string(1) "1"
|
||||
*** Trying string(1) "1"
|
||||
@ -176,7 +176,7 @@ string(6) "foobar"
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type string, resource returned in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
*** Trying int(1)
|
||||
bool(true)
|
||||
*** Trying string(1) "1"
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Return scalar type hint basics
|
||||
Return scalar type basics
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
|
||||
--FILE--
|
||||
@ -48,7 +48,7 @@ $values = [
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
echo "*** Trying ";
|
||||
var_dump($value);
|
||||
@ -63,7 +63,7 @@ foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
*** Trying int(1)
|
||||
int(1)
|
||||
*** Trying string(1) "1"
|
||||
@ -101,7 +101,7 @@ int(0)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type integer, resource returned in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
*** Trying int(1)
|
||||
float(1)
|
||||
*** Trying string(1) "1"
|
||||
@ -139,7 +139,7 @@ float(0)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type float, resource returned in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
*** Trying int(1)
|
||||
string(1) "1"
|
||||
*** Trying string(1) "1"
|
||||
@ -176,7 +176,7 @@ string(6) "foobar"
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Return value of {closure}() must be of the type string, resource returned in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
*** Trying int(1)
|
||||
bool(true)
|
||||
*** Trying string(1) "1"
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint strict mode
|
||||
Scalar type strict mode
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
|
||||
--FILE--
|
||||
@ -49,7 +49,7 @@ $values = [
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
echo PHP_EOL . "*** Trying ";
|
||||
var_dump($value);
|
||||
@ -64,7 +64,7 @@ foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
|
||||
*** Trying int(1)
|
||||
int(1)
|
||||
@ -117,7 +117,7 @@ int(2147483647)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
|
||||
*** Trying int(1)
|
||||
float(1)
|
||||
@ -170,7 +170,7 @@ float(NAN)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
|
||||
*** Trying int(1)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
|
||||
@ -223,7 +223,7 @@ string(0) ""
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
|
||||
*** Trying int(1)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Scalar type hint strict mode
|
||||
Scalar type strict mode
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
|
||||
--FILE--
|
||||
@ -49,7 +49,7 @@ $values = [
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
echo PHP_EOL . "*** Trying ";
|
||||
var_dump($value);
|
||||
@ -64,7 +64,7 @@ foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
|
||||
*** Trying int(1)
|
||||
int(1)
|
||||
@ -117,7 +117,7 @@ int(9223372036854775807)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
|
||||
*** Trying int(1)
|
||||
float(1)
|
||||
@ -170,7 +170,7 @@ float(NAN)
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
|
||||
*** Trying int(1)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
|
||||
@ -223,7 +223,7 @@ string(0) ""
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
|
||||
*** Trying int(1)
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Strict scalar type hint basics
|
||||
Strict scalar type basics
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -48,7 +48,7 @@ function type($value) {
|
||||
}
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL, "Testing '$type' typehint:", PHP_EOL;
|
||||
echo PHP_EOL, "Testing '$type' type:", PHP_EOL;
|
||||
foreach ($values as $value) {
|
||||
$errored = false;
|
||||
echo PHP_EOL . "*** Trying ", type($value), " value", PHP_EOL;
|
||||
@ -62,7 +62,7 @@ foreach ($functions as $type => $function) {
|
||||
echo PHP_EOL . "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing 'int' typehint:
|
||||
Testing 'int' type:
|
||||
|
||||
*** Trying integer value
|
||||
int(1)
|
||||
@ -91,7 +91,7 @@ int(1)
|
||||
*** Trying resource value
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' typehint:
|
||||
Testing 'float' type:
|
||||
|
||||
*** Trying integer value
|
||||
float(1)
|
||||
@ -120,7 +120,7 @@ float(1)
|
||||
*** Trying resource value
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' typehint:
|
||||
Testing 'string' type:
|
||||
|
||||
*** Trying integer value
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
|
||||
@ -149,7 +149,7 @@ string(1) "1"
|
||||
*** Trying resource value
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' typehint:
|
||||
Testing 'bool' type:
|
||||
|
||||
*** Trying integer value
|
||||
*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Weak scalar type hints, with references
|
||||
Weak scalar types, with references
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -12,7 +12,7 @@ function to_bool(bool &$x) {}
|
||||
|
||||
$x = 1.0;
|
||||
var_dump($x);
|
||||
to_int($x); // because $x is by-reference, the weak type hint converts it
|
||||
to_int($x); // because $x is by-reference, the weak type converts it
|
||||
var_dump($x);
|
||||
to_float($x);
|
||||
var_dump($x);
|
@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Float type hint should not allow invalid types as default
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(float $arg = true)
|
||||
{
|
||||
var_dump($arg);
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Fatal error: Default value for parameters with a float type hint can only be float, integer, or NULL in %s on line %d
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Variadic arguments enforce typehints
|
||||
Variadic arguments enforce types
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Error suppression for typehints on variadic arguments works
|
||||
Error suppression for types on variadic arguments works
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@ -156,7 +156,7 @@ ZEND_API zend_utility_values zend_uv;
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2015 Zend Technologies\n"
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2016 Zend Technologies\n"
|
||||
#define PRINT_ZVAL_INDENT 4
|
||||
|
||||
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object) /* {{{ */
|
||||
@ -983,7 +983,6 @@ ZEND_API void zend_deactivate(void) /* {{{ */
|
||||
fprintf(stderr, " Root Buffered buffer grey\n");
|
||||
fprintf(stderr, " -------- -------- ----------- ------\n");
|
||||
fprintf(stderr, "ZVAL %8d %8d %9d %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove_from_buffer), GC_G(zval_marked_grey));
|
||||
fprintf(stderr, "ZOBJ %8d %8d %9d %8d\n", GC_G(zobj_possible_root), GC_G(zobj_buffered), GC_G(zobj_remove_from_buffer), GC_G(zobj_marked_grey));
|
||||
#endif
|
||||
|
||||
zend_try {
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user