mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-20 07:26:38 +00:00
Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1674bd9b15 | ||
|
|
69168b4d0c | ||
|
|
02f762f146 | ||
|
|
738729274f | ||
|
|
72bbde5e78 | ||
|
|
29f0493075 | ||
|
|
0f60a746e4 | ||
|
|
735a7c6a56 | ||
|
|
94e7c770ba | ||
|
|
26abfc8bc9 | ||
|
|
ec4350e4c8 | ||
|
|
3e971e7d5c | ||
|
|
b148ef4496 | ||
|
|
ad8a73dd55 | ||
|
|
ceefc0947a | ||
|
|
2928e412e6 | ||
|
|
770571bce9 | ||
|
|
6cdf477254 | ||
|
|
5784b8f8e6 | ||
|
|
ee573eba67 | ||
|
|
724e98498a | ||
|
|
62062dcd0e | ||
|
|
dfe6fdaa72 | ||
|
|
8d09c84bd3 | ||
|
|
955303ddc8 | ||
|
|
2a0e037c0d | ||
|
|
9876b2c2cf | ||
|
|
5ea2b70645 | ||
|
|
29711264a8 | ||
|
|
dbf30365aa | ||
|
|
9cb8cb4797 | ||
|
|
8a884d628b |
No files matched your search
@@ -101,7 +101,7 @@ define dump_bt
|
||||
____print_str $zvalue->value.str->val $zvalue->value.str->len
|
||||
end
|
||||
if $type == 7
|
||||
printf "array(%d)[%p]", $zvalue->value.arr->nNumOfElements, $zvalue
|
||||
printf "array(%d)[%p]", $zvalue->value.arr->ht->nNumOfElements, $zvalue
|
||||
end
|
||||
if $type == 8
|
||||
printf "object[%p]", $zvalue
|
||||
@@ -152,8 +152,8 @@ define ____printzv_contents
|
||||
set $type = $zvalue->u1.v.type
|
||||
|
||||
# 15 == IS_INDIRECT
|
||||
if $type > 5 && $type != 15
|
||||
printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount
|
||||
if $type >= 5 && $type != 15
|
||||
printf "(refcount=%d) ", $zvalue->value.counted->refcount
|
||||
end
|
||||
|
||||
if $type == 0
|
||||
@@ -181,7 +181,7 @@ define ____printzv_contents
|
||||
printf "array: "
|
||||
if ! $arg1
|
||||
set $ind = $ind + 1
|
||||
____print_ht $zvalue->value.arr 1
|
||||
____print_ht $zvalue->value.arr
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
|
||||
@@ -245,6 +245,10 @@ 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
|
||||
|
||||
+12
-18
@@ -1,22 +1,8 @@
|
||||
language: c
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- locales
|
||||
- language-pack-de
|
||||
- re2c
|
||||
- libgmp-dev
|
||||
- libicu-dev
|
||||
- libmcrypt-dev
|
||||
- libtidy-dev
|
||||
- libenchant-dev
|
||||
- libaspell-dev
|
||||
- libpspell-dev
|
||||
- librecode-dev
|
||||
- libsasl2-dev
|
||||
- libxpm-dev
|
||||
- libt1-dev
|
||||
|
||||
branches:
|
||||
except:
|
||||
- phpng
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -45,6 +31,13 @@ env:
|
||||
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
|
||||
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev libsasl2-dev libxpm-dev libt1-dev libc-client2007e-dev
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
@@ -54,6 +47,7 @@ before_script:
|
||||
- . ./travis/ext/pdo_mysql/setup.sh
|
||||
- . ./travis/ext/pgsql/setup.sh
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
- . ./travis/ext/imap/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2016 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2015 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ php_lcov.info: lcov-test
|
||||
cp $$x.bbg lcov_data/$$y.bbg ; \
|
||||
fi; \
|
||||
done; \
|
||||
for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
|
||||
for dir in ext/bcmath/libbcmath ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
|
||||
if test -d lcov_data/$$dir; then \
|
||||
rm -rf lcov_data/$$dir ; \
|
||||
fi; \
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ install-headers:
|
||||
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
|
||||
done; \
|
||||
$(mkinstalldirs) $$paths && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
if test "$(PHP_PECL_EXTENSION)"; then \
|
||||
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
|
||||
|
||||
@@ -202,8 +202,6 @@ TSRM_API void *tsrm_get_ls_cache(void);
|
||||
#define TSRMLS_CACHE_UPDATE()
|
||||
#define TSRMLS_CACHE
|
||||
|
||||
#define TSRM_TLS
|
||||
|
||||
/* BC only */
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 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
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 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 |
|
||||
|
||||
+4
-16
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 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 |
|
||||
@@ -49,7 +49,7 @@ TSRMLS_CACHE_UPDATE();
|
||||
globals->shm = NULL;
|
||||
globals->process_size = 0;
|
||||
globals->shm_size = 0;
|
||||
globals->comspec = _strdup("cmd.exe");
|
||||
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
|
||||
|
||||
/* Set it to INVALID_HANDLE_VALUE
|
||||
* It will be initialized correctly in tsrm_win32_access or set to
|
||||
@@ -437,7 +437,6 @@ static shm_pair *shm_get(int key, void *addr)
|
||||
TWG(shm) = newptr;
|
||||
ptr = newptr + TWG(shm_size);
|
||||
TWG(shm_size)++;
|
||||
memset(ptr, 0, sizeof(*ptr));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -599,8 +598,8 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
|
||||
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
|
||||
sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
|
||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||
@@ -612,12 +611,6 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
created = TRUE;
|
||||
}
|
||||
if (!shm_handle || !info_handle) {
|
||||
if (shm_handle) {
|
||||
CloseHandle(shm_handle);
|
||||
}
|
||||
if (info_handle) {
|
||||
CloseHandle(info_handle);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -627,11 +620,6 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
}
|
||||
|
||||
shm = shm_get(key, NULL);
|
||||
if (!shm) {
|
||||
CloseHandle(shm_handle);
|
||||
CloseHandle(info_handle);
|
||||
return -1;
|
||||
}
|
||||
shm->segment = shm_handle;
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 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,4 +1,6 @@
|
||||
PHP 7.0 UPGRADE NOTES
|
||||
$Id$
|
||||
|
||||
PHP X.Y UPGRADE NOTES
|
||||
|
||||
1. Backward Incompatible Changes
|
||||
2. New Features
|
||||
@@ -352,7 +354,7 @@ Relevant RFCs:
|
||||
Other language changes
|
||||
----------------------
|
||||
|
||||
* Removed support for static calls to non-static methods from an incompatible
|
||||
* Removed support for static calls to non-static calls form an incompatible
|
||||
$this context. In this case $this will not be defined, but the call will be
|
||||
allowed with a deprecation notice. An example:
|
||||
|
||||
@@ -427,12 +429,12 @@ Other language changes
|
||||
Standard library changes
|
||||
========================
|
||||
|
||||
. substr() now returns an empty string instead of FALSE when the truncation happens on boundaries.
|
||||
. call_user_method() and call_user_method_array() no longer exists.
|
||||
. ob_start() no longer issues an E_ERROR, but instead an E_RECOVERABLE_ERROR in case an
|
||||
output buffer is created in an output buffer handler.
|
||||
. The internal sorting algorithm has been improved, what may result in
|
||||
different sort order of elements that compare as equal.
|
||||
. Improved zend_qsort(using hybrid sorting algo) for better performance,
|
||||
and also renamed zend_qsort to zend_sort.
|
||||
. Added stable sorting algo zend_insert_sort.
|
||||
. Removed dl() function on fpm-fcgi.
|
||||
. setcookie() with an empty cookie name now issues a WARNING and doesn't send an empty set-cookie header line anymore.
|
||||
|
||||
@@ -532,8 +534,7 @@ Other
|
||||
. Closure::call() method added (works only with userland classes).
|
||||
. Added \u{xxxxxx} Unicode Codepoint Escape Syntax for double-quoted strings
|
||||
and heredocs.
|
||||
. define() now supports arrays as constant values, fixing an oversight where
|
||||
define() did not support arrays yet const syntax did.
|
||||
. define() now supports arrays as constant values, fixing an oversight where define() did not support arrays yet const syntax did.
|
||||
. Added the comparison operator (<=>), aka the spaceship operator.
|
||||
(RFC: https://wiki.php.net/rfc/combined-comparison-operator)
|
||||
. Added the yield from operator for delegating Generators like coroutines.
|
||||
@@ -546,20 +547,14 @@ Other
|
||||
(RFC: https://wiki.php.net/rfc/easy_userland_csprng)
|
||||
|
||||
- Opcache
|
||||
. Added second level file based opcode cache. It may be enabled by setting
|
||||
opcache.file_cache=<DIR> configuration directive in php.ini. The second
|
||||
level cache may improve performance when SHM is full, at server restart or
|
||||
SHM reset. In addition, it's possibe to use file cache without SHM at all,
|
||||
using opcache.file_cache_only=1 (this may be useful for sharing hosting),
|
||||
and disable file cache consistency check, to speedup loading at the cost of
|
||||
safety, using opcache.file_cache_consistency_checks=0.
|
||||
. Added ability to move PHP code pages (PHP TEXT segment) into HUGE pages.
|
||||
It's possible to enable/disable this feature in php.ini through
|
||||
opcache.huge_code_pages=0/1. OS should be configured to provide huge pages.
|
||||
. Added Windows only opcache.file_cache_fallback=1 ini option, which implies
|
||||
the implemented fallback mechanism. When OPcache was not able to reattach
|
||||
the shared memory segment to the desired address and opcache.file_cache
|
||||
is on, opcache.file_cache_only=1 will be automatically enforced.
|
||||
. Added second level file based opcode cache (experimental - disabled by
|
||||
default). To enable it, PHP should be configured and built with
|
||||
--enable-opcache-file, then opcache.file_cache=<DIR> configuration directive
|
||||
should be set in php.ini. The second level cache may improve performance
|
||||
at server restart or SHM reset. In addition, it's possibe to use file cache
|
||||
without SHM at all, using opcache.file_cache_only=1 (this may be useful for
|
||||
sharing hosting), and disable file cache consistency check, to speedup
|
||||
loading at the cost of safety, using opcache.file_cache_consistency_checks=0.
|
||||
|
||||
- OpenSSL
|
||||
. Added "alpn_protocols" SSL context option allowing encrypted client/server
|
||||
@@ -608,6 +603,9 @@ Other
|
||||
5. Changed Functions
|
||||
========================================
|
||||
|
||||
- parse_ini_file():
|
||||
- parse_ini_string():
|
||||
. Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
|
||||
- unserialize():
|
||||
. Added second parameter for unserialize function
|
||||
(RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify
|
||||
@@ -644,7 +642,6 @@ Other
|
||||
========================================
|
||||
6. New Functions
|
||||
========================================
|
||||
|
||||
- GMP
|
||||
. Added gmp_random_seed().
|
||||
|
||||
@@ -668,8 +665,6 @@ Other
|
||||
7. New Classes and Interfaces
|
||||
========================================
|
||||
|
||||
- ReflectionGenerator
|
||||
- ReflectionType
|
||||
|
||||
========================================
|
||||
8. Removed Extensions and SAPIs
|
||||
@@ -714,9 +709,6 @@ out, that the corresponding SDK isn't available anymore.
|
||||
- GD
|
||||
The bundled libgd requires libwebp instead of libvpx for the WebP functionality.
|
||||
|
||||
- Openssl
|
||||
minimum supported OpenSSL version series was raised to 0.9.8
|
||||
|
||||
========================================
|
||||
10. New Global Constants
|
||||
========================================
|
||||
@@ -780,9 +772,6 @@ out, that the corresponding SDK isn't available anymore.
|
||||
it depends alone on the openssl library. If it's present at the compile time,
|
||||
ftp_ssl_connect() is enabled automatically.
|
||||
|
||||
- imap
|
||||
. Static building of ext/imap is disabled
|
||||
|
||||
- odbc
|
||||
. The odbc extension is always shipped shared
|
||||
|
||||
@@ -799,11 +788,3 @@ out, that the corresponding SDK isn't available anymore.
|
||||
always say "integer" and "float" instead of "long" and "double".
|
||||
. Output buffering now continues to work for an aborted connection if
|
||||
ignore_user_abort is set to true.
|
||||
. Zend Extensions API was extended with zend_extension.op_array_persist_calc()
|
||||
and zend_extensions.op_array_persist() handlers. They allow to store (or
|
||||
reset) associated with op_array addition information in Opcache Shared
|
||||
Memory.
|
||||
. zend_internal_function.reserved[] array was introduced to allow association
|
||||
of aditional information with internal functions. In PHP-5 it was possible
|
||||
to use zend_function.op_array.reserved[] even for internal functions, but
|
||||
now we don't allocate extra space.
|
||||
+3
-13
@@ -1,3 +1,5 @@
|
||||
$Id$
|
||||
|
||||
PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
|
||||
0. Wiki Examples
|
||||
@@ -19,7 +21,6 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
s. Resource API changes
|
||||
t. Optimized strings concatenation.
|
||||
u. Streams changes
|
||||
v. Sort algorithm changes
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
@@ -90,7 +91,7 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
|
||||
The only exceptions are the snprintf and zend_sprintf functions yet, because in some cases
|
||||
they can use the implemenations available on the system, not the PHP one. With snprintf the
|
||||
macros ZEND_LONG_FMT and ZEND_ULONG_FMT should be used.
|
||||
macros ZEND_INT_FMT and ZEND_UINT_FMT should be used.
|
||||
|
||||
h. HashTable API
|
||||
|
||||
@@ -241,17 +242,6 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
using context stream option PHP_STREAM_OPTION_PIPE_BLOCKING or
|
||||
adding STREAM_USE_BLOCKING_PIPE when opening the stream.
|
||||
|
||||
v. Sort algorithm changes
|
||||
- Improved zend_qsort(using hybrid sorting algo) for better performance,
|
||||
and also renamed zend_qsort to zend_sort.
|
||||
- Added stable sorting algo zend_insert_sort.
|
||||
|
||||
w. Tick functions internal API change
|
||||
Tick functions have different declaration now. They expect a single
|
||||
parameter while before they were parameterless. When registering the
|
||||
tick function a value for this parameter must be passed. This value will be
|
||||
provided to the tick function on every execution.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
========================
|
||||
|
||||
+1
-4
@@ -421,6 +421,7 @@ AC_ARG_ENABLE(gcc-global-regs,
|
||||
AC_MSG_CHECKING(for global register variables support)
|
||||
if test "$ZEND_GCC_GLOBAL_REGS" != "no"; then
|
||||
AC_TRY_COMPILE([
|
||||
],[
|
||||
#if defined(__GNUC__)
|
||||
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
#else
|
||||
@@ -435,9 +436,6 @@ if test "$ZEND_GCC_GLOBAL_REGS" != "no"; then
|
||||
#elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
#elif defined(__IBMC__) && ZEND_GCC_VERSION >= 4002 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
#else
|
||||
# error "global register variables are not supported"
|
||||
#endif
|
||||
@@ -453,7 +451,6 @@ int emu(const opcode_handler_t *ip, void *fp) {
|
||||
FP = orig_fp;
|
||||
IP = orig_ip;
|
||||
}
|
||||
], [
|
||||
], [
|
||||
ZEND_GCC_GLOBAL_REGS=yes
|
||||
], [
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Ensure correct unmangling of private property names for anonymous class instances
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(new class { private $foo; });
|
||||
?>
|
||||
--EXPECT--
|
||||
object(class@anonymous)#1 (1) {
|
||||
["foo":"class@anonymous":private]=>
|
||||
NULL
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Array addition is not commutative -- do not swap operands
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = [1, 2, 3];
|
||||
$array = [4, 5, 6] + $array;
|
||||
var_dump($array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(4)
|
||||
[1]=>
|
||||
int(5)
|
||||
[2]=>
|
||||
int(6)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Array type declaration
|
||||
Array type hint
|
||||
--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 %s on line 7 and defined in %s:2
|
||||
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
|
||||
Stack trace:
|
||||
#0 %s(%d): foo(123)
|
||||
#1 {main}
|
||||
thrown in %s on line 2
|
||||
thrown in %sarray_type_hint_001.php on line 2
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70208 (scope information must be preserved with assert())
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function non_class_scope() {
|
||||
return true;
|
||||
}
|
||||
|
||||
class test {
|
||||
protected $prop = 1;
|
||||
|
||||
public function __construct() {
|
||||
assert('non_class_scope();');
|
||||
var_dump($this->prop);
|
||||
}
|
||||
}
|
||||
|
||||
new test;
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70528 (assert() with instanceof adds apostrophes around class name)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=0
|
||||
assert.warning=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
class Bar {}
|
||||
|
||||
$bar = "Bar";
|
||||
assert(new \stdClass instanceof $bar);
|
||||
assert(new \stdClass instanceof Bar);
|
||||
assert(new \stdClass instanceof \Foo\Bar);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(new \stdClass() instanceof $bar) failed in %sbug70528.php on line %d
|
||||
|
||||
Warning: assert(): assert(new \stdClass() instanceof Bar) failed in %sbug70528.php on line %d
|
||||
|
||||
Warning: assert(): assert(new \stdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d
|
||||
@@ -18,7 +18,7 @@ bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_016.php on line 6
|
||||
bool(false)
|
||||
NULL
|
||||
bool(true)
|
||||
|
||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_016.php on line 8
|
||||
@@ -25,9 +25,9 @@ bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 10
|
||||
bool(false)
|
||||
NULL
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 12
|
||||
bool(false)
|
||||
NULL
|
||||
bool(true)
|
||||
@@ -68,7 +68,7 @@ catch (Exception $e) {
|
||||
--EXPECTF--
|
||||
Hello World!
|
||||
===NONE===
|
||||
string(%d) "Method NoneTest::__toString() must return a string value"
|
||||
string(56) "Method NoneTest::__toString() must return a string value"
|
||||
===THROW===
|
||||
|
||||
Fatal error: Method ErrorTest::__toString() must not throw an exception, caught Exception: This is an error! in %sbug26166.php on line %d
|
||||
Fatal error: Method ErrorTest::__toString() must not throw an exception in %sbug26166.php on line %d
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #42802 (Namespace not supported in types)
|
||||
Bug #42802 (Namespace not supported in typehints)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace foo;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
--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)
|
||||
@@ -14,7 +14,7 @@ class Bad {
|
||||
$bad = new Bad();
|
||||
echo "$bad";
|
||||
--EXPECTF--
|
||||
Fatal error: Method Bad::__toString() must not throw an exception, caught Exception: Oops, I cannot do this in %sbug60909_2.php on line %d
|
||||
Fatal error: Method Bad::__toString() must not throw an exception in %sbug60909_2.php on line 0
|
||||
|
||||
|
||||
!!!shutdown!!!
|
||||
@@ -1,5 +1,11 @@
|
||||
--TEST--
|
||||
Bug #62358 (Segfault when using traits a lot)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("USE_ZEND_ALLOC") !== "0") {
|
||||
die("skip Need Zend MM enabled");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #62441: Incorrect strong typing in namespaced child classes
|
||||
--FILE--
|
||||
<?php
|
||||
namespace {
|
||||
interface Iface {
|
||||
function method(stdClass $o);
|
||||
}
|
||||
}
|
||||
namespace ns {
|
||||
class Foo implements \Iface {
|
||||
function method(stdClass $o) { }
|
||||
}
|
||||
|
||||
(new Foo)->method(new \stdClass);
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of ns\Foo::method(ns\stdClass $o) must be compatible with Iface::method(stdClass $o) in %s on line %d
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
--TEST--
|
||||
Bug #68412 (Infinite recursion with __call can make the program crash/segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("USE_ZEND_ALLOC") !== "1") {
|
||||
die("skip Need Zend MM enabled");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
|
||||
@@ -11,6 +11,5 @@ var_dump(serialize($instance));
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: Serialization of 'class@%s' is not allowed in %sbug69761.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug69761.php(%d): serialize(Object(class@anonymous))
|
||||
#1 {main}
|
||||
#0 %sbug69761.php(%d): serialize(Object(class@%s
|
||||
thrown in %sbug69761.php on line %d
|
||||
@@ -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 can only be string or NULL in %sbug69767.php on line %d
|
||||
Fatal error: Default value for parameters with a string type hint can only be string or NULL in %sbug69767.php on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69989: Cycle collection for yielded values
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
yield yield;
|
||||
}
|
||||
$gen = gen();
|
||||
$gen->send($gen);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,26 +0,0 @@
|
||||
--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
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70173 (ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var = 2900000000;
|
||||
var_dump($var);
|
||||
?>
|
||||
--EXPECT--
|
||||
float(2900000000)
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70187 (Notice: unserialize(): Unexpected end of serialized data)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $b;
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
var_dump($a); // force properties HT
|
||||
unset($a->b);
|
||||
var_dump(serialize($a));
|
||||
?>
|
||||
--EXPECT--
|
||||
object(A)#1 (1) {
|
||||
["b"]=>
|
||||
NULL
|
||||
}
|
||||
string(12) "O:1:"A":0:{}"
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70187 (Notice: unserialize(): Unexpected end of serialized data)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = 1;
|
||||
unset($a);
|
||||
unserialize(serialize($GLOBALS));
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70215 (Segfault when invoke is static)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public static function __invoke() {
|
||||
echo __CLASS__;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A { }
|
||||
|
||||
$b = new B;
|
||||
|
||||
$b();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: The magic method __invoke() must have public visibility and cannot be static in %s on line %d
|
||||
A
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70223 (Incrementing value returned by magic getter)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
|
||||
private $foo = 0;
|
||||
|
||||
public function &__get($foo){ return $this->foo; }
|
||||
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
echo $a->f++;
|
||||
echo $a->f++;
|
||||
echo $a->f++;
|
||||
?>
|
||||
--EXPECT--
|
||||
012
|
||||
@@ -1,8 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70240 (Segfault when doing unset($var()))
|
||||
--FILE--
|
||||
<?php
|
||||
unset($var());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Can't use function return value in write context in %sbug70240.php on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70241 (Skipped assertions affect Generator returns)
|
||||
--INI--
|
||||
zend.assertions=-1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo () {
|
||||
assert(yield 1);
|
||||
return null;
|
||||
}
|
||||
|
||||
var_dump(foo() instanceof Generator);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70253 (segfault at _efree () in zend_alloc.c:1389)
|
||||
--INI--
|
||||
memory_limit=2M
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
unserialize('a:2:{i:0;O:9:"000000000":10000000');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70258 (Segfault if do_resize fails to allocated memory)
|
||||
--INI--
|
||||
memory_limit=2M
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $arr;
|
||||
public function core() {
|
||||
$this->arr["no_pack"] = 1;
|
||||
while (1) {
|
||||
$this->arr[] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->core();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70262 (Accessing array crashes)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array();
|
||||
$array[] = 1; // make this not immutable
|
||||
|
||||
$extra = $array; // make the refcount == 2
|
||||
|
||||
class A {
|
||||
public function getObj($array) {
|
||||
$obj = new Stdclass;
|
||||
$obj->arr = $array; // make the refcount == 3;
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->getObj($array) //use function call to get a refcount == 1 IS_VAR object
|
||||
->arr // FETCH_OBJ_W will EXTRACT_ZVAL_PTR because getObj() result a refcount == 1 object (READY_TO_DESTROY)
|
||||
[0] = "test"; //We will get a refcount == 3 array (not a IS_INDIRCT) in ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER
|
||||
|
||||
var_dump($array);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70288 (Apache crash related to ZEND_SEND_REF)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public function __get($name) {
|
||||
return new Stdclass();
|
||||
}
|
||||
}
|
||||
|
||||
function test(&$obj) {
|
||||
var_dump($obj);
|
||||
}
|
||||
$a = new A;
|
||||
test($a->dummy);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Crash with specific assertions and zend.assertions=-1
|
||||
--INI--
|
||||
zend.assertions=-1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function f() {
|
||||
assert(@$a ?: 1);
|
||||
echo "OK";
|
||||
};
|
||||
f();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -1,49 +0,0 @@
|
||||
--TEST--
|
||||
bug #70321 (Magic getter breaks reference to array property)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo implements arrayAccess
|
||||
{
|
||||
private $bar;
|
||||
public function __construct()
|
||||
{
|
||||
$this->bar = new bar();
|
||||
}
|
||||
public function & __get($key)
|
||||
{
|
||||
$bar = $this->bar;
|
||||
return $bar;
|
||||
}
|
||||
|
||||
public function & offsetGet($key) {
|
||||
$bar = $this->bar;
|
||||
return $bar;
|
||||
}
|
||||
public function offsetSet($key, $val) {
|
||||
}
|
||||
public function offsetUnset($key) {
|
||||
}
|
||||
public function offsetExists($key) {
|
||||
}
|
||||
}
|
||||
class bar { public $onBaz = []; }
|
||||
|
||||
$foo = new foo();
|
||||
$foo->bar->onBaz[] = function() {};
|
||||
var_dump($foo->bar->onBaz);
|
||||
|
||||
$foo = new foo();
|
||||
$foo["bar"]->onBaz[] = function() {};
|
||||
var_dump($foo->bar->onBaz);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(Closure)#%d (0) {
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(Closure)#%d (0) {
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70332 (Wrong behavior while returning reference on object)
|
||||
--FILE--
|
||||
<?php
|
||||
function & test($arg) {
|
||||
return $arg;
|
||||
}
|
||||
|
||||
$arg = new Stdclass();
|
||||
$arg->name = array();
|
||||
|
||||
test($arg)->name[1] = "xxxx";
|
||||
|
||||
print_r($arg);
|
||||
?>
|
||||
--EXPECT--
|
||||
stdClass Object
|
||||
(
|
||||
[name] => Array
|
||||
(
|
||||
[1] => xxxx
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70397 (Segmentation fault when using Closure::call and yield)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$f = function () {
|
||||
$this->value = true;
|
||||
yield $this->value;
|
||||
};
|
||||
|
||||
var_dump($f->call(new class {})->current());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70398 (SIGSEGV, Segmentation fault zend_ast_destroy_ex)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
define("FILE_STREAM", fopen("php://temp", "r"));
|
||||
|
||||
define("FILE_STREAMS", array(fopen("php://temp", "r")));
|
||||
|
||||
var_dump(FILE_STREAM);
|
||||
var_dump(FILE_STREAMS);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
array(1) {
|
||||
[0]=>
|
||||
resource(%d) of type (stream)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70430: Stack buffer overflow in zend_language_parser()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$"*** Testing function() : ***\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: syntax error, unexpected '"*** Testing function() : ***' (T_CONSTANT_ENCAPSED_STRING), expecting variable (T_VARIABLE) or '{' or '$' in %s on line %d
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70478 (**= does no longer work)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
public $a = 3;
|
||||
private $b = 4;
|
||||
|
||||
function __construct() {
|
||||
$this->a **= $this->b;
|
||||
}
|
||||
}
|
||||
|
||||
$a = new foo;
|
||||
var_dump($a->a);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(81)
|
||||
@@ -1,83 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70547 (unsetting function variables corrupts backtrace)
|
||||
--FILE--
|
||||
<?php
|
||||
function brokenTrace($arg1, &$arg2, $arg3){
|
||||
backtraceWrapper();
|
||||
var_dump(func_get_args());
|
||||
unset($arg3);
|
||||
var_dump(func_get_arg(0));
|
||||
var_dump(func_get_arg(1));
|
||||
var_dump(func_get_arg(2));
|
||||
var_dump(func_get_arg(3));
|
||||
backtraceWrapper();
|
||||
unset($arg1);
|
||||
var_dump(func_get_args());
|
||||
backtraceWrapper();
|
||||
unset($arg2);
|
||||
backtraceWrapper();
|
||||
var_dump(func_get_arg(0));
|
||||
var_dump(func_get_arg(1));
|
||||
var_dump(func_get_arg(2));
|
||||
var_dump(func_get_arg(3));
|
||||
}
|
||||
$arg2 = "2nd";
|
||||
brokenTrace("1st", $arg2, "3th", "4th");
|
||||
function backtraceWrapper(){
|
||||
$bt = debug_backtrace();
|
||||
var_dump($bt[1]['args']);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(3) "1st"
|
||||
[1]=>
|
||||
&string(3) "2nd"
|
||||
[2]=>
|
||||
string(3) "3th"
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(3) "1st"
|
||||
[1]=>
|
||||
string(3) "2nd"
|
||||
[2]=>
|
||||
string(3) "3th"
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
string(3) "1st"
|
||||
string(3) "2nd"
|
||||
NULL
|
||||
string(3) "4th"
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "1st"
|
||||
[1]=>
|
||||
&string(3) "2nd"
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
array(2) {
|
||||
[1]=>
|
||||
string(3) "2nd"
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
array(2) {
|
||||
[1]=>
|
||||
&string(3) "2nd"
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(3) "4th"
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
string(3) "4th"
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
|
||||
--FILE--
|
||||
<?php
|
||||
class a {}
|
||||
$x = (new ReflectionFunction("substr"))->getClosure();
|
||||
$x->call(new a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70662: Duplicate array key via undefined index error handler
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = [];
|
||||
set_error_handler(function() use(&$a) {
|
||||
$a['b'] = 2;
|
||||
});
|
||||
$a['b'] += 1;
|
||||
var_dump($a);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["b"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70681: Segfault when binding $this of internal instance method to null
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
|
||||
$c = $c->bindTo(null);
|
||||
|
||||
$c = (new ReflectionFunction('strlen'))->getClosure();
|
||||
$c = $c->bindTo(null);
|
||||
var_dump($c("foo"));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Cannot unbind $this of internal method in %s on line %d
|
||||
int(3)
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70685: Segfault for getClosure() internal method rebind with invalid $this
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class cls {}
|
||||
|
||||
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
|
||||
$c = $c->bindTo(new cls);
|
||||
var_dump($c);
|
||||
|
||||
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
|
||||
$c = $c->bindTo(new SplStack, 'cls');
|
||||
var_dump($c);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Cannot bind internal method SplDoublyLinkedList::count() to object of class cls in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
|
||||
NULL
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70689 (Exception handler does not work as expected)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo($foo) {
|
||||
echo "Executing foo\n";
|
||||
}
|
||||
|
||||
set_error_handler(function($errno, $errstr) {
|
||||
throw new Exception($errstr);
|
||||
});
|
||||
|
||||
try {
|
||||
foo();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Missing argument 1 for foo(), called in %sbug70689.php on line %d and defined
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l)
|
||||
--FILE--
|
||||
<?php
|
||||
$ini = '[${ ';
|
||||
|
||||
$ini_file = __DIR__ . "/bug70748.ini";
|
||||
|
||||
file_put_contents($ini_file, $ini);
|
||||
|
||||
var_dump(parse_ini_file($ini_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . "/bug70748.ini");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: syntax error, unexpected $end, expecting '}' in %sbug70748.ini on line %d
|
||||
in %sbug70748.php on line %d
|
||||
bool(false)
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70782: null ptr deref and segfault (zend_get_class_fetch_type)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
(-0)::$prop;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Illegal class name in %s on line %d
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70785 (Infinite loop due to exception during identical comparison)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($no, $msg) {
|
||||
throw new Exception($msg);
|
||||
});
|
||||
|
||||
try {
|
||||
if ($a === null) { // ZEND_VM_SMART_BRANCH
|
||||
undefined_function('Null');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
try {
|
||||
$c === 3; // ZEND_VM_NEXT_OPCODE
|
||||
undefined_function();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
?>
|
||||
okey
|
||||
--EXPECT--
|
||||
okey
|
||||
@@ -1,17 +0,0 @@
|
||||
--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)
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70805 (Segmentation faults whilst running Drupal 8 test suite)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
}
|
||||
|
||||
class B {
|
||||
}
|
||||
|
||||
class C {
|
||||
public function __destruct() {
|
||||
if (isset($GLOBALS["a"])) {
|
||||
unset($GLOBALS["array"]);
|
||||
unset($GLOBALS["a"]); // this will be called in gc_colloct_roots and put $a into gc roots buf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->b = new B;
|
||||
$a->b->a = $a;
|
||||
|
||||
$i = 0;
|
||||
|
||||
$c = new A;
|
||||
$array = array($c); //This is used to leave a room for $GLOBALS["a"]
|
||||
unset($c);
|
||||
|
||||
while ($i++ < 9997) {
|
||||
$t = [];
|
||||
$t[] = &$t;
|
||||
unset($t);
|
||||
}
|
||||
$t = [new C];
|
||||
$t[] = &$t;
|
||||
unset($t); // This is used to trigger C::__destruct while doing gc_colloct_roots
|
||||
|
||||
$e = $a;
|
||||
unset($a); // This one can not be putted into roots buf because it's full, thus gc_colloct_roots will be called,
|
||||
// but C::__destructor which is called in gc_colloct_roots will put $a into buf
|
||||
// which will make $a be putted into gc roots buf twice
|
||||
var_dump(gc_collect_cycles());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Crash)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
}
|
||||
|
||||
class B {
|
||||
}
|
||||
|
||||
class C {
|
||||
public function __destruct() {
|
||||
if (isset($GLOBALS["a"])) {
|
||||
unset($GLOBALS["array"]);
|
||||
unset($GLOBALS["a"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->b = new B;
|
||||
$a->b->a = $a;
|
||||
|
||||
$i = 0;
|
||||
|
||||
$c = new A;
|
||||
$array = array($c);
|
||||
unset($c);
|
||||
|
||||
while ($i++ < 9997) {
|
||||
$t = [];
|
||||
$t[] = &$t;
|
||||
unset($t);
|
||||
}
|
||||
$t = [new C];
|
||||
$t[] = &$t;
|
||||
unset($t);
|
||||
unset($a);
|
||||
|
||||
var_dump(gc_collect_cycles());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Memleak)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
}
|
||||
|
||||
class B {
|
||||
}
|
||||
|
||||
class C {
|
||||
public function __destruct() {
|
||||
if (isset($GLOBALS["a"])) {
|
||||
unset($GLOBALS["a"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->b = new B;
|
||||
$a->b->a = $a;
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i++ < 9998) {
|
||||
$t = [];
|
||||
$t[] = &$t;
|
||||
unset($t);
|
||||
}
|
||||
$t = [new C];
|
||||
$t[] = &$t;
|
||||
unset($t);
|
||||
|
||||
unset($a);
|
||||
var_dump(gc_collect_cycles());
|
||||
--EXPECT--
|
||||
int(2)
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70873 (Regression on private static properties access)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
private static $x = 1;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
function bar() {
|
||||
var_dump(self::$x);
|
||||
}
|
||||
};
|
||||
|
||||
class C extends A {
|
||||
function bar() {
|
||||
var_dump(A::$x);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$a = new B;
|
||||
$a->bar();
|
||||
|
||||
$b = new C;
|
||||
$b->bar();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot access property B::$x in %sbug70873.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug70873.php(%d): B->bar()
|
||||
#1 {main}
|
||||
thrown in %sbug70873.php on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70895 null ptr deref and segfault with crafted callable
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
array_map("%n", 0);
|
||||
array_map("%n %i", 0);
|
||||
array_map("%n %i aoeu %f aoeu %p", 0);
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n' not found or invalid function name in .+
|
||||
|
||||
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name in .+
|
||||
|
||||
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name in .+bug70895.php on line \d+
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70895 null ptr deref and segfault with crafted callable
|
||||
--FILE--
|
||||
<?php
|
||||
function m($f,$a){
|
||||
return array_map($f,0);
|
||||
}
|
||||
|
||||
echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name in %sbug70898.php on line %d
|
||||
|
||||
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
|
||||
|
||||
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
|
||||
|
||||
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
|
||||
|
||||
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
|
||||
|
||||
Warning: implode(): Argument must be an array in %sbug70898.php on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70912 (Null ptr dereference when class property is initialised to a dereferenced value)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $a=[][];
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use [] for reading in %sbug70912.php on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70914 zend_throw_or_error() format string vulnerability
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("pdo_sqlite")) {
|
||||
die("skip pdo_sqlite required");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new PDO('sqlite::memory:');
|
||||
$st = $db->query('SELECT 1');
|
||||
$re = $st->fetchObject('%Z');
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Fatal error: Class '%Z' not found in .+bug70914.php on line \d+
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70944 (try{ } finally{} can create infinite chains of exceptions)
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$e = new Exception("Foo");
|
||||
try {
|
||||
throw new Exception("Bar", 0, $e);
|
||||
} finally {
|
||||
throw $e;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
var_dump((string)$e);
|
||||
}
|
||||
|
||||
try {
|
||||
$e = new Exception("Foo");
|
||||
try {
|
||||
throw new Exception("Bar", 0, $e);
|
||||
} finally {
|
||||
throw new Exception("Dummy", 0, $e);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
var_dump((string)$e);
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "Exception: Foo in %sbug70944.php:%d
|
||||
Stack trace:
|
||||
#0 {main}"
|
||||
string(%d) "Exception: Foo in %sbug70944.php:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
|
||||
Next Exception: Dummy in %sbug70944.php:%d
|
||||
Stack trace:
|
||||
#0 {main}"
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70957 (self::class can not be resolved with reflection for abstract class)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
abstract class Foo
|
||||
{
|
||||
function bar($a = self::class) {}
|
||||
}
|
||||
|
||||
trait T {
|
||||
public function bar() {
|
||||
}
|
||||
}
|
||||
|
||||
class B extends Foo
|
||||
{
|
||||
use T;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70958 (Invalid opcode while using ::class as trait method paramater default value)
|
||||
--FILE--
|
||||
<?php
|
||||
trait Foo
|
||||
{
|
||||
function bar($a = self::class) {
|
||||
var_dump($a);
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
use Foo;
|
||||
}
|
||||
|
||||
$b = new B;
|
||||
|
||||
$b->bar();
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "B"
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70967 (Weird error handling for __toString when Error is thrown)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public function __toString() {
|
||||
undefined_function();
|
||||
}
|
||||
}
|
||||
|
||||
echo (new A);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Method A::__toString() must not throw an exception, caught Error: Call to undefined function undefined_function() in %sbug70967.php on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70987 (static::class within Closure::call() causes segfault)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {}
|
||||
$bar = function () {
|
||||
return static::class;
|
||||
};
|
||||
|
||||
var_dump($bar->call(new foo));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(3) "foo"
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70997 (When using parentClass:: instead of parent::, static context changed)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
const TEST = false;
|
||||
|
||||
public function test()
|
||||
{
|
||||
var_dump(static::TEST);
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
const TEST = true;
|
||||
|
||||
public function test()
|
||||
{
|
||||
A::test();
|
||||
}
|
||||
}
|
||||
|
||||
$b = new B;
|
||||
$b->test();
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #71067 (Local object in class method stays in memory for each call)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
error_reporting=0
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function test(){
|
||||
$arr = (object) [
|
||||
'children' => []
|
||||
];
|
||||
$arr->children[] = 1;
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
|
||||
$o = new Test();
|
||||
$o->test();
|
||||
|
||||
print_r($o->test());
|
||||
?>
|
||||
--EXPECT--
|
||||
stdClass Object
|
||||
(
|
||||
[children] => Array
|
||||
(
|
||||
[0] => 1
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #71086: Invalid numeric literal parse error within highlight_string() function
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$highlightedString = highlight_string("<?php \n 09 09 09;", true);
|
||||
var_dump($highlightedString);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(169) "<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php <br /> </span><span style="color: #007700">09 09 09;</span>
|
||||
</span>
|
||||
</code>"
|
||||
@@ -1,19 +0,0 @@
|
||||
--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)
|
||||
@@ -1,25 +0,0 @@
|
||||
--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
|
||||
@@ -1,10 +0,0 @@
|
||||
--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
|
||||
@@ -1,28 +0,0 @@
|
||||
--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
|
||||
@@ -1,27 +0,0 @@
|
||||
--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
|
||||
@@ -1,28 +0,0 @@
|
||||
--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"
|
||||
@@ -1,48 +0,0 @@
|
||||
--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,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #71474: Crash because of VM stack corruption on Magento2
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function __call($name, $args) {
|
||||
$a = $b = $c = $d = $e = $f = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function test($n, $x) {
|
||||
// var_dump($n);
|
||||
if ($n > 0) {
|
||||
$x->bug();
|
||||
test($n - 1, $x);
|
||||
}
|
||||
}
|
||||
|
||||
test(3000, new foo());
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #71529: Variable references on array elements don't work when using count
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = [1];
|
||||
$a[] = &$a[out(count($a) - 1)];
|
||||
var_dump($a);
|
||||
|
||||
function out($what) {
|
||||
var_dump($what);
|
||||
return $what;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
&int(1)
|
||||
[1]=>
|
||||
&int(1)
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type#001
|
||||
callable type hint#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 %s on line %d
|
||||
Deprecated: Non-static method bar::baz() should not be called statically in %scallable_type_hint_001.php on line %d
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "bar"
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type#002 - Reflection
|
||||
callable type hint#002 - Reflection
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
callable type#003
|
||||
callable type hint#003
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -53,9 +53,9 @@ $d = $nonstaticScoped->bindTo(null); $d(); echo "\n";
|
||||
$d->bindTo($d);
|
||||
|
||||
echo "After binding, with same-class instance for the bound ones", "\n";
|
||||
$d = $staticUnscoped->bindTo(new A);
|
||||
$d = $staticUnscoped->bindTo(new A); $d(); echo "\n";
|
||||
$d = $nonstaticUnscoped->bindTo(new A); $d(); echo " (should be scoped to dummy class)\n";
|
||||
$d = $staticScoped->bindTo(new A);
|
||||
$d = $staticScoped->bindTo(new A); $d(); echo "\n";
|
||||
$d = $nonstaticScoped->bindTo(new A); $d(); echo "\n";
|
||||
|
||||
echo "After binding, with different instance for the bound ones", "\n";
|
||||
@@ -87,10 +87,14 @@ After binding, with same-class instance for the bound ones
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
scoped to A: bool(false)
|
||||
bound: no
|
||||
scoped to A: bool(false)
|
||||
bound: A (should be scoped to dummy class)
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
scoped to A: bool(true)
|
||||
bound: no
|
||||
scoped to A: bool(true)
|
||||
bound: A
|
||||
After binding, with different instance for the bound ones
|
||||
scoped to A: bool(false)
|
||||
|
||||
@@ -26,16 +26,16 @@ $d = $staticUnscoped->bindTo(null, null); $d(); echo "\n";
|
||||
$d = $staticScoped->bindTo(null, null); $d(); echo "\n";
|
||||
|
||||
echo "After binding, null scope, with instance", "\n";
|
||||
$d = $staticUnscoped->bindTo(new A, null);
|
||||
$d = $staticScoped->bindTo(new A, null);
|
||||
$d = $staticUnscoped->bindTo(new A, null); $d(); echo "\n";
|
||||
$d = $staticScoped->bindTo(new A, null); $d(); echo "\n";
|
||||
|
||||
echo "After binding, with scope, no instance", "\n";
|
||||
$d = $staticUnscoped->bindTo(null, 'A'); $d(); echo "\n";
|
||||
$d = $staticScoped->bindTo(null, 'A'); $d(); echo "\n";
|
||||
|
||||
echo "After binding, with scope, with instance", "\n";
|
||||
$d = $staticUnscoped->bindTo(new A, 'A');
|
||||
$d = $staticScoped->bindTo(new A, 'A');
|
||||
$d = $staticUnscoped->bindTo(new A, 'A'); $d(); echo "\n";
|
||||
$d = $staticScoped->bindTo(new A, 'A'); $d(); echo "\n";
|
||||
|
||||
echo "Done.\n";
|
||||
|
||||
@@ -57,8 +57,14 @@ bool(false)
|
||||
After binding, null scope, with instance
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
After binding, with scope, no instance
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -69,6 +75,12 @@ bool(false)
|
||||
After binding, with scope, with instance
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
|
||||
Warning: Cannot bind an instance to a static closure in %s on line %d
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
Done.
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Closure 059: Closure type declaration
|
||||
Closure 059: Closure type hinting
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
--TEST--
|
||||
Rebinding of ::getClosure()s
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
use SplDoublyLinkedList as DLL;
|
||||
|
||||
function func($arg) { }
|
||||
|
||||
class Cls {
|
||||
public function method() {}
|
||||
public static function staticMethod($arg) {}
|
||||
}
|
||||
|
||||
class ClsChild extends Cls {}
|
||||
|
||||
class ClsUnrelated {}
|
||||
|
||||
/* Format: [Function, [Obj, Scope]] */
|
||||
$tests = [
|
||||
['func', [
|
||||
[null, null],
|
||||
[new Cls, null],
|
||||
[new Cls, 'Cls'],
|
||||
[null, 'Cls'],
|
||||
[null, 'stdClass'],
|
||||
[new stdClass, null],
|
||||
]],
|
||||
|
||||
['strlen', [
|
||||
[null, null],
|
||||
[new Cls, null],
|
||||
[new Cls, 'Cls'],
|
||||
[null, 'Cls'],
|
||||
[null, 'stdClass'],
|
||||
[new stdClass, null],
|
||||
]],
|
||||
|
||||
[['Cls', 'staticMethod'], [
|
||||
[null, 'Cls'],
|
||||
[new Cls, null],
|
||||
[new Cls, 'Cls'],
|
||||
[null, null],
|
||||
[null, 'ClsChild'],
|
||||
[null, 'ClsUnrelated'],
|
||||
]],
|
||||
|
||||
[[new Cls, 'method'], [
|
||||
[null, 'Cls'],
|
||||
[new Cls, 'Cls'],
|
||||
[new ClsChild, 'Cls'],
|
||||
[new ClsUnrelated, 'Cls'],
|
||||
[new Cls, null],
|
||||
[new Cls, 'ClsUnrelated'],
|
||||
[new Cls, 'ClsChild'],
|
||||
]],
|
||||
|
||||
[[new DLL, 'count'], [
|
||||
[new DLL, DLL::class],
|
||||
[new SplStack, DLL::class],
|
||||
[new ClsUnrelated, DLL::class],
|
||||
[null, null],
|
||||
[null, DLL::class],
|
||||
[new DLL, null],
|
||||
[new DLL, ClsUnrelated::class],
|
||||
]],
|
||||
|
||||
[function() {}, [
|
||||
[null, null],
|
||||
[new Cls, null],
|
||||
[new Cls, 'Cls'],
|
||||
[null, 'Cls'],
|
||||
[null, 'stdClass'],
|
||||
[new stdClass, null],
|
||||
]],
|
||||
];
|
||||
|
||||
set_error_handler(function($errno, $errstr) {
|
||||
echo "$errstr\n\n";
|
||||
});
|
||||
|
||||
foreach ($tests as list($fn, $bindings)) {
|
||||
if (is_array($fn)) {
|
||||
$r = new ReflectionMethod($fn[0], $fn[1]);
|
||||
$c = $r->getClosure(is_object($fn[0]) ? $fn[0] : null);
|
||||
$fnStr = is_object($fn[0]) ? "(new " . get_class($fn[0]) . ")->$fn[1]" : "$fn[0]::$fn[1]";
|
||||
} else {
|
||||
$c = (new ReflectionFunction($fn))->getClosure();
|
||||
$fnStr = $fn;
|
||||
}
|
||||
if ($fn instanceof Closure) {
|
||||
$fnStr = "(function() {})";
|
||||
}
|
||||
|
||||
echo "$fnStr()\n" . str_repeat('-', strlen($fnStr) + 2), "\n\n";
|
||||
|
||||
foreach ($bindings as list($obj, $scope)) {
|
||||
$objStr = $obj ? "new " . get_class($obj) : "null";
|
||||
$scopeStr = $scope ? "$scope::class" : "null";
|
||||
echo "bindTo($objStr, $scopeStr):\n";
|
||||
|
||||
$ret = $c->bindTo($obj, $scope);
|
||||
if ($ret !== null) {
|
||||
echo "Success!\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
func()
|
||||
------
|
||||
|
||||
bindTo(null, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, Cls::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, Cls::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, stdClass::class):
|
||||
Cannot bind closure to scope of internal class stdClass
|
||||
|
||||
bindTo(new stdClass, null):
|
||||
Success!
|
||||
|
||||
strlen()
|
||||
--------
|
||||
|
||||
bindTo(null, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, Cls::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, Cls::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, stdClass::class):
|
||||
Cannot bind closure to scope of internal class stdClass
|
||||
|
||||
bindTo(new stdClass, null):
|
||||
Success!
|
||||
|
||||
Cls::staticMethod()
|
||||
-------------------
|
||||
|
||||
bindTo(null, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, null):
|
||||
Cannot bind an instance to a static closure
|
||||
|
||||
bindTo(new Cls, Cls::class):
|
||||
Cannot bind an instance to a static closure
|
||||
|
||||
bindTo(null, null):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, ClsChild::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(null, ClsUnrelated::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
(new Cls)->method()
|
||||
-------------------
|
||||
|
||||
bindTo(null, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(new ClsChild, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(new ClsUnrelated, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, null):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(new Cls, ClsUnrelated::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(new Cls, ClsChild::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
(new SplDoublyLinkedList)->count()
|
||||
----------------------------------
|
||||
|
||||
bindTo(new SplDoublyLinkedList, SplDoublyLinkedList::class):
|
||||
Success!
|
||||
|
||||
bindTo(new SplStack, SplDoublyLinkedList::class):
|
||||
Success!
|
||||
|
||||
bindTo(new ClsUnrelated, SplDoublyLinkedList::class):
|
||||
Cannot bind internal method SplDoublyLinkedList::count() to object of class ClsUnrelated
|
||||
|
||||
bindTo(null, null):
|
||||
Cannot unbind $this of internal method
|
||||
|
||||
bindTo(null, SplDoublyLinkedList::class):
|
||||
Cannot unbind $this of internal method
|
||||
|
||||
bindTo(new SplDoublyLinkedList, null):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
bindTo(new SplDoublyLinkedList, ClsUnrelated::class):
|
||||
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
|
||||
|
||||
(function() {})()
|
||||
-----------------
|
||||
|
||||
bindTo(null, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, null):
|
||||
Success!
|
||||
|
||||
bindTo(new Cls, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(null, Cls::class):
|
||||
Success!
|
||||
|
||||
bindTo(null, stdClass::class):
|
||||
Cannot bind closure to scope of internal class stdClass
|
||||
|
||||
bindTo(new stdClass, null):
|
||||
Success!
|
||||
@@ -61,7 +61,7 @@ int(0)
|
||||
int(0)
|
||||
int(3)
|
||||
|
||||
Warning: Cannot bind closure to scope of internal class stdClass in %s line %d
|
||||
Warning: Cannot bind closure to object of internal class stdClass in %s line %d
|
||||
NULL
|
||||
int(21)
|
||||
int(3)
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Closure with variadic type declaration
|
||||
Closure with variadic type hint
|
||||
--FILE--
|
||||
<?php
|
||||
$f = function (stdClass ...$a) {
|
||||
@@ -1,52 +0,0 @@
|
||||
--TEST--
|
||||
Concatenating many small strings should not slowdown allocations
|
||||
--SKIPIF--
|
||||
<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?>
|
||||
--INI--
|
||||
memory_limit=256m
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* To note is that memory usage can vary depending on whether opcache is on. The actual
|
||||
measuring that matters is timing here. */
|
||||
|
||||
$time = microtime(TRUE);
|
||||
|
||||
/* This might vary on Linux/Windows, so the worst case and also count in slow machines. */
|
||||
$t0_max = 0.1;
|
||||
$t1_max = 0.4;
|
||||
|
||||
$datas = [];
|
||||
for ($i = 0; $i < 220000; $i++)
|
||||
{
|
||||
$datas[] = [
|
||||
'000.000.000.000',
|
||||
'000.255.255.255',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
'保留地址',
|
||||
];
|
||||
}
|
||||
|
||||
$t0 = microtime(TRUE) - $time;
|
||||
var_dump($t0 < $t0_max);
|
||||
|
||||
|
||||
$texts = '';
|
||||
foreach ($datas AS $data)
|
||||
{
|
||||
$texts .= implode("\t", $data) . "\r\n";
|
||||
}
|
||||
|
||||
$t1 = microtime(TRUE) - $time;
|
||||
var_dump($t1 < $t1_max);
|
||||
|
||||
?>
|
||||
+++DONE+++
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
+++DONE+++
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
errmsg: default value for parameters with array type can only be an array or NULL
|
||||
errmsg: default value for parameters with array type hint 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 can only be an array or NULL in %s on line %d
|
||||
Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Ensure proper backtraces with anon classes
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
(function($obj) {
|
||||
throw new Exception();
|
||||
})(new class {});
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): {closure}(Object(class@anonymous))
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70904 (yield from incorrectly marks valid generator as finished)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function g1() {
|
||||
yield 1;
|
||||
}
|
||||
|
||||
function g2($g1) {
|
||||
yield from $g1;
|
||||
echo "reached!\n";
|
||||
yield 2;
|
||||
}
|
||||
|
||||
$g1 = g1();
|
||||
$g2 = g2($g1);
|
||||
|
||||
var_dump($g2->valid());
|
||||
var_dump($g2->current());
|
||||
$g1->next();
|
||||
var_dump($g1->valid());
|
||||
var_dump($g2->valid());
|
||||
var_dump($g2->current());
|
||||
$g2->next();
|
||||
var_dump($g2->valid());
|
||||
var_dump($g2->current());
|
||||
$g2->next();
|
||||
var_dump($g2->valid());
|
||||
var_dump($g2->current());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(1)
|
||||
bool(false)
|
||||
bool(true)
|
||||
int(1)
|
||||
reached!
|
||||
bool(true)
|
||||
int(2)
|
||||
bool(false)
|
||||
NULL
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70965 (yield from with a common iterator primes too much)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function it() {
|
||||
yield from [1, 2, 3, 4, 5];
|
||||
}
|
||||
|
||||
function bar($g) {
|
||||
yield from $g;
|
||||
}
|
||||
|
||||
$gen = it();
|
||||
$gens[] = bar($gen);
|
||||
$gens[] = bar($gen);
|
||||
|
||||
do {
|
||||
foreach($gens as $g) {
|
||||
var_dump($g->current());
|
||||
$gen->next();
|
||||
}
|
||||
} while ($gen->valid());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
int(5)
|
||||
int(5)
|
||||
Loaded 100 of 1752 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user