Compare commits

..
Author SHA1 Message Date
Julien Pauli f89ee8040a 5.5.17 2014-09-16 14:52:45 +02:00
Remi Collet e1f52b5af9 backported 2775dc2b44 2014-09-16 14:30:39 +02:00
Julien Pauli 3e0ab2a6f3 5.5.17RC1 2014-09-03 10:15:48 +02:00
3198 changed files with 156006 additions and 330352 deletions

No files matched your search

-16
View File
@@ -1,16 +0,0 @@
; http://editorconfig.org/
root = true
[*.{c,h}]
charset = UTF-8
end_of_line = LF
indent_size = 4
indent_style = tab
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true
[*.yml]
indent_size = 2
indent_style = space
+2 -2
View File
@@ -106,7 +106,7 @@ define dump_bt
printf "%ld", $zvalue->value.lval
end
if $type == 2
printf "%f", $zvalue->value.dval
printf "%lf", $zvalue->value.dval
end
if $type == 3
if $zvalue->value.lval
@@ -185,7 +185,7 @@ define ____printzv_contents
printf "long: %ld", $zvalue->value.lval
end
if $type == 2
printf "double: %f", $zvalue->value.dval
printf "double: %lf", $zvalue->value.dval
end
if $type == 3
printf "bool: "
+4 -7
View File
@@ -19,10 +19,6 @@
*.tgz
*.tar.gz
*.tar.bz2
*.tar.xz
*.tar.gz.asc
*.tar.bz2.asc
*.tar.xz.asc
.FBCIndex
.FBCLockFolder
.deps
@@ -135,7 +131,6 @@ tests/*/*.sh
*/tests/*/*.sh
*/*/tests/*.diff
*/*/tests/*.out
*/*/tests/*.out.png
*/*/tests/*.php
*/*/tests/*.exp
*/*/tests/*.log
@@ -220,6 +215,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
@@ -247,8 +246,6 @@ sapi/fpm/php-fpm.1
sapi/fpm/init.d.php-fpm
sapi/fpm/php-fpm.conf
sapi/fpm/fpm/php-cgi
sapi/phpdbg/phpdbg_parser.c
sapi/phpdbg/phpdbg_parser.h
sapi/phpdbg/phpdbg
scripts/php-config
scripts/phpize
+10 -26
View File
@@ -1,30 +1,12 @@
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
language: php
php:
# We only specify one version so we only get one worker
- 5.4
notifications:
email:
on_failure: change
irc:
template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
channels:
- "irc.efnet.org#php.pecl"
on_success: change
on_failure: always
cache:
- apt
@@ -42,6 +24,10 @@ env:
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
before_install:
- sudo cp ./travis/de /var/lib/locales/supported.d/de
- sudo dpkg-reconfigure locales
before_script:
# Compile PHP
- ./travis/compile.sh
@@ -53,6 +39,4 @@ before_script:
- . ./travis/ext/pdo_pgsql/setup.sh
# Run PHPs run-tests.php
script:
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --set-timeout 120
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
+2 -5
View File
@@ -42,7 +42,7 @@ Exceptions:
4. When writing functions that deal with strings, be sure to remember
that PHP holds the length property of each string, and that it
shouldn't be calculated with strlen(). Write your functions in such
shouldn't be calculated with strlen(). Write your functions in a such
a way so that they'll take advantage of the length property, both
for efficiency and in order for them to be binary-safe.
Functions that change strings and obtain their new lengths while
@@ -279,10 +279,7 @@ The file labelled 'EXPERIMENTAL' should include the following
information::
Any authoring information (known bugs, future directions of the module).
Ongoing status notes which may not be appropriate for Git comments.
In general new features should go to PECL or experimental branches until
there are specific reasons for directly adding it to the core distribution.
Ongoing status notes which may not be appropriate for SVN comments.
Aliases & Legacy Documentation
-----------------------------------
+3 -15
View File
@@ -181,8 +181,8 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_dblib
PRIMARY MAINTAINER: Adam Baratz <adambaratz@php.net>
MAINTENANCE: Maintained
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
@@ -205,7 +205,7 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_oci
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net>
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
@@ -385,12 +385,6 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.4
-------------------------------------------------------------------------------
EXTENSION: hash
PRIMARY MAINTAINER: Sara Golemon <pollita@php.net>, Mike Wallner <mike@php.net>, Anatol Belski <ab@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.1.2
-------------------------------------------------------------------------------
EXTENSION: iconv
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
MAINTENANCE: Maintained
@@ -444,12 +438,6 @@ PRIMARY MAINTAINER: Frank M. Kromann
MAINTENANCE: Unknown
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: opcache
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>, Xinchen Hui <laruence@php.net>
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.5.0
-------------------------------------------------------------------------------
EXTENSION: openssl
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>, Pierre-Alain Joye <pajoye@php.net>
MAINTENANCE: Maintained
+1 -1
View File
@@ -155,7 +155,7 @@ Table of Contents
a list of all available options along with short explanations running
./configure --help. Our manual documents the different options
separately. You will find the core options in the appendix, while the
different extension specific options are described on the reference
different extension specific options are descibed on the reference
pages.
When PHP is configured, you are ready to build the module and/or
+1 -1
View File
@@ -1,6 +1,6 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2016 The PHP Group. All rights reserved.
Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -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; \
+2 -2
View File
@@ -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"`; \
@@ -120,7 +120,7 @@ clean:
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f php5.spec main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/mysqlnd/php_mysqlnd_config.h
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
+55 -2444
View File
File diff suppressed because it is too large. Load diff
+47
View File
@@ -0,0 +1,47 @@
This file describes extension module API details. Refer to
README.EXT_SKEL to create extension skeleton files. Refer to
Hacker's Guide for PHP internals.
http://www.php.net/manual/en/internals2.php
Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
that broke both source and binary compatibility. If you are
maintaining a third party extension, here's how to update it:
If this was your old module entry:
zend_module_entry foo_module_entry = {
"foo", /* extension name */
foo_functions, /* extension function list */
NULL, /* extension-wide startup function */
NULL, /* extension-wide shutdown function */
PHP_RINIT(foo), /* per-request startup function */
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
PHP_MINFO(foo), /* information function */
STANDARD_MODULE_PROPERTIES
};
Here's how it should look if you want your code to build with PHP
4.1.0 and up:
zend_module_entry foo_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"foo", /* extension name */
foo_functions, /* extension function list */
NULL, /* extension-wide startup function */
NULL, /* extension-wide shutdown function */
PHP_RINIT(foo), /* per-request startup function */
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
PHP_MINFO(foo), /* information function */
#if ZEND_MODULE_API_NO >= 20010901
PHP_FOO_VERSION, /* extension version number (string) */
#endif
STANDARD_MODULE_PROPERTIES
};
If you don't care about source compatibility with earlier PHP releases
than 4.1.0, you can drop the #if/#endif lines.
+6 -6
View File
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
some basic rules with regards to Git usage will::
a. Make everybody happier, especially those responsible for maintaining
PHP itself.
Git itself.
b. Keep the changes consistently well documented and easily trackable.
@@ -48,11 +48,11 @@ Currently we have the following branches in use::
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
stable version and is open for security fixes only.
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
stable version and is open for security fixes only.
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
stable version and is open for bugfixes only.
PHP-5.3 This branch is closed.
@@ -67,7 +67,7 @@ Currently we have the following branches in use::
The next few rules are more of a technical nature::
1. All changes should first go to the lowest branch (i.e. 5.6) and then
1. All changes should first go to the lowest branch (i.e. 5.4) and then
get merged up to all other branches. If a change is not needed for
later branches (i.e. fixes for features which where dropped from later
branches) an empty merge should be done.
+155
View File
@@ -0,0 +1,155 @@
1. strrpos() and strripos() now use the entire string as a needle. Be aware
that the existing scripts may no longer work as you expect.
EX :
<?php
var_dump(strrpos("ABCDEF","DEF"));
var_dump(strrpos("ABCDEF","DAF"));
?>
Will give you different results. The former returns 3 while the latter
returns false rather than the position of the last occurrence of 'D'.
The same applies to strripos().
2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
EX :
<?php
$a = "foo";
unset($a[0][1][2]);
?>
Fatal error: Cannot use string offset as an array in ... on line 1
3. array_merge() was changed to accept only arrays. If a non-array variable is
passed, a E_WARNING will be thrown for every such parameter. Be careful
because your code may start emitting E_WARNING out of the blue.
4. Be careful when porting from ext/mysql to ext/mysqli. The following
functions return NULL when no more data is available in the result set
(ext/mysql's functions return FALSE).
- mysqli_fetch_row()
- mysqli_fetch_array()
- mysqli_fetch_assoc()
5. PATH_TRANSLATED server variable is no longer set implicitly under
Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
same value as the SCRIPT_FILENAME server variable when it is not populated
by Apache. This change was made to comply with the CGI specification.
Please refer to bug #23610 for further information.
6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
ext/tokenizer extension. If error_reporting is set to E_ALL notices will
be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
is used, thus both // and /* */ are resolved as the T_COMMENT constant.
However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
by PHP, are recongnized as T_DOC_COMMENT.
7. $_SERVER should be populated with argc and argv if variables_order
includes "S". If you have specifically configured your system to not
create $_SERVER, then of course it shouldn't be there. The change was to
always make argc and argv available in the CLI version regardless of the
variables_order setting. As in, the CLI version will now always populate
the global $argc and $argv variables.
8. In some cases classes must be declared before used. It only happens only
if some of the new features of PHP 5 are used. Otherwise the behaviour is
the old.
Example 1 (works with no errors):
<?php
$a = new a();
class a {
}
?>
Example 2 (throws an error):
<?php
$a = new a();
interface b{
}
class a implements b {
}
?>
Output (example 2) :
Fatal error: Class 'a' not found in /tmp/cl.php on line 2
9. get_class() starting PHP 5 returns the name of the class as it was
declared which may lead to problems in older scripts that rely on
the previous behaviour - the class name is lowercased. Expect the
same behaviour from get_parent_class() when applicable.
Example :
<?php
class FooBar {
}
class ExtFooBar extends FooBar{}
$a = new FooBar();
var_dump(get_class($a), get_parent_class($a));
?>
Output (PHP 4):
string(6) "foobar"
string(9) "extfoobar"
Output (PHP 5):
string(6) "FooBar"
string(9) "ExtFooBar"
----------------------------------------------------------------------
Example code that will break :
//....
function someMethod($p) {
if (get_class($p) != 'helpingclass') {
return FALSE;
}
//...
}
//...
Possible solution is to search for get_class() and get_parent_class() in
all your scripts and use strtolower().
10. get_class_methods() returns the names of the methods of a class as they
declared. In PHP4 the names are all lowercased.
Example code :
<?php
class Foo{
function doFoo(){}
function hasFoo(){}
}
var_dump(get_class_methods("Foo"));
?>
Output (PHP4):
array(2) {
[0]=>
string(5) "dofoo"
[1]=>
string(6) "hasfoo"
}
Output (PHP5):
array(2) {
[0]=>
string(5) "doFoo"
[1]=>
string(6) "hasFoo"
}
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
meaning in class methods and is recognized by the PHP parser. The latter
will generate a parse error when assignment to $this is found
Example code :
<?php
class Foo {
function assignNew($obj) {
$this = $obj;
}
}
$a = new Foo();
$b = new Foo();
$a->assignNew($b);
echo "I was executed\n";
?>
Output (PHP 4):
I was executed
Output (PHP 5):
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
+10 -21
View File
@@ -196,11 +196,11 @@ last commit id to web/php.git, then, mirrors will now sync
Getting the stable release announced
------------------------------------
1. Update phpweb/include/releases.inc with the old release info
(updates the download archives)
1. Run the bumpRelease script for phpweb on your local checkout
a. You can run ``php bin/bumpRelease 5`` if you are making a release for the
highest branch, otherwise you have to do this manually, see point 1.b
a. ``php bin/bumpRelease 5`` to create the release file (releases/x_y_z.php)
The release announcement file should list in detail security fixes and
changes in behavior (whether due to a bug fix or not).
b. In case multiple PHP minor versions are in active development you have
to manually copy the old information to include/releases.inc
@@ -213,18 +213,15 @@ Getting the stable release announced
c. ``$PHP_X_MD5`` array and update all the md5 sums
d. ``$PHP_X_SHA256`` array and update all the SHA256 sums
d. set ``$PHP_X_RC`` to false!
e. set ``$PHP_X_RC`` to false!
f. Make sure there are no outdated "notes" or edited "date" keys in the
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
g. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
3. Create the release file (releases/x_y_z.php)
Usually we use the same content as for point 6, but included in php template
instead of the release xml.
3. Update phpweb/include/releases.php with the old release info
(updates the download archives)
4. Update php-qa/include/release-qa.php and add the next version as an QARELEASE
(prepare for next RC)
@@ -269,9 +266,6 @@ to upgrade.
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
http://news.php.net/php.internals/17222.
Please make sure that the mail to php-announce@ is its own completely seperate email.
This is to make sure that repiles to the announcement on php-general@ or internals@
will not accidentally hit the php-announce@ mailinglist.
Re-releasing the same version (or -pl)
--------------------------------------
@@ -288,9 +282,7 @@ Re-releasing the same version (or -pl)
d. ``$PHP_X_MD5`` array and update all the md5 sums
e. ``$PHP_X_SHA256`` array and update all the SHA256 sums
f. Make sure there are no outdated "notes" or edited "date" keys in the
e. Make sure there are no outdated "notes" or edited "date" keys in the
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
3. Add a short notice to phpweb stating that there is a new release, and
@@ -307,6 +299,3 @@ to upgrade.
5. Wait an hour or two, then send a mail to php-announce@lists.php.net,
php-general@lists.php.net and internals@lists.php.net with a text similar to
the news entry.
Please make sure that the mail to php-announce@ is its own completely seperate email.
This is to make sure that repiles to the announcement on php-general@ or internals@
will not accidentally hit the php-announce@ mailinglist.
+1 -1
View File
@@ -46,7 +46,7 @@ Opening Streams
===============
In most cases, you should use this API:
PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
int options, char **opened_path TSRMLS_DC);
Where:
+14 -14
View File
@@ -5,7 +5,7 @@ This document describes how to submit an enhancement or patch for PHP.
It's easy!
You don't need any login accounts or special access to download,
build, debug and begin submitting PHP or PECL code, tests or
build, debug and begin submitting PHP, PECL or PEAR code, tests or
documentation. Once you've followed this README and had several
patches accepted, commit privileges are often quickly granted.
@@ -16,8 +16,8 @@ http://phpadvent.org/2008/less-whining-more-coding-by-elizabeth-smith
Online Forums
-------------
There are several IRC channels where PHP developers are often
available to discuss questions. They include #php.pecl and #php.doc
on the EFNet network and #php-dev-win on FreeNode.
available to discuss questions. They include #php.pecl, #php.doc and
#pear on the EFNet network and #php-dev-win on FreeNode.
PHP Patches
@@ -89,7 +89,7 @@ of type 'text/*' are accepted.
PECL Extension Patches: http://pecl.php.net/
--------------------------------------------
If you are fixing broken functionality in a PECL extension then create
a bug or identify an existing bug at http://bugs.php.net/. A bug
a bug or identify an existing bug at http://pecl.php.net/bugs/. A bug
can be used to track the patch progress and prevent your changes
getting lost in the PHP mail archives.
@@ -125,15 +125,15 @@ http://pear.php.net/manual/en/guide-developers.php
How to create your PHP, PHP Documentation or PECL patch
-------------------------------------------------------
PHP and most PECL packages use Git for revision control. Some PECL
packages use Subversion (SVN) Read http://www.php.net/git.php for help
on using Git to get and build PHP source code. We recommend to look
at our workflow on https://wiki.php.net/vcs/gitworkflow and our FAQ
https://wiki.php.net/vcs/gitfaq.
PHP and PECL use Subversion (SVN) for revision control. Read
http://www.php.net/svn.php for help on using SVN to get and build PHP
source code. We recommend using a Sparse Directory checkout described
in http://wiki.php.net/vcs/svnfaq. If you are new to SVN, read
http://svnbook.red-bean.com.
Generally we ask that bug fix patches work on the current stable PHP
development branches and on "master". New PHP features only need to
work on "master".
development branches and on "trunk". New PHP features only need to
work on "trunk".
Read CODING_STANDARDS before you start working.
@@ -145,7 +145,7 @@ comprehensive.
After testing is finished, create a patch file using the command:
git diff > your_patch.txt
svn diff > your_patch.txt
For ease of review and later troubleshooting, submit individual
patches for each bug or feature.
@@ -153,7 +153,7 @@ patches for each bug or feature.
Checklist for submitting your PHP or PECL code patch
----------------------------------------------------
- Update git source just before running your final 'diff' and
- Update SVN source just before running your final 'diff' and
before testing.
- Add in-line comments and/or have external documentation ready.
Use only "/* */" style comments, not "//".
@@ -186,7 +186,7 @@ about these questions:
What happens when your PHP or PECL patch is applied
---------------------------------------------------
Your name will likely be included in the Git commit log. If your
Your name will likely be included in the SVN commit log. If your
patch affects end users, a brief description and your name might be
added to the NEWS file.
+3 -3
View File
@@ -8,7 +8,7 @@ the original run-tests.php script. server-tests is *not* used by
'make test'. server-tests was developed to provide support for
testing PHP under it's primary environment, HTTP, and can run the
PHP tests under any of the SAPI modules that are direct executables,
or are accessible via HTTP.
or are accessable via HTTP.
[New features]
----------------
@@ -95,7 +95,7 @@ include:
$filename full native path to file, will become PATH_TRANSLATED
$filepath =dirname($filename)
$scriptname this is what will become SCRIPT_NAME unless you override it
$docroot the equivalent of DOCUMENT_ROOT under Apache
$docroot the equivelant of DOCUMENT_ROOT under Apache
$cwd the directory that the test is being initiated from
$this->conf all server-tests configuration vars
$this->env all environment variables that will get passed to the test
@@ -105,7 +105,7 @@ include:
This section is also eval'd, and is similar in nature to --ENV--. However,
this section is used to build the url used in an HTTP request. Valid values
to set in this section would include:
SCRIPT_NAME The initial part of the request url
SCRIPT_NAME The inital part of the request url
PATH_INFO The pathinfo part of a request url
FRAGMENT The fragment section of a url (after #)
QUERY_STRING The query part of a url (after ?)
+1 -1
View File
@@ -1,6 +1,6 @@
## process this file with automake to produce Makefile.am
AUTOMAKE_OPTIONS=foreign
noinst_LTLIBRARIES=libtsrm.la
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
depend:
+8
View File
@@ -143,6 +143,10 @@ SOURCE=.\tsrm_strtok_r.c
# End Source File
# Begin Source File
SOURCE=.\tsrm_virtual_cwd.c
# End Source File
# Begin Source File
SOURCE=.\tsrm_win32.c
# End Source File
# End Group
@@ -171,6 +175,10 @@ SOURCE=.\tsrm_strtok_r.h
# End Source File
# Begin Source File
SOURCE=.\tsrm_virtual_cwd.h
# End Source File
# Begin Source File
SOURCE=.\tsrm_win32.h
# End Source File
# End Group
+1 -1
View File
@@ -1,5 +1,5 @@
// vim:ft=javascript
// $Id$
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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 |
@@ -30,8 +30,7 @@
#include <fcntl.h>
#include <time.h>
#include "zend.h"
#include "zend_virtual_cwd.h"
#include "tsrm_virtual_cwd.h"
#include "tsrm_strtok_r.h"
#ifdef TSRM_WIN32
@@ -127,6 +126,7 @@ static int php_check_dots(const char *element, int n)
#define TOKENIZER_STRING "/"
#endif
/* default macros */
#ifndef IS_DIRECTORY_UP
@@ -149,21 +149,11 @@ static int php_check_dots(const char *element, int n)
#define CWD_STATE_COPY(d, s) \
(d)->cwd_length = (s)->cwd_length; \
(d)->cwd = (char *) emalloc((s)->cwd_length+1); \
(d)->cwd = (char *) malloc((s)->cwd_length+1); \
memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
#define CWD_STATE_FREE(s) \
efree((s)->cwd);
#ifdef TSRM_WIN32
# define CWD_STATE_FREE_ERR(state) do { \
DWORD last_error = GetLastError(); \
CWD_STATE_FREE(state); \
SetLastError(last_error); \
} while (0)
#else
# define CWD_STATE_FREE_ERR(state) CWD_STATE_FREE(state)
#endif
free((s)->cwd);
#ifdef TSRM_WIN32
@@ -261,7 +251,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
}
dwRet = pGetFinalPathNameByHandle(hFile, target, MAXPATHLEN, VOLUME_NAME_DOS);
if(dwRet >= MAXPATHLEN || dwRet == 0) {
if(dwRet >= MAXPATHLEN) {
return -1;
}
@@ -296,7 +286,6 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
WIN32_FILE_ATTRIBUTE_DATA data;
__int64 t;
const size_t path_len = strlen(path);
ALLOCA_FLAG(use_heap_large);
if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) {
return stat(path, buf);
@@ -348,15 +337,16 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
HANDLE hLink = NULL;
REPARSE_DATA_BUFFER * pbuffer;
unsigned int retlength = 0;
TSRM_ALLOCA_FLAG(use_heap_large);
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
if(hLink == INVALID_HANDLE_VALUE) {
return -1;
}
pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
CloseHandle(hLink);
return -1;
}
@@ -373,7 +363,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
buf->st_mode |=;
}
#endif
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
} else {
buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
@@ -439,6 +429,7 @@ static void cwd_globals_ctor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */
static void cwd_globals_dtor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */
{
CWD_STATE_FREE(&cwd_g->cwd);
realpath_cache_clean(TSRMLS_C);
}
/* }}} */
@@ -499,25 +490,6 @@ CWD_API void virtual_cwd_shutdown(void) /* {{{ */
}
/* }}} */
CWD_API int virtual_cwd_activate(TSRMLS_D) /* {{{ */
{
if (CWDG(cwd).cwd == NULL) {
CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state);
}
return 0;
}
/* }}} */
CWD_API int virtual_cwd_deactivate(TSRMLS_D) /* {{{ */
{
if (CWDG(cwd).cwd != NULL) {
CWD_STATE_FREE(&CWDG(cwd));
CWDG(cwd).cwd = NULL;
}
return 0;
}
/* }}} */
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
{
cwd_state *state;
@@ -528,7 +500,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
char *retval;
*length = 1;
retval = (char *) emalloc(2);
retval = (char *) malloc(2);
if (retval == NULL) {
return NULL;
}
@@ -543,7 +515,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
char *retval;
*length = state->cwd_length+1;
retval = (char *) emalloc(*length+1);
retval = (char *) malloc(*length+1);
if (retval == NULL) {
return NULL;
}
@@ -555,7 +527,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
}
#endif
*length = state->cwd_length;
return estrdup(state->cwd);
return strdup(state->cwd);
}
/* }}} */
@@ -571,12 +543,12 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */
return cwd;
}
if (length > size-1) {
efree(cwd);
free(cwd);
errno = ERANGE; /* Is this OK? */
return NULL;
}
memcpy(buf, cwd, length+1);
efree(cwd);
free(cwd);
return buf;
}
/* }}} */
@@ -587,14 +559,12 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS
register unsigned long h;
char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC);
char *bucket_key = (char *)bucket_key_start;
const char *e;
const char *e = bucket_key + strlen(bucket_key);
if (!bucket_key) {
return 0;
}
e = bucket_key + strlen(bucket_key);
for (h = 2166136261U; bucket_key < e;) {
h *= 16777619;
h ^= *bucket_key++;
@@ -651,14 +621,14 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
memcmp(path, (*bucket)->path, path_len) == 0) {
realpath_cache_bucket *r = *bucket;
*bucket = (*bucket)->next;
/* if the pointers match then only subtract the length of the path */
if(r->path == r->realpath) {
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
} else {
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
}
free(r);
return;
} else {
@@ -734,7 +704,7 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
realpath_cache_bucket *r = *bucket;
*bucket = (*bucket)->next;
/* if the pointers match then only subtract the length of the path */
/* if the pointers match then only subtract the length of the path */
if(r->path == r->realpath) {
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
} else {
@@ -784,13 +754,13 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
#ifdef TSRM_WIN32
WIN32_FIND_DATA data;
HANDLE hFind;
ALLOCA_FLAG(use_heap_large)
TSRM_ALLOCA_FLAG(use_heap_large)
#else
struct stat st;
#endif
realpath_cache_bucket *bucket;
char *tmp;
ALLOCA_FLAG(use_heap)
TSRM_ALLOCA_FLAG(use_heap)
while (1) {
if (len <= start) {
@@ -890,7 +860,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
FindClose(hFind);
}
tmp = do_alloca(len+1, use_heap);
tmp = tsrm_do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1);
if(save &&
@@ -917,13 +887,12 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
return -1;
}
pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
if (pbuffer == NULL) {
CloseHandle(hLink);
return -1;
}
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
CloseHandle(hLink);
return -1;
}
@@ -939,7 +908,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
printname_len + 1,
printname, MAX_PATH, NULL, NULL
)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
return -1;
};
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
@@ -951,7 +920,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
substitutename_len + 1,
substitutename, MAX_PATH, NULL, NULL
)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
return -1;
};
substitutename[substitutename_len] = 0;
@@ -965,7 +934,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
printname_len + 1,
printname, MAX_PATH, NULL, NULL
)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
return -1;
};
printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0;
@@ -976,7 +945,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
substitutename_len + 1,
substitutename, MAX_PATH, NULL, NULL
)) {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
return -1;
};
substitutename[substitutename_len] = 0;
@@ -986,7 +955,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
memcpy(substitutename, path, len + 1);
substitutename_len = len;
} else {
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
return -1;
}
@@ -1030,21 +999,21 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
fprintf(stderr, "sub: %s ", substitutename);
fprintf(stderr, "resolved: %s ", path);
#endif
free_alloca(pbuffer, use_heap_large);
tsrm_free_alloca(pbuffer, use_heap_large);
if(isabsolute == 1) {
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
/* use_realpath is 0 in the call below coz path is absolute*/
j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC);
if(j < 0) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
}
}
else {
if(i + j >= MAXPATHLEN - 1) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
@@ -1053,7 +1022,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
path[i-1] = DEFAULT_SLASH;
j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
if(j < 0) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
}
@@ -1074,7 +1043,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
#elif defined(NETWARE)
save = 0;
tmp = do_alloca(len+1, use_heap);
tmp = tsrm_do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1);
#else
if (save && php_sys_lstat(path, &st) < 0) {
@@ -1086,25 +1055,25 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
save = 0;
}
tmp = do_alloca(len+1, use_heap);
tmp = tsrm_do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1);
if (save && S_ISLNK(st.st_mode)) {
if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) {
/* too many links or broken symlinks */
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
path[j] = 0;
if (IS_ABSOLUTE_PATH(path, j)) {
j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
if (j < 0) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
} else {
if (i + j >= MAXPATHLEN-1) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1; /* buffer overflow */
}
memmove(path+i, path, j+1);
@@ -1112,7 +1081,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
path[i-1] = DEFAULT_SLASH;
j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
if (j < 0) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
}
@@ -1127,7 +1096,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
}
if (is_dir && !directory) {
/* not a directory */
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
}
@@ -1143,7 +1112,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
}
#ifdef TSRM_WIN32
if (j < 0 || j + len - i >= MAXPATHLEN-1) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
if (save) {
@@ -1158,7 +1127,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
}
#else
if (j < 0 || j + len - i >= MAXPATHLEN-1) {
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return -1;
}
memcpy(path+j, tmp+i, len-i+1);
@@ -1171,7 +1140,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC);
}
free_alloca(tmp, use_heap);
tsrm_free_alloca(tmp, use_heap);
return j;
}
}
@@ -1190,7 +1159,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
int add_slash;
void *tmp;
if (path_length <= 0 || path_length >= MAXPATHLEN-1) {
if (path_length == 0 || path_length >= MAXPATHLEN-1) {
#ifdef TSRM_WIN32
# if _MSC_VER < 1300
errno = EINVAL;
@@ -1347,7 +1316,7 @@ verify:
CWD_STATE_COPY(&old_state, state);
state->cwd_length = path_length;
tmp = erealloc(state->cwd, state->cwd_length+1);
tmp = realloc(state->cwd, state->cwd_length+1);
if (tmp == NULL) {
#if VIRTUAL_CWD_DEBUG
fprintf (stderr, "Out of memory\n");
@@ -1367,7 +1336,7 @@ verify:
}
} else {
state->cwd_length = path_length;
tmp = erealloc(state->cwd, state->cwd_length+1);
tmp = realloc(state->cwd, state->cwd_length+1);
if (tmp == NULL) {
#if VIRTUAL_CWD_DEBUG
fprintf (stderr, "Out of memory\n");
@@ -1398,7 +1367,7 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
int length = strlen(path);
char *temp;
int retval;
ALLOCA_FLAG(use_heap)
TSRM_ALLOCA_FLAG(use_heap)
if (length == 0) {
return 1; /* Can't cd to empty string */
@@ -1415,14 +1384,14 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
length++;
}
temp = (char *) do_alloca(length+1, use_heap);
temp = (char *) tsrm_do_alloca(length+1, use_heap);
memcpy(temp, path, length);
temp[length] = 0;
#if VIRTUAL_CWD_DEBUG
fprintf (stderr, "Changing directory to %s\n", temp);
#endif
retval = p_chdir(temp TSRMLS_CC);
free_alloca(temp, use_heap);
tsrm_free_alloca(temp, use_heap);
return retval;
}
/* }}} */
@@ -1435,7 +1404,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
/* realpath("") returns CWD */
if (!*path) {
new_state.cwd = (char*)emalloc(1);
new_state.cwd = (char*)malloc(1);
if (new_state.cwd == NULL) {
retval = NULL;
goto end;
@@ -1448,7 +1417,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
} else if (!IS_ABSOLUTE_PATH(path, strlen(path))) {
CWD_STATE_COPY(&new_state, &CWDG(cwd));
} else {
new_state.cwd = (char*)emalloc(1);
new_state.cwd = (char*)malloc(1);
if (new_state.cwd == NULL) {
retval = NULL;
goto end;
@@ -1505,14 +1474,13 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return NULL;
}
f = fopen(new_state.cwd, mode);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return f;
}
/* }}} */
@@ -1524,7 +1492,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
@@ -1534,7 +1502,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
ret = access(new_state.cwd, mode);
#endif
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return ret;
}
@@ -1597,7 +1565,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
@@ -1607,7 +1575,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /
ret = utime(new_state.cwd, buf);
#endif
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return ret;
}
/* }}} */
@@ -1620,13 +1588,13 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
ret = chmod(new_state.cwd, mode);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return ret;
}
/* }}} */
@@ -1639,7 +1607,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
@@ -1653,7 +1621,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
ret = chown(new_state.cwd, owner, group);
}
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return ret;
}
/* }}} */
@@ -1666,7 +1634,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
@@ -1682,7 +1650,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
} else {
f = open(new_state.cwd, flags);
}
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return f;
}
/* }}} */
@@ -1694,18 +1662,18 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
f = creat(new_state.cwd, mode);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return f;
}
/* }}} */
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /* {{{ */
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) /* {{{ */
{
cwd_state old_state;
cwd_state new_state;
@@ -1713,15 +1681,15 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /
CWD_STATE_COPY(&old_state, &CWDG(cwd));
if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&old_state);
CWD_STATE_FREE(&old_state);
return -1;
}
oldname = old_state.cwd;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, newname, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&old_state);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&old_state);
CWD_STATE_FREE(&new_state);
return -1;
}
newname = new_state.cwd;
@@ -1735,8 +1703,8 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /
retval = rename(oldname, newname);
#endif
CWD_STATE_FREE_ERR(&old_state);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&old_state);
CWD_STATE_FREE(&new_state);
return retval;
}
@@ -1749,13 +1717,13 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
retval = php_sys_stat(new_state.cwd, buf);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1767,13 +1735,13 @@ CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ *
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
retval = php_sys_lstat(new_state.cwd, buf);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1785,13 +1753,13 @@ CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
retval = unlink(new_state.cwd);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1803,7 +1771,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, pathname, NULL, CWD_FILEPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
@@ -1812,7 +1780,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */
#else
retval = mkdir(new_state.cwd, mode);
#endif
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1824,13 +1792,13 @@ CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return -1;
}
retval = rmdir(new_state.cwd);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1846,13 +1814,13 @@ CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) /* {{{ */
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return NULL;
}
retval = opendir(new_state.cwd);
CWD_STATE_FREE_ERR(&new_state);
CWD_STATE_FREE(&new_state);
return retval;
}
/* }}} */
@@ -1896,7 +1864,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
#else /* Unix */
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /* {{{ */
{
size_t command_length;
int command_length;
int dir_length, extra = 0;
char *command_line;
char *ptr, *dir;
@@ -1914,7 +1882,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
dir_length = CWDG(cwd).cwd_length;
dir = CWDG(cwd).cwd;
ptr = command_line = (char *) emalloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1);
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1);
if (!command_line) {
return NULL;
}
@@ -1948,7 +1916,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
memcpy(ptr, command, command_length+1);
retval = popen(command_line, type);
efree(command_line);
free(command_line);
return retval;
}
/* }}} */
@@ -1961,7 +1929,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
/* realpath("") returns CWD */
if (!*path) {
new_state.cwd = (char*)emalloc(1);
new_state.cwd = (char*)malloc(1);
if (new_state.cwd == NULL) {
return NULL;
}
@@ -1972,10 +1940,10 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
}
} else if (!IS_ABSOLUTE_PATH(path, strlen(path)) &&
VCWD_GETCWD(cwd, MAXPATHLEN)) {
new_state.cwd = estrdup(cwd);
new_state.cwd = strdup(cwd);
new_state.cwd_length = strlen(cwd);
} else {
new_state.cwd = (char*)emalloc(1);
new_state.cwd = (char*)malloc(1);
if (new_state.cwd == NULL) {
return NULL;
}
@@ -1984,7 +1952,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
}
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
efree(new_state.cwd);
free(new_state.cwd);
return NULL;
}
@@ -1992,7 +1960,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
int copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length;
memcpy(real_path, new_state.cwd, copy_len);
real_path[copy_len] = '\0';
efree(new_state.cwd);
free(new_state.cwd);
return real_path;
} else {
return new_state.cwd;
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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 |
@@ -151,8 +151,6 @@ typedef int (*verify_path_func)(const cwd_state *);
CWD_API void virtual_cwd_startup(void);
CWD_API void virtual_cwd_shutdown(void);
CWD_API int virtual_cwd_activate(TSRMLS_D);
CWD_API int virtual_cwd_deactivate(TSRMLS_D);
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
@@ -163,7 +161,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC);
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
+4 -20
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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 |
@@ -32,7 +32,7 @@
#ifdef TSRM_WIN32
#include <Sddl.h>
#include "tsrm_win32.h"
#include "zend_virtual_cwd.h"
#include "tsrm_virtual_cwd.h"
#ifdef ZTS
static ts_rsrc_id win32_globals_id;
@@ -616,12 +616,6 @@ TSRM_API int shmget(int key, int size, int flags)
}
} else {
if (flags & IPC_EXCL) {
if (shm_handle) {
CloseHandle(shm_handle);
}
if (info_handle) {
CloseHandle(info_handle);
}
return -1;
}
}
@@ -660,27 +654,17 @@ TSRM_API int shmget(int key, int size, int flags)
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
{
shm_pair *shm = shm_get(key, NULL);
int err;
if (!shm->segment) {
return (void*)-1;
}
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
err = GetLastError();
if (err) {
/* Catch more errors */
if (ERROR_NOT_ENOUGH_MEMORY == err) {
_set_errno(ENOMEM);
}
return (void*)-1;
}
shm->descriptor->shm_atime = time(NULL);
shm->descriptor->shm_lpid = getpid();
shm->descriptor->shm_nattch++;
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
return shm->addr;
}
+1 -1
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2014 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 |
+465 -451
View File
@@ -1,18 +1,20 @@
$Id$
PHP 5.6 UPGRADE NOTES
PHP 5.5 UPGRADE NOTES
1. Backward Incompatible Changes
2. New Features
3. Changes in SAPI modules
4. Deprecated Functionality
5. Changed Functions
6. New Functions
7. New Classes and Interfaces
8. Removed Extensions
9. Other Changes to Extensions
10. New Global Constants
11. Changes to INI File Handling
1. Backward Incompatible Changes
2. New Features
2. Changes in SAPI modules
3. Deprecated Functionality
4. Changed Functions
a. unserialize() change
5. New Functions
6. New Classes and Interfaces
7. Removed Extensions
8. Other Changes to Extensions
9. New Global Constants
10. Changes to INI File Handling
11. Windows Support
12. Other Changes
@@ -20,505 +22,517 @@ PHP 5.6 UPGRADE NOTES
1. Backward Incompatible Changes
========================================
- Core:
By fixing bug #66015 it is no longer possible to overwrite keys in static scalar
arrays. Quick example to illustrate:
class Test {
const FIRST = 1;
public $array = array(
self::FIRST => 'first',
'second',
'third'
);
}
Test::$array will have as expected three array keys (1, 2, 3) and no longer
two (0, 1). self::FIRST will no longer overwrite 'third' having key 1 then,
but will mark the beginning of indexing.
- Dropped Windows XP and 2003 support. (Pierre)
- JSON:
json_decode() no longer accepts non-lowercase variants of lone JSON true,
false or null values. For example, True or FALSE will now cause json_decode to
return NULL and set an error value you can fetch with json_last_error().
This affects JSON texts consisting solely of true, false or null. Text
containing non-lowercase values inside JSON arrays or objects has never been
accepted.
- All internal case insensitivity handling for class, function and constant
names is done according to ASCII rules. Current locale settings are ignored.
- OpenSSL:
To prevent man-in-the-middle attacks against encrypted transfers client
streams now verify peer certificates by default. Previous versions
required users to manually enable peer verification. As a result of this
change, existing code using ssl:// or tls:// stream wrappers (e.g.
file_get_contents(), fsockopen(), stream_socket_client()) may no longer
connect successfully without manually disabling peer verification via the
stream context's "verify_peer" setting. Encrypted transfers delegate to
operating system certificate stores by default if not overridden via the
new openssl.cafile and openssl.cafile ini directives or via call-time SSL
context options, so most users should be unaffected by this transparent
security enhancement. (https://wiki.php.net/rfc/tls-peer-verification)
- self, parent & static keywords now are always case-insensitive (see bug
#60833).
- Mcrypt:
The mcrypt_encrypt(), mcrypt_decrypt() and mcrypt_{MODE}() functions no
longer accept keys or IVs with incorrect sizes. Furthermore an IV is now
required if the used block cipher mode requires it.
- cURL:
Uploads using the @file syntax are now unsupported by default.
- Removed Logo GUIDs: php_logo_guid(), php_egg_logo_guid(),
php_real_logo_guid() and zend_logo_guid()
========================================
2. New Features
========================================
- Added constant scalar expressions syntax.
(https://wiki.php.net/rfc/const_scalar_exprs)
- Support list in foreach. (Laruence)
(http://php.net/foreach#control-structures.foreach.list,
http://wiki.php.net/rfc/foreachlist)
- Added dedicated syntax for variadic functions.
(https://wiki.php.net/rfc/variadics)
- Support "finally" keyword. (Laruence)
(http://php.net/exceptions, http://wiki.php.net/rfc/finally)
- Added support for argument unpacking to complement the variadic syntax.
(https://wiki.php.net/rfc/argument_unpacking)
- Support constant array/string dereferencing. (Laruence)
(http://php.net/manual/en/language.types.array.php,
https://wiki.php.net/rfc/constdereference)
- Added an exponentiation operator (**).
(https://wiki.php.net/rfc/pow-operator)
- Add support for using empty() on the result of function calls and
other expressions. Thus it is now possible to write empty(getArray()),
for example. (http://php.net/manual/en/function.empty.php,
https://wiki.php.net/rfc/empty_isset_exprs)
- Added unified default encoding. default_charset=UTF-8 and functions/extensions
use encoding settings honor default_charset.
- Added generators.
(http://php.net/generators, https://wiki.php.net/rfc/generators)
- The php://input stream is now re-usable and can be used concurrently with
enable_post_data_reading=0.
- ClassName::class syntax returning full class name for a class as a
string constant. (http://php.net/oop5.basic,
https://wiki.php.net/rfc/class_name_scalars)
- Added use function and use const.
(https://wiki.php.net/rfc/use_function)
- Added support for non-scalar Iterator keys in foreach.
(http://php.net/manual/en/control-structures.foreach.php,
https://wiki.php.net/rfc/foreach-non-scalar-keys).
- Added a function for timing attack safe string comparison
(https://wiki.php.net/rfc/timing_attack)
- Bundled Zend OPcache extension to improve performance
(http://php.net/manual/en/book.opcache.php,
https://wiki.php.net/rfc/optimizerplus)
- Added the __debugInfo() magic method to allow userland classes to implement
the get_debug_info API previously available only to extensions.
(https://wiki.php.net/rfc/debug-info)
- Added gost-crypto (CryptoPro S-box) hash algorithm.
- Stream wrappers verify peer certificates and host names by default in
encrypted client streams.
- Added openssl certificate fingerprint support (inclusive stream context
option).
- Added support for SAN x509 extension matching when verifing host names in
encrypted streams.
- Added a range of new SSL context options for improved encrypted stream
server security (https://wiki.php.net/rfc/improved-tls-defaults):
. "honor_cipher_order" allows servers to prioritize cipher suites of their
choosing when negotiating SSL/TLS handshakes.
. "single_ecdh_use" and "single_dh_use" allow for improved forward
secrecy in encrypted stream servers.
. "dh_param" allows specification of pre-generated key generation
parameters when negotiating ephemeral DHE ciphers in stream servers.
. "ecdh_curve" allows stream servers to specify which curve to use when
negotiating ephemeral ECDHE ciphers (defaults to NIST P-256).
. "rsa_key_size" SSL context option gives stream servers control
over the key size (in bits) used when negotiating RSA ciphers.
. "capture_session_meta" if specified stores an array of data describing
the TLS session's protocol/cipher in the "session_meta" SSL context key.
- Added automatic mitigation against client-initated TLS renegotiation DoS
attacks in encrypted server streams. Renegotiation limiting may be
customized via three new SSL context options:
. "reneg_limit" (number of allowed renegotiations per time window)
. "reneg_window" (renegotiation time window in seconds)
. "reneg_limit_callback" (optional notification callback on limiting)
- Encrypted TLS servers now support the server name indication (SNI) TLS
extension via the new "SNI_server_certs" SSL context option.
- Added "crypto_method" SSL context option for use in encrypted streams.
- Added "peer_name" SSL context option to better reflect peer certificate
name matching using SAN extension (replaces deprecated "CN_match").
- Added stream wrapper support when specifying "cafile" SSL context paths.
- Independent peer cert and peer name validation is now available via a new
boolean "verify_peer_name" SSL context option. This option is enabled by
default in encrypted client streams.
- Added protocol-specific tlsv1.0://, tlsv1.1:// and tlsv1.2:// encryption
stream wrappers. tls:// wrapper now supports TLSv1.1 and TLSv1.2 (previously
only supported TLSv1).
- Stream crypto method specification now accepts flags instead of values
allowing support for multiple discrete protocols in a given stream.
- PostgreSQL database connections may now be established asynchronously using
new constants and polling functions in ext/pgsql.
- Non-blocking read/write query behavior now optionally available in database
operations using the ext/pgsql extension.
- Added a simplified password hashing API
(http://php.net/password, https://wiki.php.net/rfc/password_hash)
========================================
3. Changes in SAPI modules
2. Changes in SAPI modules
========================================
- Added phpdbg SAPI.
(https://wiki.php.net/rfc/phpdbg)
- Support for changing the process's title in CLI/CLI-Server
SAPIs. (Keyur)
(http://php.net/manual/en/function.cli-set-process-title.php,
http://php.net/manual/en/function.cli-get-process-title.php,
https://wiki.php.net/rfc/cli_process_title)
- Support for FPM workers changing the apparmor profile through the pool configuration.
(https://wiki.php.net/rfc/fpm_change_hat)
- Support for systemd in php-fpm: Add --with-fpm-systemd option to
report health to systemd, and add systemd_interval option to
configure this. The service can now use Type=notify in the systemd
unit file. (Remi)
- Support for several XML MIME types in the built-in CLI server. For static
files with extensions .xml, .xsl, .xsd the Content-Type header
application/xml is now sent automatically.
========================================
4. Deprecated Functionality
3. Deprecated Functionality
========================================
- Incompatible context calls:
Instance calls from an incompatible context are now deprecated and issue
E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx
- The original MySQL extension is now deprecated and will generate
deprecation warnings when connecting to a database through
mysql_connect(), mysql_pconnect() or by establishing an implicit
connection. Use MySQLi or PDO instead.
- The "CN_match" and "SNI_server_name" SSL context options are deprecated in
favor of the new "peer_name" option. Name verification now checks certificate
SAN names as well as the CN field and the specific name fields are deprecated
to avoid confusion. Their use triggers E_DEPRECATED but continues to work as
before. If specified, the specific values take precedence over the general
"peer_name" value.
- The preg_replace /e modifier is now deprecated. Use
preg_replace_callback instead.
(https://wiki.php.net/rfc/remove_preg_replace_eval_modifier)
- Deprecated PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, an
undocument constant effectively equivalent to PDO::ATTR_EMULATE_PREPARES.
- IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are
deprecated. Use IntlDateFormatter::setTimeZone() or
datefmt_set_timezone() instead.
- Deprecated INIs: Following INIs are deprecated in favour of new
internal_encoding/input_encoding/output_encoding. Refer to "Changes to
encodings in PHP 5.6" in "11. Other Changes" section for more details.
iconv.input_encoding
iconv.output_encoding
iconv.internal_encoding
mbstring.http_input
mbstring.http_output
mbstring.internal_encoding
- mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw
E_DEPRECATED. Their use was already previously discouraged in the
documentation, but that predated the existence of E_DEPRECATED.
========================================
5. Changed Functions
4. Changed Functions
========================================
- cURL:
CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file
do not work unless it is explicitly set to false.
- pack()/unpack() had the following changes, which bring it more in
line with Perl's behavior: - Implemented format character "Z": NULL
padded string, with trailing NULL bytes removed. - Changed format
character "a": this no longer removes trailing NULL bytes. -
Changed format character "A": all trailing ASCII whitespace is now
removed (defined as spaces, tabs, \r, \n and NULL).
curl_setopt() now supports the following nullable settings (>= 5.5.11):
. CURLOPT_CUSTOMREQUEST
. CURLOPT_FTPPORT
. CURLOPT_RANGE
. CURLOPT_FTP_ACCOUNT
. CURLOPT_RTSP_SESSION_ID
. CURLOPT_KRBLEVEL
. CURLOPT_KRB4LEVEL
- MessageFormatter::format() and related functions now accepted named
arguments and mixed numeric/named arguments in ICU 4.8+.
curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
as a string (PHP >= 5.6.25)
- MessageFormatter::format() and related functions now don't error out
when an insufficient argument count is provided. Instead, the
placeholders will remain unsubstituted.
- Strings:
substr_compare() now allows $length to be zero.
pack() and unpack() now support 64-bit format specifiers: q, Q, J and P.
- MessageFormatter::parse() and MessageFormat::format() (and their
static equivalents) now don't throw away better than second
precision in the arguments.
- Crypt:
crypt() will now raise an E_NOTICE error if the salt parameter is omitted.
See: https://wiki.php.net/rfc/crypt_function_salt
- IntlDateFormatter::__construct and datefmt_create() now accept for
the $timezone argument time zone identifiers, IntlTimeZone objects,
DateTimeZone objects and NULL. It used to accept only time zone
identifiers and NULL. Invalid time zone identifiers are no longer
accepted. Empty strings are no longer accepted.
- Mcrypt:
The $source parameter of mcrypt_create_iv() now defaults to
MCRYPT_DEV_URANDOM instead of MCRYPT_DEV_RANDOM.
- The default time zone used in IntlDateFormatter::__construct and
datefmt_create() (when the corresponding argument is not passed or
NULL is passed) is now the one given by date_default_timezone_get(),
not the default ICU time zone.
- OpenSSL:
The $crypto_type parameter is now optional in stream_socket_enable_crypto()
if the stream's SSL context specifies the new "crypto_type" option. The
crypto method from the context is used as a fallback if no crypto method is
specified at call-time.
- The time zone passed to the IntlDateFormatter is ignored if it is
NULL and if the calendar passed is an IntlCalendar object -- in this
case, the IntlCalendar's time zone will be used instead. Otherwise,
the time zone specified in the $timezone argument is used
instead. This does not affect old code, as IntlCalendar was
introduced in this version.
- Reflection:
ReflectionClass::newInstanceWithoutConstructor previously didn't allow the
instantiation of any internal class which used custom object storage
(overriding the default create_object handler), this was changed to only
reject the instantiation of such classes if the class is also marked as
final.
- IntlDateFormatter::__construct and datefmt_create() now accept for
the $calendar argument also IntlCalendar objects.
- XMLReader:
XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
the attribute could not be found, just like XMLReader::getAttribute.
- IntlDateFormatter::getCalendar() and datefmt_get_calendar() return
false if the IntlDateFormatter was set up with an IntlCalendar
instead of the constants
IntlDateFormatter::GREGORIAN/TRADITIONAL. IntlCalendar did not exist
before this version.
- Pgsql:
pg_insert()/pg_select()/pg_update()/pg_delete() are no longer EXPERIMENTAL.
The following functions no longer block until query write completion if the
socket stream underlying a database connection is set to non-blocking mode:
. pg_send_execute()
. pg_send_prepare()
. pg_send_query()
. pg_send_query_params()
- IntlDateFormatter::setCalendar() and datefmt_set_calendar() now also
accept an IntlCalendar object, in which case its time zone is
taken. Passing a constant is still allowed, and still keeps the time
zone.
- unserialize:
Manipulated serialization strings for objects implementing Serializable by
replacing "C:" with "O:" at the start will now produce an error.
- IntlDateFormatter::format() and datefmt_format() now also accept an
IntlCalendar object for formatting.
- parse_ini_file():
- parse_ini_string():
Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
For PHP >= 5.6.1
- set_error_handler(NULL) can now be used to reset the error handler.
Furthermore both set_error_handler(NULL) and
set_exception_handler(NULL) will now return the previously defined
error/exception handler. Previously bool(true) was returned.
- JSON:
Added JSON_PRESERVE_ZERO_FRACTION option (PHP >= 5.6.5)
- setcookie(), setrawcookie() and ext/session now send Max-Age headers
alongside Expires headers. (see
https://wiki.php.net/rfc/cookie_max-age)
- curl_setopt now accepts new option CURLOPT_SAFE_UPLOAD and CURLFile
object for safer file uploads (see
https://wiki.php.net/rfc/curl-file-upload)
- Functions in the socket extension now do not emit warnings when the
errno is EAGAIN, EWOULDBLOCK or EINPROGRESS.
- Since 5.5.2, spl_autoload_functions() returns different names for
different lambda functions registered via spl_autoload_register().
- Since 5.5.3, DOMDocument::schemaValidateSource() and
DOMDocument::schemaValidate() accept flag parameter. Only flag
available now is LIBXML_SCHEMA_CREATE. Default is 0.
- Since 5.5.4, fputcsv() has fifth parameter escape_char, allowing to
specify escape char.
4a. unserialize() change
------------------------
- Starting PHP 5.5.13, the bug fix for bug #67072 introduces a change to
unserialize() function, detailed below:
If the string looking like 'O:..:"ClassName":...' is unserialized, and
the class named is an internal class that declares custom unserializer
function, or extends such class, unserialize would fail.
Using O: for user classes not extending internal classes (including
those implementing Serializable) is still supported in 5.4, though
it is deprecated and may not be supported in 5.6 for classes that do not
originally serialize to O:. Same for using O: for internal classes
implementing Serializable (like ArrayObject) and classes that extend
them.
The reason for that is that O: format is meant to be used with classes
that do not define custom handlers, and was never intended for the use
with classes that do. When used with the class that relies on custom
unserializer, it can leave the object of such internal class in an
inconsistent state which has been observed to result in crashes and may
also lead to memory corruption and ultimately even arbitrary code
execution. This was never the intended use of unserializer, and mere
possibility of doing this constitutes a bug, since the data passed to
unserialize() is not a valid serialization of any object. Since there
are many applications applying unserialize() to untrusted data, this
presents a potential security vulnerability. Thus, keeping such bug in
the code base was considered too dangerous.
We are aware that some applications use O: format as a way to
instantiate classes. This was never the intended usage of serializer,
and ReflectionClass methods such as newInstance or
newInstanceWithoutConstructor can be used for that. We're working on
providing more comprehensive solution for such use cases in PHP 5.6 and
welcome the ideas in this area.
We note also that using unserialize() on any data that is not the result
of serialize() call continues to be an unsupported scenario and should
not be relied on to produce any specific result.
========================================
6. New Functions
========================================
- Datetime:
Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
- GMP:
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
Added gmp_import($data, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
Added gmp_export($gmpnumber, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
Added gmp_random_range() and gmp_random_bits() in PHP 5.6.3.
- Hash
Added hash_equals($known_string, $user_string)
- OpenSSL:
Added string openssl_x509_fingerprint($x509, $type, $binary).
Added string openssl_spki_new($private_key, $challenge, $algorithm)
Added bool openssl_spki_verify($spkac)
Added string openssl_spki_export($spkac)
Added string openssl_spki_export_challenge($spkac)
Added array openssl_get_cert_locations()
- LDAP:
Added ldap_escape($value, $ignore = "", $flags = 0).
Added ldap_modify_batch($link_identifier, $dn, $modifications) described in
https://wiki.php.net/rfc/ldap_modify_batch.
- Pgsql:
Added pg_socket($connection) to allow async connections and non-blocking IO
Added pg_connect_poll($connection) for establishing async connections
Added pg_consume_input($connection) for non-blocking query result consumption
Added pg_flush($connection) for non-blocking query write completion
- PDO_pgsql
Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0)
Added PDO::pgsqlGetPid()
- Reflection
Added ReflectionFunction::isVariadic() and ReflectionParameter::isVariadic().
- SPL
Added SplFileObject::fread($length) to complement fwrite() method (>= 5.5.11)
- Zip:
Added ZipArchive::setPassword($password)
========================================
7. New Classes and Interfaces
========================================
========================================
8. Removed Extensions
========================================
========================================
9. Other Changes to Extensions
========================================
- cURL:
- The following constants have been removed as they are now marked "obsolete"
in the underlying library and never had any effect to begin with:
. CURLOPT_CLOSEPOLICY
. CURLCLOSEPOLICY_CALLBACK
. CURLCLOSEPOLICY_LEAST_RECENTLY_USED
. CURLCLOSEPOLICY_LEAST_TRAFFIC
. CURLCLOSEPOLICY_OLDEST
. CURLCLOSEPOLICY_SLOWEST
- GMP:
The GMP extension now uses objects as the underlying data structure, rather
than resources. GMP instances now support dumping, serialization, cloning,
casts to primitive types and have overloaded operators.
(RFC: https://wiki.php.net/rfc/operator_overloading_gmp)
- OCI8:
- Added Implicit Result Set support for Oracle Database 12c with a
new oci_get_implicit_resultset() function.
- Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no longer
unnecessarily initiates an internal ROLLBACK during connection
close.
- Multi-row OCI_RETURN_LOB queries require fewer "round trips" to the database.
- Added DTrace probes enabled with PHP's generic --enable-dtrace
- The oci_internal_debug() function is now a no-op.
- The phpinfo() output format for OCI8 has changed.
- OpenSSL:
- The "SNI_enabled" SSL stream context option is now set to TRUE by default
if supported by the underlying openssl library.
- PCRE:
- The information collected by the (*MARK) backtracking control verb is now
collected into the "MARK" index of the $matches array for preg_match(),
preg_match_all() and preg_replace_callback().
- Pgsql:
- pg_insert()/pg_select()/pg_update()/pg_delete()/pg_meta_data()/pg_convert()
are no longer EXPERIMENTAL
- Added PGSQL_DML_ESCAPE option for pg_insert()/pg_select()/pg_update()/pg_delete()
that simply escapes all supplied parameters. These functions can be as fast as
native query. Unvalidated data(Unknown data types) is passed as string.
JSON/Array/etc are supported both PGSQL_DML_ESCAPE and pg_convert() as string.
- pg_select() returns PostgreSQL query resource when query is executed.
- Added extended flag parameter for pg_meta_data(). pg_meta_data() always
returns "is enum" attribute.
- The new pg_socket() function returns a socket stream with no behavior other
than to allow IO-readiness polling on a DB connection socket. Calling
stream_set_blocking() on its result enables non-blocking behavior.
- Passing the new PGSQL_CONNECT_ASYNC flag to pg_connect() allows applications
to poll for IO readiness via pg_connect_poll() and establish connections
asynchronously.
- PDO_pgsql:
- Added PDO::PGSQL_ATTR_DISABLE_PREPARES constant to execute the queries
without preparing them, while still passing parameters separately from
the command text using PQexecParams.
- Added LISTEN/NOTIFY support via PDO::pgsqlGetNotify / PDO::pgsqlGetPid()
as described in https://bugs.php.net/bug.php?id=42614.
- DOM:
- DOMNode::textContent is now a writeable property. (>= 5.6.1)
========================================
10. New Global Constants
========================================
- CURL:
CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 (>= 5.6.8)
- GD:
IMG_WEBP (>= 5.6.25)
- LDAP:
LDAP_ESCAPE_FILTER int(1)
LDAP_ESCAPE_DN int(2)
- Pgsql:
PGSQL_DML_ESCAPE int(4096)
PGSQL_CONNECT_ASYNC
PGSQL_CONNECTION_STARTED
PGSQL_CONNECTION_MADE
PGSQL_CONNECTION_AWAITING_RESPONSE
PGSQL_CONNECTION_AUTH_OK
PGSQL_CONNECTION_SSL_STARTUP
PGSQL_CONNECTION_SETENV
PGSQL_POLLING_FAILED
PGSQL_POLLING_READING
PGSQL_POLLING_WRITING
PGSQL_POLLING_OK
PGSQL_POLLING_ACTIVE
- OpenSSL:
STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT int(9)
STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT int(17)
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT int(33)
STREAM_CRYPTO_METHOD_ANY_CLIENT int(63)
STREAM_CRYPTO_METHOD_TLSv1_0_SERVER int(8)
STREAM_CRYPTO_METHOD_TLSv1_1_SERVER int(16)
STREAM_CRYPTO_METHOD_TLSv1_2_SERVER int(32)
STREAM_CRYPTO_METHOD_ANY_SERVER int(62)
OPENSSL_DEFAULT_STREAM_CIPHERS string
========================================
11. Changes to INI File Handling
5. New Functions
========================================
- Core:
Changed always_populate_raw_post_data to throw a deprecation warning when
enabled and to recognize the value -1 for never populating the global
$HTTP_RAW_POST_DATA variable, which will be default in future PHP versions.
default_charset is set to UTF-8. It was empty previously. default_charset
is used where it is applicable. Iconv/Mbstring/htmlentities/htmlspecialchars/
html_entity_decode use default_charset as default encoding.
internal_encoding/input_encoding/output_encoding is added for encoding
handling modules. Refer to "Changes to encodings in PHP 5.6" in "11. Other Changes"
section for more details.
- array_column()
- boolval()
- password_get_info()
- password_hash()
- password_needs_rehash()
- password_verify()
- cURL:
If the new openssl.cafile ini directive is specified ext/curl will give the
openssl path precedence over its own curl.cainfo directive.
- curl_file_create
- OpenSSL:
openssl.cafile and openssl.capath ini directives have been added to allow
global CA default specification as necessary.
- GD
- imageflip
- imagecrop
- imagecropauto
- imagesetinterpolation
- imageaffine
- imageaffinematrixget
- imageaffinematrixconcat
- imagescale
- Hash:
- hash_pbkdf2()
- Intl:
- datefmt_format_object()
- datefmt_get_calendar_object()
- datefmt_get_timezone()
- datefmt_set_timezone()
- datefmt_get_calendar_object()
- intlcal_create_instance()
- intlcal_get_keyword_values_for_locale()
- intlcal_get_now()
- intlcal_get_available_locales()
- intlcal_get()
- intlcal_get_time()
- intlcal_set_time()
- intlcal_add()
- intlcal_set_time_zone()
- intlcal_after()
- intlcal_before()
- intlcal_set()
- intlcal_roll()
- intlcal_clear()
- intlcal_field_difference()
- intlcal_get_actual_maximum()
- intlcal_get_actual_minimum()
- intlcal_get_day_of_week_type()
- intlcal_get_first_day_of_week()
- intlcal_get_greatest_minimum()
- intlcal_get_least_maximum()
- intlcal_get_locale()
- intlcal_get_maximum()
- intlcal_get_minimal_days_in_first_week()
- intlcal_get_minimum()
- intlcal_get_time_zone()
- intlcal_get_type()
- intlcal_get_weekend_transition()
- intlcal_in_daylight_time()
- intlcal_is_equivalent_to()
- intlcal_is_lenient()
- intlcal_is_set()
- intlcal_is_weekend()
- intlcal_set_first_day_of_week()
- intlcal_set_lenient()
- intlcal_equals()
- intlcal_get_repeated_wall_time_option()
- intlcal_get_skipped_wall_time_option()
- intlcal_set_repeated_wall_time_option()
- intlcal_set_skipped_wall_time_option()
- intlcal_from_date_time()
- intlcal_to_date_time()
- intlcal_get_error_code()
- intlcal_get_error_message()
- intlgregcal_create_instance()
- intlgregcal_set_gregorian_change()
- intlgregcal_get_gregorian_change()
- intlgregcal_is_leap_year()
- intltz_create_time_zone()
- intltz_create_default()
- intltz_get_id()
- intltz_get_gmt()
- intltz_get_unknown()
- intltz_create_enumeration()
- intltz_count_equivalent_ids()
- intltz_create_time_zone_id_enumeration()
- intltz_get_canonical_id()
- intltz_get_region()
- intltz_get_tz_data_version()
- intltz_get_equivalent_id()
- intltz_use_daylight_time()
- intltz_get_offset()
- intltz_get_raw_offset()
- intltz_has_same_rules()
- intltz_get_display_name()
- intltz_get_dst_savings()
- intltz_from_date_time_zone()
- intltz_to_date_time_zone()
- intltz_get_error_code()
- intltz_get_error_message()
- IntlDateFormatter::formatObject()
- IntlDateFormatter::getCalendarObject()
- IntlDateFormatter::getTimeZone()
- IntlDateFormatter::setTimeZone()
- LDAP:
- ldap_modify_batch() (5.5.10)
- SOAP:
- SoapClient::__getCookies() (5.5.14)
- Sockets:
- socket_sendmsg()
- socket_recvmsg()
- socket_cmsg_space()
- SPL:
- SplFixedArray::__wakeup()
- SplDoublyLinkedList::add()
- RecursiveTreeIterator::getPostfix() (5.5.2)
- RecursiveTreeIterator::setPostfix() (5.5.2)
- Zend OPcache:
- opcache_get_configuration()
- opcache_get_status()
- opcache_reset()
========================================
6. New Classes and Interfaces
========================================
- Intl:
- IntlCalendar
- IntlGregorianCalendar
- IntlTimeZone
- IntlBreakIterator
- IntlRuleBasedBreakIterator
- IntlCodePointBreakIterator
- UConverter
- cURL:
- CURLFile
========================================
7. Removed Extensions
========================================
None
========================================
8. Other Changes to Extensions
========================================
- Intl:
- This extension now requires ICU 4.0+.
- Phar:
- Added ability of resolving alias created by Phar::map
========================================
9. New Global Constants
========================================
- mysqli:
- Added MYSQLI_SERVER_PUBLIC_KEY constant to be used with mysqli_options()
- cURL:
- Added CURLOPT_SAFE_UPLOAD to be used with curl_setopt().
- Added CURL_WRAPPERS_ENABLED to reflect --with-curlwrappers.
- GD
- Added constants for imageflip:
. IMG_FLIP_HORIZONTAL
. IMG_FLIP_VERTICAL
. IMG_FLIP_BOTH
- Added constants for imagecrop
. IMG_CROP_DEFAULT
. IMG_CROP_TRANSPARENT
. IMG_CROP_BLACK
. IMG_CROP_WHITE
. IMG_CROP_SIDES
. IMG_CROP_THRESHOLD
- Added constants for imagesetinterpolation, used by imagescale
imagerotate and imageaffine:
. IMG_BELL
. IMG_BESSEL
. IMG_BILINEAR_FIXED
. IMG_BICUBIC
. IMG_BICUBIC_FIXED
. IMG_BLACKMAN
. IMG_BOX
. IMG_BSPLINE
. IMG_CATMULLROM
. IMG_GAUSSIAN
. IMG_GENERALIZED_CUBIC
. IMG_HERMITE
. IMG_HAMMING
. IMG_HANNING
. IMG_MITCHELL
. IMG_POWER
. IMG_QUADRATIC
. IMG_SINC
. IMG_NEAREST_NEIGHBOUR
. IMG_WEIGHTED4
. IMG_TRIANGLE
- Added constants for imageaffinematrixget
. IMG_AFFINE_TRANSLATE
. IMG_AFFINE_SCALE
. IMG_AFFINE_ROTATE
. IMG_AFFINE_SHEAR_HORIZONTAL
. IMG_AFFINE_SHEAR_VERTICAL
========================================
10. Changes to INI File Handling
========================================
- Core:
- Added sys_temp_dir INI directive, for specifying temporary
directory.
- Intl:
- Added intl.use_exceptions INI directive, which controls what
happens when global errors are set together with intl.error_level.
- MSSQL:
- mssql.compatability_mode renamed to mssql.compatibility_mode in 5.5.2,
old directive still supported for BC reasons.
- mysqlnd:
- Added mysqlnd.sha256_server_public_key INI PERDIR setting that
affects all APIs which use(are built) for mysqlnd. This allows
ext/mysqli to be used with the new auth protocol, although at
coarser level.
- Sessions:
- Added session.use_strict_mode in 5.5.3, which prevents session
fixation attacks and session collisions.
See also https://wiki.php.net/rfc/strict_sessions
- Zend OPcache (See http://php.net/manual/en/book.opcache.php)
- Added the following directives:
- opcache.enable (default "1")
- opcache.memory_consumption (default "64")
- opcache.interned_strings_buffer (default "4")
- opcache.max_accelerated_files (default "2000")
- opcache.max_wasted_percentage (default "5")
- opcache.use_cwd (default "1")
- opcache.validate_timestamps (default "1")
- opcache.revalidate_freq (default "2")
- opcache.revalidate_path (default "0")
- opcache.save_comments (default "1")
- opcache.load_comments (default "1")
- opcache.fast_shutdown (default "0")
- opcache.enable_file_override (default "0")
- opcache.optimization_level (default "0xffffffff")
- opcache.inherited_hack (default "1")
- opcache.blacklist_filename (default "")
- opcache.max_file_size (default "0")
- opcache.consistency_checks (default "0")
- opcache.force_restart_timeout (default "180")
- opcache.error_log (default "" which means stderr)
- opcache.log_verbosity_level (default "1")
- opcache.preferred_memory_model (default "")
- opcache.protect_memory (default "0")
- opcache.mmap_base (Windows-only)
========================================
11. Windows Support
========================================
- The Apache 2.4 handler is supported as of PHP 5.5.0
- OPcache: Errors like 'unable to reattach to base address' could
happen in many common setups. It is due to some technical and
design restriction in the engine and could not be fixed easily
before 5.5.0 was released.
A possible fix is to tweak the opcache.mmap_base INI setting by
forcing the first address to be tried.
For x86 version, the following addreses can be tried:
. 0x20000000, 0x21000000, 0x30000000, 0x31000000, 0x50000000
and for x64 (still experimental):
. 0x0000100000000000, 0x0000200000000000, 0x0000300000000000, 0x0000700000000000
========================================
12. Other Changes
========================================
- File upload:
Uploads equal or greater than 2GB in size are now accepted.
- If the APC or WinCache user cache APIs were used before, consider
these alternatives for PHP 5.5:
- HTTP stream wrapper:
HTTP 1.1 requests now include a Connection: close header unless explicitly
overridden by setting a Connection header via the header context option.
- PDO_pgsql
A libpq version providing PQexecParams, PQprepare, PQescapeStringConn,
PQescapeByteaConn is now required. According to the release notes that means
8.0.8+ or 8.1.4+.
- Zip:
New --with-libzip option allow to use system libzip. Version > 0.11 required,
Version >= 0.11.2 recommended for all features.
- Changes to encodings in PHP 5.6
The default value of default_charset is now UTF-8 when it is not
explicitly set in php.ini
The following php.ini parameters were added:
internal_encoding
input_encoding
output_encoding
The values of the following php.ini parameters have become empty in
PHP 5.6 (previously they were all ISO-8859-1)
iconv.input_encoding
iconv.output_encoding
iconv.internal_encoding
Changes were made to character set handling in:
- the iconv and mbstring extensions,
- and htmlentities(), htmlspecialchars(), html_entity_decode() functions
The precedence for these is now:
default_charset < internal/input/output_encoding < (mbstring.* || iconv.*) < function parameter
For example, the easiest way to use the UTF-8 encoding is to set
default_charset=UTF-8 and leave the following php.ini parameters
empty:
iconv.input_encoding
iconv.output_encoding
iconv.internal_encoding
mbstring.http_input
mbstring.http_output
mbstring.internal_encoding
internal_encoding
input_encoding
output_encoding
The mb_regex_encoding() default setting is changed from EUC-JP to UTF-8.
- APCu
- all supported OSes: http://pecl.php.net/package/APCu
- Windows: http://windows.php.net/downloads/pecl/releases/apcu/
- WinCache, Windows only: http://pecl.php.net/package/WinCache
+94 -183
View File
@@ -1,19 +1,14 @@
$Id$
PHP 5.6 INTERNALS UPGRADE NOTES
UPGRADE NOTES - PHP X.Y
1. Internal API changes
a. Addition of do_operation and compare object handlers
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
c. POST data handling
d. Arginfo changes
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
f. empty strings are interned
g. Additional str_* APIs
h. Addition of zend_hash_reindex
i. Addition of zend_hash_splice
j. Unserialization of manipulated object strings
k. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
a. Executor changes
b. Streams pooling API
c. Lowercasing and locales
d. zend_qsort_r
e. get_current_key
f. unserialization of manipulated object strings
2. Build system changes
a. Unix build system changes
@@ -24,202 +19,118 @@ PHP 5.6 INTERNALS UPGRADE NOTES
1. Internal API changes
========================
a. Addition of do_operation and compare object handlers
a. Executor changes
Two new object handlers have been added:
* extensions can't override zend_execute() any more, they should override
zend_execute_ex() instead. The EG(current_execute_data) is already
initialized in zend_execute_ex(), so for compatibility extensions
may need to use EG(current_execute_data)->prev_execute_data instead.
* removed EG(arg_types_stack), EX(fbc), EX(called_scope), EX(current_object)
* added op_array->nested_calls. It's calculated at compile time.
* added EX(call_slots). It is an array to store information about syntaticaly
nested calls (e.g. foo(bar())). It's preallocated together with execute_data.
* added EX(call) - pointer to a current calling function. Actually an
element of EX(call_slots)
* opcodes INIT_METHOD_CALL, ZEND_INIT_STATIC_METHOD_CALL,
ZEND_INIT_FCALL_BY_NAME, ZEND_INIT_NS_FCALL_BY_NAME use result.num as
an index in EX(call_slots)
* opcode ZEND_NEW uses extended_vallue as an index in EX(call_slots)
* opcoes ZEND_DO_FCALL and ZEND_DO_FCALL_BY_NAME use op2.num as
an index in EX(call_slots)
* added op_array->used_stack. It's calculated at compile time and the
corresponding stack space is preallocated together with execute_data.
ZEND_SEND* and ZEND_DO_FCALL* don't need to check for stack overflow
anymore.
* Removed execute_data->Ts field. The VM temporary variables always allocated
immediately before execute_data structure. Now they are accessed by offset
from the execute_data base pointer (instead of execute_data->Ts). Compiler
stores new offsets in op_array->opcodes[*].op?.num. You can use macros
EX_TMP_VAR() and EX_TMP_VAR_NUM() to access temp_variable by offset or
number. You can convert number to offset using EX_TMP_VAR_NUM(0, num) or
offset to number (EX_TMP_VAR_NUM(0,0)-EX_TMP_VAR(0,offset)).
* Removed execute_data->CVs field. The VM compiled variables always allocated
immediately after execute_data structure. Now they are accessed by offset
from the execute_data base pointer (instead of execute_data->CVs). You can
use macros EX_CV_NUM() to access compiled variables by number.
do_operation:
typedef int (*zend_object_do_operation_t)(
zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC
);
b. Streams pooling API
compare:
typedef int (*zend_object_compare_zvals_t)(
zval *result, zval *op1, zval *op2 TSRMLS_DC
);
The streams pooling API has been removed. The following functions no longer
exist:
The first handler is used to overload arithmetic operations. The first
argument specifies the opcode of the operator, result is the target zval,
op1 the first operand and op2 the second operand. For unary operations
op2 is NULL. If the handler returns FAILURE PHP falls back to the default
behavior for the operation.
PHPAPI int php_stream_context_get_link(php_stream_context *context,
const char *hostent, php_stream **stream);
PHPAPI int php_stream_context_set_link(php_stream_context *context,
const char *hostent, php_stream *stream);
PHPAPI int php_stream_context_del_link(php_stream_context *context,
php_stream *stream);
The second handler is used to perform comparison operations with
non-objects. The value written into result must be an IS_LONG with value
-1 (smaller), 0 (equal) or 1 (greater). The return value is a SUCCESS/FAILURE
return code. The difference between this handler and compare_objects is
that it will be triggered for comparisons with non-objects and objects of
different types. It takes precedence over compare_objects.
c. Lowercasing and locales
Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp
The lowercasing functions in zend_operators.c were split into those that do
lowercasing according to locale rules and those that do ASCII lowercasing.
ASCII:
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
zend_str_tolower_copy
zend_str_tolower_dup
zend_str_tolower
zend_binary_strcasecmp
zend_binary_strncasecmp
The return_value_ptr argument to internal functions is now always set.
Previously it was only available for functions returning by-reference.
return_value_ptr can now be used to return zvals without copying them.
For this purpose two new macros are provided:
Locale-based:
zend_binary_strncasecmp_l
zend_binary_strcasecmp_l
zend_binary_zval_strcasecmp
zend_binary_zval_strncasecmp
string_compare_function_ex
string_case_compare_function
RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */
RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */
Internal engine lowercasing will be using ASCII-only rules. User-facing functions,
such as strcasecmp, will be using locale rules.
The macros behave similarly to the non-FAST variants with copy=1 and
dtor=0, but will try to return the zval without making a copy by utilizing
return_value_ptr.
c. POST data handling
The sapi_request_info's members post_data, post_data_len and raw_post_data as
well as raw_post_data_len have been replaced with a temp PHP stream
request_body.
The recommended way to access raw POST data is to open and use a php://input
stream wrapper. It is safe to be used concurrently and more than once.
Two new functions - zend_binary_strncasecmp_l and zend_binary_strcasecmp_l - added as
locale-based counterparts to zend_binary_strcasecmp and zend_binary_strncasecmp.
d. Arginfo changes
d. zend_qsort_r
The pass_rest_by_reference argument of the ZEND_BEGIN_ARG_INFO and
ZEND_BEGIN_ARG_INFO_EX() is no longer used. The value passed to it is ignored.
Added the function zend_qsort_r():
Instead a variadic argument is created using ZEND_ARG_VARIADIC_INFO():
typedef int (*compare_r_func_t)(const void *, const void * TSRMLS_DC, void *);
void zend_qsort_r(void *base, size_t nmemb, size_t siz, compare_r_func_t compare, void *arg TSRMLS_DC);
ZEND_ARG_VARIADIC_INFO(0, name) /* pass rest by value */
ZEND_ARG_VARIADIC_INFO(1, name) /* pass rest by reference */
ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, name)
/* pass rest by prefer-ref */
The extra argument it has (relatively to zend_qsort()) is passed to the
comparison function.
ZEND_ARG_VARIADIC_INFO() should only be used for the last argument.
e. get_current_key
The following changes were applied to the zend_arg_info struct:
The signature of the get_current_key iteration handler has been changed to:
typedef struct _zend_arg_info {
const char *class_name;
zend_uint class_name_len;
zend_uchar type_hint;
+ zend_uchar pass_by_reference;
zend_bool allow_null;
- zend_bool pass_by_reference;
+ zend_bool is_variadic;
} zend_arg_info;
void (*get_current_key)(zend_object_iterator *iter, zval *key TSRMLS_DC);
The following changes were applied to the zend_internal_function_info struct:
The key should be written into the zval* using the ZVAL_* macros.
typedef struct _zend_internal_function_info {
zend_uint required_num_args;
zend_uchar _type_hint;
zend_bool return_reference;
- zend_bool pass_rest_by_reference;
+ zend_bool _allow_null;
+ zend_bool _is_variadic;
} zend_internal_function_info;
f. unserialization of manipulated object strings
The CHECK_ARG_SEND_TYPE(), ARG_MUST_BE_SENT_BY_REF(),
ARG_SHOULD_BE_SENT_BY_REF() and ARG_MAY_BE_SENT_BY_REF() macros now assume
that the argument passed to them is a zend_function* and that it is non-NULL.
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
Memory allocation is now managed by emalloc/efree instead of malloc/free.
f. empty strings are interned
String created using STR_EMPTY_ALLOC() are now interned.
convert_to_string use STR_EMPTY_ALLOC() for zval when IS_NULL.
str_efree() shoud be preferred as efree() on such strings can cause memory
corruption.
g. Additional str_* APIs
In addition to the previously existing str_free() and str_efree() macros, the
following macros have been introduced to simplify dealing with potentially
interned strings:
str_efree_rel(str) - efree_rel() if not interned
str_erealloc(str, new_len) - erealloc() or emalloc+memcpy if interned
str_estrndup(str, len) - estrndup() if not interned
str_strndup(str, len) - zend_strndup() if not interned
str_hash(str, len) - INTERNED_HASH(str) if interned,
zend_hash_func(str, len+1) otherwise
h. Addition of zend_hash_reindex
A zend_hash_reindex() function with the following prototype has been added:
void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys);
If only_integer_keys==0, this function will change all keys to be continuous,
zero-based integers in hash order. If only_integer_keys==1 the same will be
done only for keys that were already integers previously, while leaving
string keys alone.
i. Addition of zend_hash_splice
A zend_hash_splice() macro with the following prototype has been added:
void zend_hash_splice(
HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor,
uint offset, uint length,
void **list, uint list_count, HashTable *removed
);
This function performs an in-place splice operation on a hashtable:
The elements between offset and offset+length are removed and the elements in
list[list_count] are inserted in their place. The removed elements can be
optionally collected into a hashtable.
This operation reindexes the hashtable, i.e. integer keys will be zero-based
and sequential, while string keys stay intact. The same applies to the
elements inserted into the removed HT.
As a side-effect of this addition the signature of the php_splice() function
changed:
void php_splice(
HashTable *ht, zend_uint offset, zend_uint length,
zval ***list, zend_uint list_count, HashTable *removed TSRMLS_DC
)
This function now directly forwards to zend_hash_splice(), resets the
IAP of ht (for compatibility with the previous implementation) and resets
CVs if the passed hashtable is the global symbol table.
j. Unserialization of manipulated object strings
Strings requiring unserialization of objects are now explicitly checked
whether the object they contain implements the Serializable interface.
This solves the situation where manipulated strings could be passed for
objects using Serializable to disallow serialization. An object
implementing Serializable will always start with "C:" in the serialized
string, all other objects are represented with starting "O:". Objects
implementing Serializable to disable serialization using
zend_class_unserialize_deny and zend_class_serialize_deny, when
instantiated from the serializer with a manipulated "O:" string at the
start, will most likely be defectively initialized. This is now
fixed at the appropriate place by checking for the presence of the
serialize callback in the class entry.
k. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
These two #defines disappeared. Instead we have now IS_CONSTANT_AST which
covers also the functionality IS_CONSTANT_ARRAY bid and furthermore the
hack for marking zvals as constant index with IS_CONSTANT_INDEX is now
superfluous and so removed.
Please note that IS_CONSTANT_AST now has the same value than
IS_CONSTANT_ARRAY had.
Strings requiring unserialization of objects are now explicitly checked
whether the object they contain implements the Serializable interface.
This solves the situation where manipulated strings could be passed for
objects using Serializable to disallow serialization. An object
implementing Serializable will always start with "C:" in the serialized
string, all other objects are represented with starting "O:". Objects
implementing Serializable to disable serialization using
zend_class_unserialize_deny and zend_class_serialize_deny, when
instantiated from the serializer with a manipulated "O:" string at the
start, will most likely be defectively initialized. This is now
fixed at the appropriate place by checking for the presence of the
serialize callback in the class entry.
========================
2. Build system changes
========================
a. Unix build system changes
- The bison version check is now a blacklist instead of a whitelist.
- The bison binary can be specified through the YACC environment/configure
variable. Previously `bison` was assumed to be in $PATH.
-
b. Windows build system changes
- The configure option --enable-static-analyze isn't available anymore.
The new option was introduced --with-analyzer.
- It is possible to disable PGO for single extensions, to do that
define a global variable PHP_MYMODULE_PGO evaluating to false
inside config.w32
- Drop Windows XP and 2003 support.
+1 -1
View File
@@ -18,7 +18,7 @@ libZend_la_SOURCES=\
zend_default_classes.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c \
zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \
zend_generators.c zend_virtual_cwd.c zend_ast.c
zend_generators.c
libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
+3 -3
View File
@@ -9,11 +9,11 @@ Modified: 2001-09-17
1. Background/Need
==================
Many internal functions of PHP will reject parameters because of their
Many internal function of PHP will reject parameters because of their
type (the array and variable function come to mind). For userland
this is not an easy task as there is no uniform way to do it. An
addition to the engine for requiring loose types would allow
developers to know that the data passed to their functions are of the
delevopers to know that the data passed to their functions is of the
correct type and reduce the need for duplicating the same code in
every function to check for the type of data.
@@ -57,7 +57,7 @@ function foo (array $var){
===========
Mis-matches in type should be reported as fatal errors and should halt
the execution of a script as that function cannot be run and code
the execution of a script as that function can not be run and code
following could not reliably run.
-8
View File
@@ -119,10 +119,6 @@ SOURCE=.\zend_API.c
# End Source File
# Begin Source File
SOURCE=.\zend_ast.c
# End Source File
# Begin Source File
SOURCE=.\zend_builtin_functions.c
# End Source File
# Begin Source File
@@ -269,10 +265,6 @@ SOURCE=.\zend_variables.c
SOURCE=.\zend_vm_opcodes.c
# End Source File
# Begin Source File
SOURCE=.\zend_virtual_cwd.c
# End Source File
# End Group
# Begin Group "Header Files"
-4
View File
@@ -140,10 +140,6 @@ SOURCE=.\zend_alloc.c
# End Source File
# Begin Source File
SOURCE=.\zend_ast.c
# End Source File
# Begin Source File
SOURCE=.\zend_API.c
# End Source File
# Begin Source File
+9 -18
View File
@@ -3,13 +3,8 @@ dnl
dnl This file contains local autoconf functions.
AC_DEFUN([LIBZEND_BISON_CHECK],[
# we only support certain bison versions;
# min: 2.4 (i.e. 204, major * 100 + minor for easier comparison)
bison_version_min="204"
# non-working versions, e.g. "3.0 3.2";
# remove "none" when introducing the first incompatible bison version an
# separate any following additions by spaces
bison_version_exclude="3.0"
# we only support certain bison versions
bison_version_list="2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7"
# for standalone build of Zend Engine
test -z "$SED" && SED=sed
@@ -22,22 +17,18 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
if test -n "$bison_version_vars"; then
set $bison_version_vars
bison_version="${1}.${2}"
bison_version_num="`expr ${1} \* 100 + ${2}`"
if test $bison_version_num -ge $bison_version_min; then
php_cv_bison_version="$bison_version (ok)"
for bison_check_version in $bison_version_exclude; do
if test "$bison_version" = "$bison_check_version"; then
php_cv_bison_version=invalid
break
fi
done
fi
for bison_check_version in $bison_version_list; do
if test "$bison_version" = "$bison_check_version"; then
php_cv_bison_version="$bison_check_version (ok)"
break
fi
done
fi
])
fi
case $php_cv_bison_version in
""|invalid[)]
bison_msg="This bison version is not supported for regeneration of the Zend/PHP parsers (found: $bison_version, min: $bison_version_min, excluded: $bison_version_exclude)."
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
AC_MSG_WARN([$bison_msg])
YACC="exit 0;"
;;
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Bug #67468 (Segfault in highlight_file()/highlight_string())
--SKIPIF--
<?php if(!function_exists("leak")) print "skip only for debug builds"; ?>
--FILE--
<?php
highlight_string("<?php __CLASS__;", true);
echo "done";
?>
--EXPECT--
done
-110
View File
@@ -1,110 +0,0 @@
--TEST--
Basic argument unpacking
--FILE--
<?php
function test(...$args) {
var_dump($args);
}
function test2($arg1, $arg2, $arg3 = null) {
var_dump($arg1, $arg2, $arg3);
}
function getArray($array) {
return $array;
}
function arrayGen($array) {
foreach ($array as $element) {
yield $element;
}
}
$array = [1, 2, 3];
test(...[]);
test(...[1, 2, 3]);
test(...$array);
test(...getArray([1, 2, 3]));
test(...arrayGen([]));
test(...arrayGen([1, 2, 3]));
test(1, ...[2, 3], ...[4, 5]);
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]));
test2(...[1, 2]);
test2(...[1, 2, 3]);
test2(...[1], ...[], ...[], ...[2, 3], ...[4, 5]);
?>
--EXPECT--
array(0) {
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(0) {
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
int(1)
int(2)
NULL
int(1)
int(2)
int(3)
int(1)
int(2)
int(3)
-145
View File
@@ -1,145 +0,0 @@
--TEST--
Argument unpacking with by-ref arguments
--FILE--
<?php
error_reporting(E_ALL);
function test1(&...$args) {
foreach ($args as &$arg) {
$arg++;
}
}
test1(...[1, 2, 3]);
$array = [1, 2, 3];
test1(...$array);
var_dump($array);
$array1 = [1, 2]; $array2 = [3, 4];
test1(...$array1, ...$array2);
var_dump($array1, $array2);
function test2($val1, &$ref1, $val2, &$ref2) {
$ref1++;
$ref2++;
}
$array = [0, 0, 0, 0];
test2(...$array);
var_dump($array);
$array1 = [1, 2]; $array2 = [4, 5];
test1(...$array1, ...$array2);
var_dump($array1, $array2);
$a = $b = $c = $d = 0;
$array = [0, 0, 0, 0];
test2($a, ...$array);
var_dump($a, $array);
test2($a, $b, ...$array);
var_dump($a, $b, $array);
test2($a, $b, $c, ...$array);
var_dump($a, $b, $c, $array);
test2($a, $b, $c, $d, ...$array);
var_dump($a, $b, $c, $d, $array);
?>
--EXPECTF--
array(3) {
[0]=>
int(2)
[1]=>
int(3)
[2]=>
int(4)
}
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
array(2) {
[0]=>
int(4)
[1]=>
int(5)
}
array(4) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(0)
[3]=>
int(1)
}
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
array(2) {
[0]=>
int(5)
[1]=>
int(6)
}
int(0)
array(4) {
[0]=>
int(1)
[1]=>
int(0)
[2]=>
int(1)
[3]=>
int(0)
}
int(0)
int(1)
array(4) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
int(1)
[3]=>
int(0)
}
int(0)
int(2)
int(0)
array(4) {
[0]=>
int(2)
[1]=>
int(1)
[2]=>
int(1)
[3]=>
int(0)
}
int(0)
int(3)
int(0)
int(1)
array(4) {
[0]=>
int(2)
[1]=>
int(1)
[2]=>
int(1)
[3]=>
int(0)
}
-37
View File
@@ -1,37 +0,0 @@
--TEST--
Unpack arguments for dynamic call
--FILE--
<?php
$fn = function(...$args) {
var_dump($args);
};
$fn(...[]);
$fn(...[1, 2, 3]);
$fn(1, ...[2, 3], ...[], ...[4, 5]);
?>
--EXPECT--
array(0) {
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
-43
View File
@@ -1,43 +0,0 @@
--TEST--
Argument unpacking with internal functions
--FILE--
<?php
$arrays = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
var_dump(array_map(null, ...$arrays));
?>
--EXPECT--
array(3) {
[0]=>
array(3) {
[0]=>
int(1)
[1]=>
int(4)
[2]=>
int(7)
}
[1]=>
array(3) {
[0]=>
int(2)
[1]=>
int(5)
[2]=>
int(8)
}
[2]=>
array(3) {
[0]=>
int(3)
[1]=>
int(6)
[2]=>
int(9)
}
}
-59
View File
@@ -1,59 +0,0 @@
--TEST--
Only arrays and Traversables can be unpacked
--FILE--
<?php
function test(...$args) {
var_dump($args);
}
test(...null);
test(...42);
test(...new stdClass);
test(1, 2, 3, ..."foo", ...[4, 5]);
test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
?>
--EXPECTF--
Warning: Only arrays and Traversables can be unpacked in %s on line %d
array(0) {
}
Warning: Only arrays and Traversables can be unpacked in %s on line %d
array(0) {
}
Warning: Only arrays and Traversables can be unpacked in %s on line %d
array(0) {
}
Warning: Only arrays and Traversables can be unpacked in %s on line %d
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
Warning: Only arrays and Traversables can be unpacked in %s on line %d
Warning: Only arrays and Traversables can be unpacked in %s on line %d
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Argument unpacking with many arguments
--FILE--
<?php
function fn(...$args) {
var_dump(count($args));
}
$array = array_fill(0, 10000, 42);
fn(...$array, ...$array);
?>
--EXPECT--
int(20000)
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Unpack arguments for method calls
--FILE--
<?php
class Foo {
public function test(...$args) {
var_dump($args);
}
public static function test2(...$args) {
var_dump($args);
}
}
$foo = new Foo;
Foo::test2(1, 2, ...[3, 4], ...[], ...[5]);
?>
--EXPECT--
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
-35
View File
@@ -1,35 +0,0 @@
--TEST--
Unpack arguments for new expression
--FILE--
<?php
class Foo {
public function __construct(...$args) {
var_dump($args);
}
}
new Foo(...[]);
new Foo(...[1, 2, 3]);
new Foo(...[1], ...[], ...[2, 3]);
?>
--EXPECT--
array(0) {
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
@@ -1,10 +0,0 @@
--TEST--
Positional arguments cannot be used after argument unpacking
--FILE--
<?php
var_dump(...[1, 2, 3], 4);
?>
--EXPECTF--
Fatal error: Cannot use positional argument after argument unpacking in %s on line %d
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Argument unpacking does not work with string keys (forward compatibility for named args)
--FILE--
<?php
set_error_handler(function($errno, $errstr) {
var_dump($errstr);
});
var_dump(...[1, 2, "foo" => 3, 4]);
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
?>
--EXPECTF--
string(36) "Cannot unpack array with string keys"
int(1)
int(2)
string(42) "Cannot unpack Traversable with string keys"
int(1)
int(2)
@@ -1,33 +0,0 @@
--TEST--
Traversables that throw exceptions are properly handled during argument unpack
--FILE--
<?php
function test(...$args) {
var_dump($args);
}
class Foo implements IteratorAggregate {
public function getIterator() {
throw new Exception('getIterator');
}
}
function gen() {
yield 1;
yield 2;
throw new Exception('gen');
}
try {
test(1, 2, ...new Foo, ...[3, 4]);
} catch (Exception $e) { var_dump($e->getMessage()); }
try {
test(1, 2, ...gen(), ...[3, 4]);
} catch (Exception $e) { var_dump($e->getMessage()); }
?>
--EXPECT--
string(11) "getIterator"
string(3) "gen"
@@ -1,31 +0,0 @@
--TEST--
Traversables cannot be unpacked into by-reference parameters
--FILE--
<?php
function test($val1, $val2, $val3, &$ref) {
$ref = 42;
}
function gen($array) {
foreach ($array as $element) {
yield $element;
}
}
test(1, 2, 3, $b, ...gen([4, 5, 6]));
var_dump($b);
test(...gen([1, 2, 3, 4]));
test(1, 2, ...gen([3, 4]));
test(...gen([1, 2]), ...gen([3, 4]));
?>
--EXPECTF--
int(42)
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
@@ -1,25 +0,0 @@
--TEST--
Next free element may overflow in array literals
--FILE--
<?php
$i = PHP_INT_MAX;
$array = [$i => 42, new stdClass];
var_dump($array);
const FOO = [PHP_INT_MAX => 42, "foo"];
var_dump(FOO);
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
-1
View File
@@ -2,7 +2,6 @@
Bug #30820 (static member conflict with $this->member silently ignored)
--INI--
error_reporting=4095
opcache.optimization_level=0
--FILE--
<?php
class Blah {
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #43201 (Crash on using uninitialized vals and __get/__set)
Bug #43201 (Crash on using unitialized vals and __get/__set)
--FILE--
<?php
class Foo {
+5 -3
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #63336 (invalid E_NOTICE error occur)
--XFAIL--
Bug is not fixed yet
--FILE--
<?php
error_reporting(E_ALL | E_NOTICE );
@@ -16,7 +18,7 @@ class Child extends Base {
public function bar($var, $more=self::DUMMY) { return true; }
}
?>
--EXPECTF--
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = TEST, $more = NULL) in %sbug63336.php on line %d
--EXPECT--
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = '123', $more = NULL) in %sbug63336.php on line %d
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($more = self::DUMMY) in %sbug63336.php on line %d
Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($var, $more = 'XXX') in %sbug63336.php on line %d
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #65419 (Inside trait, self::class != __CLASS__)
--FILE--
<?php
trait abc
{
static function def()
{
echo self::class, "\n";
echo __CLASS__, "\n";
}
}
class ghi
{
use abc;
}
ghi::def();
?>
--EXPECTF--
ghi
ghi
+2
View File
@@ -1,5 +1,7 @@
--TEST--
Fixed Bug #65784 (Segfault with finally)
--XFAIL--
This bug is not fixed in 5.5 due to ABI BC
--FILE--
<?php
function foo1() {
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #66015 (wrong array indexing in class's static property)
--FILE--
<?php
class Test
{
const FIRST = 1;
const SECOND = 2;
const THIRD = 3;
protected static $array = [
self::FIRST => 'first',
'second',
'third'
];
public function __construct()
{
var_export(self::$array);
}
}
$test = new Test();
?>
--EXPECTF--
array (
1 => 'first',
2 => 'second',
3 => 'third',
)
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #66252 (Problems in AST evaluation invalidating valid parent:: reference)
--FILE--
<?php
class A {
const HW = "this is A";
}
class B extends A {
const BHW = parent::HW . " extended by B";
}
const C = B::BHW;
echo C, "\n";
--EXPECT--
this is A extended by B
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #66609 (php crashes with __get() and ++ operator in some cases)
--FILE--
<?php
$bar = new Bar;
$foo = new Foo;
class Bar {
public function __get($x) {
global $foo;
return $foo->foo;
}
}
class Foo {
public function __get($x) {
global $bar;
return $bar->bar;
}
}
$foo->blah += 1; //crash
++$foo->blah; //crash
$foo->blah++; //crash
$foo->blah--; //crash
--$foo->blah; //crash
echo "okey";
?>
--EXPECTF--
Notice: Undefined property: Bar::$bar in %sbug66609.php on line %d
okey
-13
View File
@@ -1,13 +0,0 @@
--TEST--
Bug #66660 (Composer.phar install/update fails)
--STDIN--
<?php __CLASS__ ?>
--FILE--
<?php
file_put_contents(__DIR__."/bug66660.tmp.php", "<?php __CLASS__ ?>");
echo php_strip_whitespace(__DIR__."/bug66660.tmp.php");
?>
--CLEAN--
<?php unlink(__DIR__."/bug66660.tmp.php"); ?>
--EXPECT--
<?php __CLASS__ ?>
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #67111: Memory leak when using "continue 2" inside two foreach loops
--FILE--
<?php
$array1 = [1, 2, 3];
$array2 = [1, 2, 3];
foreach ($array1 as $x) {
foreach ($array2 as $y) {
echo "$x.$y\n";
continue 2;
}
}
?>
--EXPECT--
1.1
2.1
3.1
-26
View File
@@ -1,26 +0,0 @@
--TEST--
Bug #67169: array_splice all elements, then []= gives wrong index
--FILE--
<?php
$array = array('a', 'b');
array_splice($array, 0, 2);
$array[] = 'c';
var_dump($array);
$array = array('a', 'b');
array_shift($array);
array_shift($array);
$array[] = 'c';
var_dump($array);
?>
--EXPECT--
array(1) {
[0]=>
string(1) "c"
}
array(1) {
[0]=>
string(1) "c"
}
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #67314 (Segmentation fault in gc_remove_zval_from_buffer)
--FILE--
<?php
function crash()
{
$notDefined[$i] = 'test';
}
function error_handler() { return false; }
set_error_handler('error_handler');
crash();
echo "made it once\n";
crash();
echo "ok\n";
--EXPECTF--
Notice: Undefined variable: i in %sbug67314.php on line 4
made it once
Notice: Undefined variable: i in %sbug67314.php on line 4
ok
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #67368 (Memory leak with immediately dereferenced array in class constant)
--INI--
report_memleaks=1
--FILE--
<?php
class FooBar {
const bar = ["bar" => 3]["bar"];
}
echo "okey";
--EXPECTF--
okey
+2 -2
View File
@@ -2,14 +2,14 @@
bug67436: Autoloader isn't called if user defined error handler is present
--INI--
error_reporting=-1
error_reporting=
--FILE--
<?php
spl_autoload_register(function($classname) {
if (in_array($classname, array('a','b','c'))) {
require_once __DIR__ . "/{$classname}.php";
require_once ($classname . '.php');
}
});
+2 -2
View File
@@ -9,7 +9,7 @@ error_reporting=-1
spl_autoload_register(function($classname) {
if (in_array($classname, array('a','b','c'))) {
require_once __DIR__ . "/{$classname}.php";
require_once ($classname . '.php');
}
});
@@ -19,6 +19,6 @@ $b = new b();
$b->test();
--EXPECTF--
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s/bug67436/b.php on line %d
b::test()
a::test(c::TESTCONSTANT)
-44
View File
@@ -1,44 +0,0 @@
--TEST--
Bug #67633: A foreach on an array returned from a function not doing copy-on-write
--FILE--
<?php
function id($x) {
return $x;
}
function &ref_id(&$x) {
return $x;
}
$c = 'c';
$array = ['a', 'b', $c];
foreach(id($array) as &$v) {
$v .= 'q';
}
var_dump($array);
foreach(ref_id($array) as &$v) {
$v .= 'q';
}
var_dump($array);
?>
--EXPECT--
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
array(3) {
[0]=>
string(2) "aq"
[1]=>
string(2) "bq"
[2]=>
&string(2) "cq"
}
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #67938: Segfault when extending interface method with variadic
--FILE--
<?php
interface TestInterface {
public function foo();
public function bar(array $bar);
}
class Test implements TestInterface {
public function foo(...$args) {
echo __METHOD__, "\n";
}
public function bar(array $bar, ...$args) {
echo __METHOD__, "\n";
}
}
$obj = new Test;
$obj->foo();
$obj->bar([]);
?>
--EXPECT--
Test::foo
Test::bar
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #67985 - Last used array index not copied to new array at assignment
--FILE--
<?php
$a = ['zero', 'one', 'two'];
unset($a[2]);
$b = $a;
$a[] = 'three';
$b[] = 'three';
var_dump($a === $b);
?>
--EXPECT--
bool(true)
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #68118: $a->foo .= 'test'; can leave $a->foo undefined
--FILE--
<?php
set_error_handler(function() {
$obj = new stdClass;
$obj->test = 'meow';
return true;
});
$a = new stdClass;
$a->undefined .= 'test';
var_dump($a);
?>
--EXPECT--
object(stdClass)#2 (1) {
["undefined"]=>
string(4) "test"
}
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #68370 "unset($this)" can make the program crash
--FILE--
<?php
class C {
public function test() {
unset($this);
return get_defined_vars();
}
}
$c = new C();
$x = $c->test();
print_r($x);
unset($c, $x);
--EXPECTF--
Array
(
)
-36
View File
@@ -1,36 +0,0 @@
--TEST--
Bug #68446 (Array constant not accepted for array parameter default)
--FILE--
<?php
const FOO = [1];
const BAR = null;
function a(array $a = FOO) {
var_dump($a);
}
function b(array $b = BAR) {
var_dump($b);
}
b(null);
b([]);
b();
a([]);
a();
a(null);
?>
--EXPECTF--
NULL
array(0) {
}
NULL
array(0) {
}
array(1) {
[0]=>
int(1)
}
Catchable fatal error: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s on line %d
-40
View File
@@ -1,40 +0,0 @@
--TEST--
Bug #68652 (segmentation fault in destructor)
--FILE--
<?php
class Foo {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Bar::getInstance();
}
}
class Bar {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Foo::getInstance();
}
}
$foo = new Foo();
?>
--EXPECTF--
Fatal error: Access to undeclared static property: Bar::$instance in %sbug68652.php on line %d
-42
View File
@@ -1,42 +0,0 @@
--TEST--
#69017 (Fail to push to the empty array with the constant value defined in class scope)
--FILE--
<?php
class c1
{
const ZERO = 0;
const ONE = 1;
const MAX = PHP_INT_MAX;
public static $a1 = array(self::ONE => 'one');
public static $a2 = array(self::ZERO => 'zero');
public static $a3 = array(self::MAX => 'zero');
}
c1::$a1[] = 1;
c1::$a2[] = 1;
c1::$a3[] = 1;
var_dump(c1::$a1);
var_dump(c1::$a2);
var_dump(c1::$a3);
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d
array(2) {
[1]=>
string(3) "one"
[2]=>
int(1)
}
array(2) {
[0]=>
string(4) "zero"
[1]=>
int(1)
}
array(1) {
[%d]=>
string(4) "zero"
}
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #69174 (leaks when unused inner class use traits precedence)
--FILE--
<?php
function test() {
class C1 {
use T1, T2 {
T1::foo insteadof T2;
T1::bar insteadof T2;
}
}
}
?>
==DONE==
--EXPECT--
==DONE==
-43
View File
@@ -1,43 +0,0 @@
--TEST--
Bug #69212: Leaking VIA_HANDLER func when exception thrown in __call/... arg passing
--FILE--
<?php
class Test {
public static function __callStatic($method, $args) {}
public function __call($method, $args) {}
}
function do_throw() { throw new Exception; }
try {
Test::foo(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
(new Test)->bar(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$f = function () {};
$f->__invoke(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$t = new Test;
$f->__invoke($t->bar(Test::foo(do_throw())));
} catch (Exception $e) {
echo "Caught!\n";
}
?>
--EXPECT--
Caught!
Caught!
Caught!
Caught!
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #69221: Segmentation fault when using a generator in combination with an Iterator
--FILE--
<?php
function gen() {
yield 1;
};
$gen1 = gen();
$gen2 = (object) $gen1;
foreach ($gen1 as $v1) {
foreach ($gen2 as $v2) {
break 2;
}
}
unset($gen1);
foreach ($gen2 as $v) { var_dump($v); }
?>
--EXPECTF--
int(1)
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #69221: Segmentation fault when using a generator in combination with an Iterator (2)
--FILE--
<?php
$gen = function() {
yield 1;
};
$iter = new IteratorIterator($gen());
$ngen = $iter->getInnerIterator();
var_dump(iterator_to_array($ngen, false));
?>
--EXPECT--
array(1) {
[0]=>
int(1)
}
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #69420 (Invalid read in zend_std_get_method)
--FILE--
<?php
trait T {
protected function test() {
echo "okey";
}
}
class A {
protected function test() {
}
}
class B extends A {
use T;
public function foo() {
$this->test();
}
}
$b = new B();
$b->foo();
?>
--EXPECT--
okey
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #69467 (Wrong checked for the interface by using Trait)
--FILE--
<?php
interface Baz {
public function bad();
}
trait Bar{
protected function bad(){}
}
class Foo implements Baz{
use Bar;
}
$test = new Foo();
var_dump($test instanceof Baz);
?>
--EXPECTF--
Fatal error: Access level to Bar::bad() must be public (as in class Baz) in %sbug69467.php on line %d
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #69537 (__debugInfo with empty string for key gives error)
--FILE--
<?php
class Foo {
public function __debugInfo(){
return ['' => 1];
}
}
var_dump(new Foo);
?>
--EXPECTF--
object(Foo)#%d (%d) {
[""]=>
int(1)
}
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #69551 - parse_ini_file() and parse_ini_string() segmentation fault
--FILE--
<?php
$ini = <<<INI
[Network.eth0]
SubnetMask = "
"
INI;
$settings = parse_ini_string($ini, false, INI_SCANNER_RAW);
var_dump($settings);
?>
--EXPECTF--
Warning: syntax error, unexpected '"' in Unknown on line %d
in %s on line %d
bool(false)
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #69599: Strange generator+exception+variadic crash
--FILE--
<?php
function crash() {
sin(...[0]);
throw new \Exception();
yield;
}
iterator_to_array(crash());
?>
--EXPECTF--
Fatal error: Uncaught exception 'Exception' in %s:%d
Stack trace:
#0 [internal function]: crash()
#1 %s(%d): iterator_to_array(Object(Generator))
#2 {main}
thrown in %s on line %d
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #69732 (can induce segmentation fault with basic php code)
--FILE--
<?php
class wpq {
private $unreferenced;
public function __get($name) {
return $this->$name . "XXX";
}
}
function ret_assoc() {
$x = "XXX";
return array('foo' => 'bar', $x);
}
$wpq = new wpq;
$wpq->interesting =& ret_assoc();
$x = $wpq->interesting;
printf("%s\n", $x);
--EXPECTF--
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
Fatal error: Cannot assign by reference to overloaded object in %sbug69732.php on line 16
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #69740: finally in generator (yield) swallows exception in iteration
--FILE--
<?php
function generate() {
try {
yield 1;
yield 2;
} finally {
echo "finally\n";
}
}
foreach (generate() as $i) {
echo $i, "\n";
throw new Exception();
}
?>
--EXPECTF--
1
finally
Fatal error: Uncaught exception 'Exception' in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Bug #69892: Different arrays compare indentical due to integer key truncation
--SKIPIF--
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
--FILE--
<?php
var_dump([0 => 0] === [0x100000000 => 0]);
?>
--EXPECT--
bool(false)
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Bug #70012 (Exception lost with nested finally block)
--FILE--
<?php
try {
echo "Outer try\n";
try {
echo " Middle try\n";
throw new Exception();
} finally {
echo " Middle finally\n";
try {
echo " Inner try\n";
} finally {
echo " Inner finally\n";
}
}
echo "Outer shouldnt get here\n";
} catch (Exception $e) {
echo "Outer catch\n";
} finally {
echo "Outer finally\n";
}
?>
--EXPECT--
Outer try
Middle try
Middle finally
Inner try
Inner finally
Outer catch
Outer finally
-9
View File
@@ -1,9 +0,0 @@
--TEST--
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
--FILE--
<?php
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
?>
OK
--EXPECT--
OK
-16
View File
@@ -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)
-22
View File
@@ -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 bind function SplDoublyLinkedList::count to scope class cls in %s on line %d
NULL
-20
View File
@@ -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)
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant)
--FILE--
<?php
namespace test {
use const nonexistent;
class test {
static function run(){
var_dump(nonexistent);
existent;
}
}
}
namespace {
define("test\\existent", "bug!", 1);
test\test::run();
}
?>
--EXPECTF--
Notice: Use of undefined constant nonexistent - assumed 'nonexistent' in %sbug70828.php on line %d
string(11) "nonexistent"
-37
View File
@@ -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 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}"
string(%d) "exception 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}
Next exception 'Exception' with message 'Dummy' in %sbug70944.php:%d
Stack trace:
#0 {main}"
-22
View File
@@ -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 Bar extends Foo
{
use T;
}
?>
--EXPECTF--
Strict Standards: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
-21
View File
@@ -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"
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #71841 (EG(error_zval) is not handled well)
--INI--
error_reporting=0
--FILE--
<?php
$z = unserialize('O:1:"A":0:{}');
var_dump($z->e.=0);
var_dump(++$z->x);
var_dump($z->y++);
$y = array(PHP_INT_MAX => 0);
var_dump($y[] .= 0);
var_dump(++$y[]);
var_dump($y[]++);
?>
--EXPECT--
NULL
NULL
NULL
NULL
NULL
NULL
-43
View File
@@ -1,43 +0,0 @@
--TEST--
Bug #72496 (declare public method with signature incompatible with parent private method should not throw a warning)
--FILE--
<?php
class Foo
{
private function getFoo()
{
return 'Foo';
}
private function getBar()
{
return 'Bar';
}
private function getBaz()
{
return 'Baz';
}
}
class Bar extends Foo
{
public function getFoo($extraArgument)
{
return $extraArgument;
}
protected function getBar($extraArgument)
{
return $extraArgument;
}
private function getBaz($extraArgument)
{
return $extraArgument;
}
}
echo "OK\n";
--EXPECT--
OK
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #72907 (null pointer deref, segfault in gc_remove_zval_from_buffer (zend_gc.c:260))
--FILE--
<?php
$a = 0;
($a->a = &$E) + ($b = $a->b->i -= 0);
?>
--EXPECTF--
Warning: Attempt to modify property of non-object in %sbug72907.php on line %d
Warning: Attempt to modify property of non-object in %sbug72907.php on line %d
Warning: Creating default object from empty value in %sbug72907.php on line %d
Notice: Undefined property: stdClass::$i in %sbug72907.php on line %d
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #73337 (try/catch not working with two exceptions inside a same operation)
--FILE--
<?php
class d { function __destruct() { throw new Exception; } }
try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
?>
--EXPECTF--
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Exception properly caught
-1
View File
@@ -1 +0,0 @@
0=0&~2000000000
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #74603 (PHP INI Parsing Stack Buffer Overflow Vulnerability)
--SKIPIF--
<?php
if (PHP_INT_MAX !== 2147483647)
die('skip for 32-bit only');
--FILE--
<?php
var_dump(parse_ini_file(__DIR__ . "/bug74603.ini", true, INI_SCANNER_NORMAL));
?>
--EXPECT--
array(1) {
[0]=>
string(1) "0"
}
-13
View File
@@ -1,13 +0,0 @@
--TEST--
Class Property Expressions
--FILE--
<?php
class Foo {
const BAR = 1 << 0;
const BAZ = 1 << 1;
public $bar = self::BAR | self::BAZ;
}
echo (new Foo)->bar;
?>
--EXPECTF--
3
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Static Class Property Expressions
--FILE--
<?php
class Foo {
public $b1 = 1 + 1;
public $b2 = 1 << 2;
public $b3 = "foo " . " bar " . " baz";
}
$f = new Foo;
var_dump(
$f->b1,
$f->b2,
$f->b3
);
?>
--EXPECT--
int(2)
int(4)
string(13) "foo bar baz"
Loaded 100 of 3198 files, more files were not shown because too many files have changed in this diff. Show more