mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 18:05:42 +00:00
Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74b85316ea | ||
|
|
1e41295097 | ||
|
|
5406f21b11 | ||
|
|
b37f1d58d2 | ||
|
|
fb2d079645 | ||
|
|
08302c0d6d | ||
|
|
cc4b7be41e | ||
|
|
5aa9712b0a | ||
|
|
4c5b385ff5 | ||
|
|
621fd74c01 | ||
|
|
721fc9e80d | ||
|
|
15a23b1218 | ||
|
|
10a3260b1f | ||
|
|
2705d17c93 | ||
|
|
994d4350d3 | ||
|
|
eef80c5837 | ||
|
|
61e7391873 | ||
|
|
92e90c09f0 | ||
|
|
dd2a36a207 | ||
|
|
4638f7b914 |
No files matched your search
@@ -73,7 +73,7 @@ define dump_bt
|
||||
|
||||
set $callFrameSize = (sizeof(zend_execute_data) + sizeof(zval) - 1) / sizeof(zval)
|
||||
|
||||
set $count = $ex->This.u2.num_args
|
||||
set $count = $ex->num_args
|
||||
set $arg = 0
|
||||
while $arg < $count
|
||||
if $arg > 0
|
||||
@@ -101,7 +101,7 @@ define dump_bt
|
||||
____print_str $zvalue->value.str->val $zvalue->value.str->len
|
||||
end
|
||||
if $type == 7
|
||||
printf "array(%d)[%p]", $zvalue->value.arr->nNumOfElements, $zvalue
|
||||
printf "array(%d)[%p]", $zvalue->value.arr->ht->nNumOfElements, $zvalue
|
||||
end
|
||||
if $type == 8
|
||||
printf "object[%p]", $zvalue
|
||||
@@ -152,8 +152,8 @@ define ____printzv_contents
|
||||
set $type = $zvalue->u1.v.type
|
||||
|
||||
# 15 == IS_INDIRECT
|
||||
if $type > 5 && $type != 15
|
||||
printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount
|
||||
if $type >= 5 && $type != 15
|
||||
printf "(refcount=%d) ", $zvalue->value.counted->refcount
|
||||
end
|
||||
|
||||
if $type == 0
|
||||
@@ -181,7 +181,7 @@ define ____printzv_contents
|
||||
printf "array: "
|
||||
if ! $arg1
|
||||
set $ind = $ind + 1
|
||||
____print_ht $zvalue->value.arr 1
|
||||
____print_ht $zvalue->value.ht 1
|
||||
set $ind = $ind - 1
|
||||
set $i = $ind
|
||||
while $i > 0
|
||||
|
||||
+6
-4
@@ -21,9 +21,6 @@
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.xz
|
||||
*.tar.gz.asc
|
||||
*.tar.bz2.asc
|
||||
*.tar.xz.asc
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
@@ -191,7 +188,6 @@ ext/iconv/php_have_glibc_iconv.h
|
||||
ext/iconv/php_php_iconv_impl.h
|
||||
ext/iconv/php_have_iconv.h
|
||||
ext/iconv/php_iconv_supports_errno.h
|
||||
ext/iconv/php_iconv_broken_ignore.h
|
||||
ext/mbstring/libmbfl/Makefile.in
|
||||
ext/mbstring/libmbfl/autoscan.log
|
||||
ext/mbstring/libmbfl/config.sub
|
||||
@@ -245,6 +241,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
|
||||
@@ -284,3 +284,5 @@ win32/*.positions
|
||||
win32/ext
|
||||
win32/phpts.def
|
||||
win32/wsyslog.h
|
||||
win32/win32.dsp
|
||||
win32/php.dsw
|
||||
+14
-26
@@ -1,33 +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
|
||||
- libsasl2-dev
|
||||
- libxpm-dev
|
||||
- libt1-dev
|
||||
|
||||
branches:
|
||||
except:
|
||||
- phpng
|
||||
|
||||
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
|
||||
@@ -45,6 +24,13 @@ env:
|
||||
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
|
||||
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev libsasl2-dev libxpm-dev libt1-dev libc-client2007e-dev
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
@@ -54,7 +40,9 @@ before_script:
|
||||
- . ./travis/ext/pdo_mysql/setup.sh
|
||||
- . ./travis/ext/pgsql/setup.sh
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
- . ./travis/ext/imap/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script:
|
||||
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php $(if [ $ENABLE_DEBUG == 1 ]; then echo "-d opcache.enable_cli=1 -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --set-timeout 120
|
||||
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg
|
||||
+1
-3
@@ -18,7 +18,6 @@ Code Implementation
|
||||
|
||||
For instance, ``function int mail(char *to, char *from)`` should NOT free
|
||||
to and/or from.
|
||||
|
||||
Exceptions:
|
||||
|
||||
- The function's designated behavior is freeing that resource. E.g. efree()
|
||||
@@ -113,7 +112,6 @@ User Functions/Methods Naming Conventions
|
||||
of ``parent_*``::
|
||||
|
||||
A family of 'foo' functions, for example:
|
||||
|
||||
Good:
|
||||
'foo_select_bar'
|
||||
'foo_insert_baz'
|
||||
@@ -178,7 +176,7 @@ Internal Function Naming Convensions
|
||||
Unexposed module function should be static and should not be defined in
|
||||
'php_modulename.h'.
|
||||
|
||||
static int php_session_destroy()
|
||||
static int php_session_destroy(TSRMLS_D)
|
||||
|
||||
2. Main module source file must be named 'modulename.c'.
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
# Contributing to PHP
|
||||
|
||||
Anybody who programs in PHP can be a contributing member of the community that
|
||||
develops and deploys it; the task of deploying PHP, documentation and
|
||||
associated websites is a never ending one. With every release, or release
|
||||
candidate comes a wave of work, which takes a lot of organization and
|
||||
co-ordination.
|
||||
|
||||
## Pull requests
|
||||
|
||||
PHP welcomes pull requests to [add tests](#writing-tests), fix bugs and to
|
||||
implement RFCs. Please be sure to include tests as appropriate!
|
||||
|
||||
If you are fixing a bug, then please submit your PR against the lowest branch
|
||||
of PHP that the bug affects, or the oldest fully supported version (the first
|
||||
green branch on
|
||||
[the supported version page](http://php.net/supported-versions.php). For
|
||||
example, at the time of writing in mid-2015, this is PHP 5.5, which corresponds
|
||||
to the `PHP-5.5` branch in Git. Please also make sure you add a link to the PR
|
||||
in the bug on [the bug tracker](https://bugs.php.net/).
|
||||
|
||||
Pull requests to implement RFCs should be submitted against `master`.
|
||||
|
||||
## Filing bugs
|
||||
|
||||
Bugs can be filed on the [PHP bug tracker](https://bugs.php.net/). If this is
|
||||
the first time you've filed a bug, we suggest reading the
|
||||
[guide to reporting a bug](https://bugs.php.net/how-to-report.php).
|
||||
|
||||
Where possible, please include a self-contained reproduction case!
|
||||
|
||||
## Feature requests
|
||||
|
||||
Feature requests are generally submitted in the form of
|
||||
[Requests for Comment](https://wiki.php.net/rfc/howto), ideally accompanied by
|
||||
[pull requests](#pull-requests). You can find the extremely large list of RFCs
|
||||
that have been previously considered on the
|
||||
[PHP Wiki](https://wiki.php.net/rfc).
|
||||
|
||||
You may want to read
|
||||
[The Mysterious PHP RFC Process](https://blogs.oracle.com/opal/entry/the_mysterious_php_rfc_process)
|
||||
for additional notes on the best way to approach submitting an RFC.
|
||||
|
||||
## Writing tests
|
||||
|
||||
We love getting new tests! PHP is a huge project and improving code coverage is
|
||||
a huge win for every PHP user.
|
||||
|
||||
[Our QA site includes a page detailing how to write test cases.](http://qa.php.net/write-test.php)
|
||||
Please note that the section on submitting pull requests is outdated: in
|
||||
addition to the process listed there, you can also
|
||||
[submit pull requests](#pull-requests).
|
||||
|
||||
## Writing documentation
|
||||
|
||||
There are two ways to contribute to the PHP manual. You can edit the manual and
|
||||
send patches anonymously via [the online editor](https://edit.php.net/), or you
|
||||
can check the XML source out from Subversion and edit that and build it
|
||||
[per the instructions on the documentation site](http://doc.php.net/tutorial/).
|
||||
Patches created that way should be sent to the
|
||||
[documentation mailing list](mailto:phpdoc@lists.php.net).
|
||||
|
||||
## Getting help
|
||||
|
||||
If you are having trouble contributing to PHP, or just want to talk to a human
|
||||
about what you're working on, you can contact us via the
|
||||
[internals mailing list](mailto:internals@lists.php.net), or the
|
||||
[documentation mailing list](mailto:phpdoc@lists.php.net) for documentation
|
||||
issues.
|
||||
|
||||
Although not a formal channel, you can also find a number of core developers on
|
||||
the #php.pecl channel on [EFnet](http://www.efnet.org/). Similarly, many
|
||||
documentation writers can be found on #php.doc.
|
||||
+84
-6
@@ -26,12 +26,34 @@ Status legend
|
||||
|
||||
== Server APIs ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aolserver
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache
|
||||
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache_hooks
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2filter
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2handler
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>, Ilia Alshanetsky <iliaa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: caudium
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
@@ -41,6 +63,11 @@ MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.
|
||||
STATUS: Working
|
||||
SINCE: 4.3.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: continuity
|
||||
PRIMARY MAINTAINER: Alex Leigh <aleigh@php.net>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: embed
|
||||
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -52,15 +79,50 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.3.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: litespeed
|
||||
PRIMARY MAINTAINER: George Wang <gwang@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phpdbg
|
||||
MAINTENANCE: Joe Watkins <krakjoe@php.net>, Bob Weinand <bwoebi@php.net>
|
||||
STATUS: 5.6
|
||||
EXTENSION: milter
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pi3web
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: tux
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: webjames
|
||||
PRIMARY MAINTAINER: Alex Waugh <alex@alexwaugh.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -78,6 +140,17 @@ PRIMARY MAINTAINER: Ard Biesheuvel <ard@ard.nu>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Tested on phpts and isapi versions
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysql
|
||||
PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqli
|
||||
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -162,6 +235,11 @@ STATUS: Working
|
||||
SINCE: 5.3
|
||||
COMMENT: Integrates SQLite 3 embeddable SQL database engine.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase_ct
|
||||
PRIMARY MAINTAINER: Timm Friebe <thekid@thekid.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== XML extensions ==
|
||||
@@ -323,13 +401,13 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: json
|
||||
PRIMARY MAINTAINER: Jakub Zelenka <bukka@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
PRIMARY MAINTAINER: Unknown
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>, Côme Bernigaud <mcmic@php.net>
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@@ -5,6 +5,7 @@ Installing PHP
|
||||
|
||||
* General Installation Considerations
|
||||
* Installation on Unix systems
|
||||
+ Apache 1.3.x on Unix systems
|
||||
+ Apache 2.x on Unix systems
|
||||
+ Lighttpd 1.4 on Unix systems
|
||||
+ Sun, iPlanet and Netscape servers on Sun Solaris
|
||||
@@ -102,6 +103,7 @@ Installation on Unix systems
|
||||
|
||||
Table of Contents
|
||||
|
||||
* Apache 1.3.x on Unix systems
|
||||
* Apache 2.x on Unix systems
|
||||
* Lighttpd 1.4 on Unix systems
|
||||
* Sun, iPlanet and Netscape servers on Sun Solaris
|
||||
@@ -161,6 +163,208 @@ Table of Contents
|
||||
you can't figure out why, see the Problems section.
|
||||
__________________________________________________________________
|
||||
|
||||
Apache 1.3.x on Unix systems
|
||||
|
||||
This section contains notes and hints specific to Apache installs of
|
||||
PHP on Unix platforms. We also have instructions and notes for Apache 2
|
||||
on a separate page.
|
||||
|
||||
You can select arguments to add to the configure on line 10 below from
|
||||
the list of core configure options and from extension specific options
|
||||
described at the respective places in the manual. The version numbers
|
||||
have been omitted here, to ensure the instructions are not incorrect.
|
||||
You will need to replace the 'xxx' here with the correct values from
|
||||
your files.
|
||||
|
||||
Example #1 Installation Instructions (Apache Shared Module Version) for
|
||||
PHP
|
||||
1. gunzip apache_xxx.tar.gz
|
||||
2. tar -xvf apache_xxx.tar
|
||||
3. gunzip php-xxx.tar.gz
|
||||
4. tar -xvf php-xxx.tar
|
||||
5. cd apache_xxx
|
||||
6. ./configure --prefix=/www --enable-module=so
|
||||
7. make
|
||||
8. make install
|
||||
9. cd ../php-xxx
|
||||
|
||||
10. Now, configure your PHP. This is where you customize your PHP
|
||||
with various options, like which extensions will be enabled. Do a
|
||||
./configure --help for a list of available options. In our example
|
||||
we'll do a simple configure with Apache 1 and MySQL support. Your
|
||||
path to apxs may differ from our example.
|
||||
|
||||
./configure --with-mysql --with-apxs=/www/bin/apxs
|
||||
|
||||
11. make
|
||||
12. make install
|
||||
|
||||
If you decide to change your configure options after installation,
|
||||
you only need to repeat the last three steps. You only need to
|
||||
restart apache for the new module to take effect. A recompile of
|
||||
Apache is not needed.
|
||||
|
||||
Note that unless told otherwise, 'make install' will also install PEAR,
|
||||
various PHP tools such as phpize, install the PHP CLI, and more.
|
||||
|
||||
13. Setup your php.ini file:
|
||||
|
||||
cp php.ini-development /usr/local/lib/php.ini
|
||||
|
||||
You may edit your .ini file to set PHP options. If you prefer your
|
||||
php.ini in another location, use --with-config-file-path=/some/path in
|
||||
step 10.
|
||||
|
||||
If you instead choose php.ini-production, be certain to read the list
|
||||
of changes within, as they affect how PHP behaves.
|
||||
|
||||
14. Edit your httpd.conf to load the PHP module. The path on the right hand
|
||||
side of the LoadModule statement must point to the path of the PHP
|
||||
module on your system. The make install from above may have already
|
||||
added this for you, but be sure to check.
|
||||
|
||||
LoadModule php7_module libexec/libphp7.so
|
||||
|
||||
15. And in the AddModule section of httpd.conf, somewhere under the
|
||||
ClearModuleList, add this:
|
||||
|
||||
AddModule mod_php7.c
|
||||
|
||||
16. Tell Apache to parse certain extensions as PHP. For example,
|
||||
let's have Apache parse the .php extension as PHP. You could
|
||||
have any extension(s) parse as PHP by simply adding more, with
|
||||
each separated by a space. We'll add .phtml to demonstrate.
|
||||
|
||||
AddType application/x-httpd-php .php .phtml
|
||||
|
||||
It's also common to setup the .phps extension to show highlighted PHP
|
||||
source, this can be done with:
|
||||
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
17. Use your normal procedure for starting the Apache server. (You must
|
||||
stop and restart the server, not just cause the server to reload by
|
||||
using a HUP or USR1 signal.)
|
||||
|
||||
Alternatively, to install PHP as a static object:
|
||||
|
||||
Example #2 Installation Instructions (Static Module Installation for
|
||||
Apache) for PHP
|
||||
1. gunzip -c apache_1.3.x.tar.gz | tar xf -
|
||||
2. cd apache_1.3.x
|
||||
3. ./configure
|
||||
4. cd ..
|
||||
|
||||
5. gunzip -c php-5.x.y.tar.gz | tar xf -
|
||||
6. cd php-5.x.y
|
||||
7. ./configure --with-mysql --with-apache=../apache_1.3.x
|
||||
8. make
|
||||
9. make install
|
||||
|
||||
10. cd ../apache_1.3.x
|
||||
|
||||
11. ./configure --prefix=/www --activate-module=src/modules/php7/libphp7.a
|
||||
(The above line is correct! Yes, we know libphp7.a does not exist at this
|
||||
stage. It isn't supposed to. It will be created.)
|
||||
|
||||
12. make
|
||||
(you should now have an httpd binary which you can copy to your Apache bin d
|
||||
ir if
|
||||
it is your first install then you need to "make install" as well)
|
||||
|
||||
13. cd ../php-5.x.y
|
||||
14. cp php.ini-development /usr/local/lib/php.ini
|
||||
|
||||
15. You can edit /usr/local/lib/php.ini file to set PHP options.
|
||||
Edit your httpd.conf or srm.conf file and add:
|
||||
AddType application/x-httpd-php .php
|
||||
|
||||
Depending on your Apache install and Unix variant, there are many
|
||||
possible ways to stop and restart the server. Below are some typical
|
||||
lines used in restarting the server, for different apache/unix
|
||||
installations. You should replace /path/to/ with the path to these
|
||||
applications on your systems.
|
||||
|
||||
Example #3 Example commands for restarting Apache
|
||||
1. Several Linux and SysV variants:
|
||||
/etc/rc.d/init.d/httpd restart
|
||||
|
||||
2. Using apachectl scripts:
|
||||
/path/to/apachectl stop
|
||||
/path/to/apachectl start
|
||||
|
||||
3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:
|
||||
/path/to/httpsdctl stop
|
||||
/path/to/httpsdctl start
|
||||
|
||||
4. Using mod_ssl, or another SSL server, you may want to manually
|
||||
stop and start:
|
||||
/path/to/apachectl stop
|
||||
/path/to/apachectl startssl
|
||||
|
||||
The locations of the apachectl and http(s)dctl binaries often vary. If
|
||||
your system has locate or whereis or which commands, these can assist
|
||||
you in finding your server control programs.
|
||||
|
||||
Different examples of compiling PHP for apache are as follows:
|
||||
./configure --with-apxs --with-pgsql
|
||||
|
||||
This will create a libphp7.so shared library that is loaded into Apache
|
||||
using a LoadModule line in Apache's httpd.conf file. The PostgreSQL
|
||||
support is embedded into this library.
|
||||
|
||||
./configure --with-apxs --with-pgsql=shared
|
||||
|
||||
This will create a libphp7.so shared library for Apache, but it will
|
||||
also create a pgsql.so shared library that is loaded into PHP either by
|
||||
using the extension directive in php.ini file or by loading it
|
||||
explicitly in a script using the dl() function.
|
||||
|
||||
./configure --with-apache=/path/to/apache_source --with-pgsql
|
||||
|
||||
This will create a libmodphp7.a library, a mod_php7.c and some
|
||||
accompanying files and copy this into the src/modules/php7 directory in
|
||||
the Apache source tree. Then you compile Apache using
|
||||
--activate-module=src/modules/php7/libphp7.a and the Apache build
|
||||
system will create libphp7.a and link it statically into the httpd
|
||||
binary. The PostgreSQL support is included directly into this httpd
|
||||
binary, so the final result here is a single httpd binary that includes
|
||||
all of Apache and all of PHP.
|
||||
|
||||
./configure --with-apache=/path/to/apache_source --with-pgsql=shared
|
||||
|
||||
Same as before, except instead of including PostgreSQL support directly
|
||||
into the final httpd you will get a pgsql.so shared library that you
|
||||
can load into PHP from either the php.ini file or directly using dl().
|
||||
|
||||
When choosing to build PHP in different ways, you should consider the
|
||||
advantages and drawbacks of each method. Building as a shared object
|
||||
will mean that you can compile apache separately, and don't have to
|
||||
recompile everything as you add to, or change, PHP. Building PHP into
|
||||
apache (static method) means that PHP will load and run faster. For
|
||||
more information, see the Apache » web page on DSO support.
|
||||
|
||||
Note:
|
||||
|
||||
Apache's default httpd.conf currently ships with a section that
|
||||
looks like this:
|
||||
|
||||
User nobody
|
||||
Group "#-1"
|
||||
|
||||
Unless you change that to "Group nogroup" or something like that
|
||||
("Group daemon" is also very common) PHP will not be able to open
|
||||
files.
|
||||
|
||||
Note:
|
||||
|
||||
Make sure you specify the installed version of apxs when using
|
||||
--with-apxs=/path/to/apxs . You must NOT use the apxs version that
|
||||
is in the apache sources but the one that is actually installed on
|
||||
your system.
|
||||
__________________________________________________________________
|
||||
__________________________________________________________________
|
||||
|
||||
Apache 2.x on Unix systems
|
||||
|
||||
This section contains notes and hints specific to Apache 2.x installs
|
||||
@@ -260,7 +464,7 @@ LoadModule php7_module modules/libphp7.so
|
||||
Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php7,
|
||||
and .phtml files to be executed as PHP, but nothing else, we'd use
|
||||
this:
|
||||
<FilesMatch "\.ph(p[2-7]?|tml)$">
|
||||
<FilesMatch "\.ph(p[2-6]?|tml)$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
And to allow .phps files to be handled by the php source filter,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2016 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2015 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
|
||||
|
||||
$(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
|
||||
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
|
||||
+1
-1
@@ -57,7 +57,7 @@ php_lcov.info: lcov-test
|
||||
cp $$x.bbg lcov_data/$$y.bbg ; \
|
||||
fi; \
|
||||
done; \
|
||||
for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
|
||||
for dir in ext/bcmath/libbcmath ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
|
||||
if test -d lcov_data/$$dir; then \
|
||||
rm -rf lcov_data/$$dir ; \
|
||||
fi; \
|
||||
|
||||
+2
-15
@@ -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"`; \
|
||||
@@ -130,18 +130,5 @@ distclean: clean
|
||||
fi
|
||||
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
||||
|
||||
prof-gen:
|
||||
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-generate all
|
||||
|
||||
prof-clean:
|
||||
find . -name \*.lo -o -name \*.o | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
prof-use:
|
||||
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all
|
||||
|
||||
|
||||
.PHONY: all clean install distclean test prof-gen prof-clean prof-use
|
||||
.PHONY: all clean install distclean test
|
||||
.NOEXPORT:
|
||||
+1
-1
@@ -172,7 +172,7 @@ PHP_FUNCTION(module_name_drawtext)
|
||||
zval *image = NULL;
|
||||
zval *font = NULL;
|
||||
|
||||
if (zend_parse_parameters(argc, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
|
||||
return;
|
||||
|
||||
if (image) {
|
||||
|
||||
+6
-6
@@ -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.
|
||||
|
||||
+37
-37
@@ -8,98 +8,98 @@ API adjustment to the old output control code:
|
||||
|
||||
Checking output control layers status:
|
||||
// Using OG()
|
||||
php_output_get_status();
|
||||
php_output_get_status(TSRMLS_C);
|
||||
|
||||
Starting the default output handler:
|
||||
// php_start_ob_buffer(NULL, 0, 1);
|
||||
php_output_start_default();
|
||||
// php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
|
||||
php_output_start_default(TSRMLS_C);
|
||||
|
||||
Starting an user handler by zval:
|
||||
// php_start_ob_buffer(zhandler, chunk_size, erase);
|
||||
php_output_start_user(zhandler, chunk_size, flags);
|
||||
// php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
|
||||
php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
|
||||
|
||||
Starting an internal handler whithout context:
|
||||
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase);
|
||||
php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags);
|
||||
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
|
||||
php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
|
||||
|
||||
Starting an internal handler with context:
|
||||
// not possible with old API
|
||||
php_output_handler *h;
|
||||
h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags);
|
||||
h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
|
||||
php_output_handler_set_context(h, my_context, my_context_dtor);
|
||||
php_output_handler_start(h);
|
||||
php_output_handler_start(h TSRMLS_CC);
|
||||
|
||||
Testing whether a certain output handler has already been started:
|
||||
// php_ob_handler_used("output handler name");
|
||||
php_output_handler_started(handler_name, handler_name_len);
|
||||
// php_ob_handler_used("output handler name" TSRMLS_CC);
|
||||
php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
|
||||
|
||||
Flushing one output buffer:
|
||||
// php_end_ob_buffer(1, 1);
|
||||
php_output_flush();
|
||||
// php_ob_end_buffer(1, 1 TSRMLS_CC);
|
||||
php_output_flush(TSRMLS_C);
|
||||
|
||||
Flushing all output buffers:
|
||||
// not possible with old API
|
||||
php_output_flush_all();
|
||||
php_output_flush_all(TSRMLS_C);
|
||||
|
||||
Cleaning one output buffer:
|
||||
// php_ob_end_buffer(0, 1);
|
||||
php_output_clean();
|
||||
// php_ob_end_buffer(0, 1 TSRMLS_CC);
|
||||
php_output_clean(TSRMLS_C);
|
||||
|
||||
Cleaning all output buffers:
|
||||
// not possible with old API
|
||||
php_output_clean_all();
|
||||
php_output_clean_all(TSRMLS_C);
|
||||
|
||||
Discarding one output buffer:
|
||||
// php_ob_end_buffer(0, 0);
|
||||
php_output_discard();
|
||||
// php_ob_end_buffer(0, 0 TSRMLS_CC);
|
||||
php_output_discard(TSRMLS_C);
|
||||
|
||||
Discarding all output buffers:
|
||||
// php_ob_end_buffers(0);
|
||||
php_output_discard_all();
|
||||
// php_ob_end_buffers(0 TSRMLS_CC);
|
||||
php_output_discard_all(TSRMLS_C);
|
||||
|
||||
Stopping (and dropping) one output buffer:
|
||||
// php_ob_end_buffer(1, 0)
|
||||
php_output_end();
|
||||
// php_ob_end_buffer(1, 0 TSRMLS_CC)
|
||||
php_output_end(TSRMLS_C);
|
||||
|
||||
Stopping (and dropping) all output buffers:
|
||||
// php_ob_end_buffers(1, 0);
|
||||
php_output_end_all();
|
||||
// php_ob_end_buffers(1, 0 TSRMLS_CC);
|
||||
php_output_end_all(TSRMLS_C);
|
||||
|
||||
Retrieving output buffers contents:
|
||||
// php_ob_get_buffer(zstring);
|
||||
php_output_get_contents(zstring);
|
||||
// php_ob_get_buffer(zstring TSRMLS_CC);
|
||||
php_output_get_contents(zstring TSRMLS_CC);
|
||||
|
||||
Retrieving output buffers length:
|
||||
// php_ob_get_length(zlength);
|
||||
php_output_get_length(zlength);
|
||||
// php_ob_get_length(zlength TSRMLS_CC);
|
||||
php_output_get_length(zlength TSRMLS_CC);
|
||||
|
||||
Retrieving output buffering level:
|
||||
// OG(nesting_level);
|
||||
php_output_get_level();
|
||||
php_output_get_level(TSRMLS_C);
|
||||
|
||||
Issue a warning because of an output handler conflict:
|
||||
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name");
|
||||
php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len);
|
||||
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
|
||||
php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len TSRMLS_CC);
|
||||
|
||||
Registering a conflict checking function, which will be checked prior starting the handler:
|
||||
// not possible with old API, unless hardcoding into output.c
|
||||
php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t);
|
||||
php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
|
||||
|
||||
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
|
||||
// not possible with old API
|
||||
php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t);
|
||||
php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
|
||||
|
||||
Facilitating a context from within an output handler callable with ob_start():
|
||||
// not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr);
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
|
||||
|
||||
Disabling of the output handler by itself:
|
||||
//not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL);
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
|
||||
|
||||
Marking an output handler immutable by itself because of irreversibility of its operation:
|
||||
// not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL);
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
|
||||
|
||||
Restarting the output handler because of a CLEAN operation:
|
||||
// not possible with old API
|
||||
|
||||
@@ -13,8 +13,8 @@ meaningful error messages.
|
||||
Prototypes
|
||||
----------
|
||||
/* Implemented. */
|
||||
int zend_parse_parameters(int num_args, char *type_spec, ...);
|
||||
int zend_parse_parameters_ex(int flags, int num_args, char *type_spec, ...);
|
||||
int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
|
||||
|
||||
The zend_parse_parameters() function takes the number of parameters
|
||||
passed to the extension function, the type specifier string, and the
|
||||
@@ -30,7 +30,7 @@ resources cannot be auto-converted.
|
||||
|
||||
PHP 5.5 includes a new function:
|
||||
|
||||
int zend_parse_parameter(int flags, int arg_num, zval **arg, const char *spec, ...);
|
||||
int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg, const char *spec, ...);
|
||||
|
||||
This function behaves like zend_parse_parameters_ex() except that instead of
|
||||
reading the arguments from the stack, it receives a single zval to convert
|
||||
@@ -59,14 +59,14 @@ Type specifiers
|
||||
h - array (returned as HashTable*)
|
||||
H - array or HASH_OF(object) (returned as HashTable*)
|
||||
l - long (zend_long)
|
||||
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long, ZEND_LONG_MAX/ZEND_LONG_MIN)
|
||||
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long)
|
||||
o - object of any type (zval*)
|
||||
O - object of specific type given by class entry (zval*, zend_class_entry)
|
||||
p - valid path (string without null bytes in the middle) and its length (char*, size_t)
|
||||
P - valid path (string without null bytes in the middle) as zend_string (zend_string*)
|
||||
P - valid path (string without null bytes in the middle) as zend_string (zend_string)
|
||||
r - resource (zval*)
|
||||
s - string (with possible null bytes) and its length (char*, size_t)
|
||||
S - string (with possible null bytes) as zend_string (zend_string*)
|
||||
S - string (with possible null bytes) as zend_string (zend_string)
|
||||
z - the actual zval (zval*)
|
||||
* - variable arguments list (0 or more)
|
||||
+ - variable arguments list (1 or more)
|
||||
@@ -97,11 +97,11 @@ Both mistakes might cause memory corruptions and segfaults:
|
||||
1)
|
||||
char *str;
|
||||
long str_len; /* XXX THIS IS WRONG!! Use size_t instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len)
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
|
||||
|
||||
2)
|
||||
int num; /* XXX THIS IS WRONG!! Use zend_long instead. */
|
||||
zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num)
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
|
||||
|
||||
If you're in doubt, use check_parameters.php script to the parameters
|
||||
and their types (it can be found in ./scripts/dev/ directory of PHP sources):
|
||||
@@ -116,7 +116,7 @@ zend_long l;
|
||||
char *s;
|
||||
size_t s_len;
|
||||
zval *param;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lsz",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
|
||||
&l, &s, &s_len, ¶m) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lsz",
|
||||
zval *obj;
|
||||
double d = 0.5;
|
||||
zend_class_entry *my_ce;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|d",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
|
||||
&obj, my_ce, &d) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|d",
|
||||
If null is passed for object, obj will be set to NULL. */
|
||||
zval *obj;
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
|
||||
&obj, &arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a",
|
||||
|
||||
/* Gets a separated array which can also be null. */
|
||||
zval *arr;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/!",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
|
||||
&arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -161,10 +161,10 @@ char *s;
|
||||
*/
|
||||
size_t length;
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"lll", &l1, &l2, &l3) == SUCCESS) {
|
||||
/* manipulate longs */
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
|
||||
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"s", &s, &length) == SUCCESS) {
|
||||
/* manipulate string */
|
||||
} else {
|
||||
@@ -180,7 +180,7 @@ int i, num_varargs;
|
||||
zval *varargs = NULL;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &varargs, &num_varargs) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ size_t str_len;
|
||||
int i, num_varargs;
|
||||
zval *varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ zval *array;
|
||||
int i, num_varargs;
|
||||
zval *varargs = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+44
-19
@@ -5,16 +5,17 @@
|
||||
5. ext/standard crypt
|
||||
6. ext/standard crypt's blowfish implementation
|
||||
7. Sqlite/Sqlite3 ext/sqlite3 ext/sqlite
|
||||
8. ext/standard/rand
|
||||
9. ext/standard/scanf
|
||||
10. ext/standard/strnatcmp.c
|
||||
11. ext/standard/uuencode
|
||||
12. libxmlrpc ext/xmlrpc
|
||||
13. libzip ext/zip
|
||||
14. main/snprintf.c
|
||||
15. main/strlcat
|
||||
16. main/strlcpy
|
||||
17. libgd see ext/gd/libgd/COPYING
|
||||
8. ext/json/json_parser
|
||||
9. ext/standard/rand
|
||||
10. ext/standard/scanf
|
||||
11. ext/standard/strnatcmp.c
|
||||
12. ext/standard/uuencode
|
||||
13. libxmlrpc ext/xmlrpc
|
||||
14. libzip ext/zip
|
||||
15. main/snprintf.c
|
||||
16. main/strlcat
|
||||
17. main/strlcpy
|
||||
18. libgd see ext/gd/libgd/COPYING
|
||||
|
||||
5. ext/standard crypt
|
||||
|
||||
@@ -103,7 +104,31 @@ a legal notice, here is a blessing:
|
||||
May you share freely, never taking more than you give.
|
||||
|
||||
|
||||
8. ext/standard/rand
|
||||
8. ext/json/json_parser
|
||||
Copyright (c) 2005 JSON.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
The Software shall be used for Good, not Evil.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
9. ext/standard/rand
|
||||
The following php_mt_...() functions are based on a C++ class MTRand by
|
||||
Richard J. Wagner. For more information see the web page at
|
||||
http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html
|
||||
@@ -156,7 +181,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
9. ext/standard/scanf
|
||||
10. ext/standard/scanf
|
||||
scanf.c --
|
||||
|
||||
This file contains the base code which implements sscanf and by extension
|
||||
@@ -202,7 +227,7 @@ authors grant the U.S. Government and others acting in its behalf
|
||||
permission to use and distribute the software in accordance with the
|
||||
terms specified in this license.
|
||||
|
||||
10. ext/standard/strnatcmp.c
|
||||
11. ext/standard/strnatcmp.c
|
||||
|
||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
||||
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
|
||||
@@ -223,7 +248,7 @@ freely, subject to the following restrictions:
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
11. ext/standard/uuencode
|
||||
12. ext/standard/uuencode
|
||||
Portions of this code are based on Berkeley's uuencode/uudecode
|
||||
implementation.
|
||||
|
||||
@@ -259,7 +284,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
|
||||
12. libxmlrpc ext/xmlrpc
|
||||
13. libxmlrpc ext/xmlrpc
|
||||
|
||||
Copyright 2000 Epinions, Inc.
|
||||
|
||||
@@ -283,7 +308,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING
|
||||
NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
13. libzip ext/zip
|
||||
14. libzip ext/zip
|
||||
zip.h -- exported declarations.
|
||||
Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
|
||||
|
||||
@@ -315,7 +340,7 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
14. main/snprintf.c
|
||||
15. main/snprintf.c
|
||||
Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
@@ -388,8 +413,8 @@ This code is based on, and used with the permission of, the
|
||||
SIO stdio-replacement strx_* functions by Panos Tsirigotis
|
||||
<panos@alumni.cs.colorado.edu> for xinetd.
|
||||
|
||||
15. main/strlcat
|
||||
16. main/strlcpy
|
||||
16. main/strlcat
|
||||
17. main/strlcpy
|
||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
All rights reserved.
|
||||
|
||||
|
||||
+5
-17
@@ -213,14 +213,12 @@ 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
|
||||
@@ -266,14 +264,9 @@ to upgrade.
|
||||
|
||||
8. Commit all the changes to their respective git repos
|
||||
|
||||
9. Please note down the sha256 and the PGP signature (.asc). These *must* be
|
||||
included in the release mail.
|
||||
10. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
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)
|
||||
--------------------------------------
|
||||
@@ -290,9 +283,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
|
||||
@@ -309,6 +300,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.
|
||||
+3
-3
@@ -28,7 +28,7 @@ The main functions are:
|
||||
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
|
||||
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
|
||||
count);
|
||||
PHPAPI size_t php_stream_printf(php_stream * stream,
|
||||
PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC,
|
||||
const char * fmt, ...);
|
||||
PHPAPI int php_stream_eof(php_stream * stream);
|
||||
PHPAPI int php_stream_getc(php_stream * stream);
|
||||
@@ -47,7 +47,7 @@ Opening Streams
|
||||
In most cases, you should use this API:
|
||||
|
||||
PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
|
||||
int options, char **opened_path);
|
||||
int options, char **opened_path TSRMLS_DC);
|
||||
|
||||
Where:
|
||||
path is the file or resource to open.
|
||||
@@ -80,7 +80,7 @@ PHPAPI php_stream *php_stream_fopen_tmpfile(void);
|
||||
Open a FILE * with tmpfile() and convert into a stream.
|
||||
|
||||
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
|
||||
const char *pfx, char **opened_path);
|
||||
const char *pfx, char **opened_path TSRMLS_DC);
|
||||
Generate a temporary file name and open it.
|
||||
|
||||
There are some network enabled relatives in php_network.h:
|
||||
|
||||
+2
-3
@@ -104,8 +104,7 @@ The php file will be generated always.
|
||||
NOTE: You can set environment variable TEST_PHP_DETAILED to enable
|
||||
detailed test information.
|
||||
|
||||
[Automated Testing]
|
||||
--------------
|
||||
[Automated testing]
|
||||
If you like to keep up to speed, with latest developments and quality
|
||||
assurance, setting the environment variable NO_INTERACTION to 1, will not
|
||||
prompt the tester for any user input.
|
||||
@@ -143,7 +142,7 @@ then
|
||||
fi
|
||||
========== end of qa-test.sh =============
|
||||
|
||||
NOTE: The exit status of run-tests.php will be 1 when
|
||||
NOTE: the exit status of run-tests.php will be 1 when
|
||||
REPORT_EXIT_STATUS is set. The result of "make test" may be higher
|
||||
than that. At present, gmake 3.79.1 returns 2, so it is
|
||||
advised to test for non-zero, rather then a specific value.
|
||||
|
||||
+2
-2
@@ -138,7 +138,7 @@ SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
|
||||
strcpy(raw_var, "RAW_");
|
||||
strlcat(raw_var,var,var_len+5);
|
||||
|
||||
php_register_variable_ex(raw_var, &new_var, array_ptr);
|
||||
php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
|
||||
|
||||
php_strip_tags(*val, val_len, NULL, NULL, 0);
|
||||
|
||||
@@ -154,7 +154,7 @@ PHP_FUNCTION(my_get_raw)
|
||||
zval **tmp;
|
||||
zval *array_ptr = NULL;
|
||||
|
||||
if(zend_parse_parameters(2, "ls", &arg, &var, &var_len) == FAILURE) {
|
||||
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ The PHP Interpreter
|
||||
This is the github mirror of the official PHP repository located at
|
||||
http://git.php.net.
|
||||
|
||||
[](http://travis-ci.org/php/php-src)
|
||||
[](http://travis-ci.org/php/php-src)
|
||||
|
||||
Pull Requests
|
||||
=============
|
||||
|
||||
+1
-4
@@ -277,10 +277,7 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
|
||||
(*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
|
||||
(*thread_resources_ptr)->storage = NULL;
|
||||
if (id_count > 0) {
|
||||
(*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
|
||||
}
|
||||
(*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
|
||||
(*thread_resources_ptr)->count = id_count;
|
||||
(*thread_resources_ptr)->thread_id = thread_id;
|
||||
(*thread_resources_ptr)->next = NULL;
|
||||
|
||||
+8
-16
@@ -165,18 +165,12 @@ TSRM_API void *tsrm_get_ls_cache(void);
|
||||
|
||||
#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
|
||||
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache()
|
||||
#define TSRMG(id, type, element) (TSRMG_BULK(id, type)->element)
|
||||
#define TSRMG_BULK(id, type) ((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])
|
||||
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||
|
||||
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
|
||||
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
|
||||
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
|
||||
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
|
||||
#if ZEND_DEBUG
|
||||
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
|
||||
#else
|
||||
#define TSRMLS_CACHE_UPDATE() if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
|
||||
#endif
|
||||
#define TSRMG_STATIC(id, type, element) (((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||
#define TSRMLS_CACHE_EXTERN extern TSRM_TLS void *TSRMLS_CACHE
|
||||
#define TSRMLS_CACHE_DEFINE TSRM_TLS void *TSRMLS_CACHE = NULL
|
||||
#define TSRMLS_CACHE_UPDATE if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
|
||||
#define TSRMLS_CACHE _tsrm_ls_cache
|
||||
|
||||
/* BC only */
|
||||
@@ -197,13 +191,11 @@ TSRM_API void *tsrm_get_ls_cache(void);
|
||||
#define TSRMLS_SET_CTX(ctx)
|
||||
|
||||
#define TSRMG_STATIC(id, type, element)
|
||||
#define TSRMLS_CACHE_EXTERN()
|
||||
#define TSRMLS_CACHE_DEFINE()
|
||||
#define TSRMLS_CACHE_UPDATE()
|
||||
#define TSRMLS_CACHE_EXTERN
|
||||
#define TSRMLS_CACHE_DEFINE
|
||||
#define TSRMLS_CACHE_UPDATE
|
||||
#define TSRMLS_CACHE
|
||||
|
||||
#define TSRM_TLS
|
||||
|
||||
/* BC only */
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
# =================================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_func_which_gethostbyname_r.html
|
||||
# =================================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_FUNC_WHICH_GETHOSTBYNAME_R
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determines which historical variant of the gethostbyname_r() call
|
||||
# (taking three, five, or six arguments) is available on the system and
|
||||
# defines one of the following macros accordingly:
|
||||
#
|
||||
# HAVE_FUNC_GETHOSTBYNAME_R_6
|
||||
# HAVE_FUNC_GETHOSTBYNAME_R_5
|
||||
# HAVE_FUNC_GETHOSTBYNAME_R_3
|
||||
#
|
||||
# as well as
|
||||
#
|
||||
# HAVE_GETHOSTBYNAME_R
|
||||
#
|
||||
# If used in conjunction with gethostname.c, the API demonstrated in
|
||||
# test.c can be used regardless of which gethostbyname_r() is available.
|
||||
# These example files can be found at
|
||||
# http://www.csn.ul.ie/~caolan/publink/gethostbyname_r
|
||||
#
|
||||
# based on David Arnold's autoconf suggestion in the threads faq
|
||||
#
|
||||
# Originally named "AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R". Rewritten for
|
||||
# Autoconf 2.5x, and updated for 2.68 by Daniel Richard G.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Caolan McNamara <caolan@skynet.ie>
|
||||
# Copyright (c) 2008 Daniel Richard G. <skunk@iskunk.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_FUNC_WHICH_GETHOSTBYNAME_R], [
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
AC_MSG_CHECKING([how many arguments gethostbyname_r() takes])
|
||||
|
||||
AC_CACHE_VAL([ac_cv_func_which_gethostbyname_r], [
|
||||
|
||||
################################################################
|
||||
|
||||
ac_cv_func_which_gethostbyname_r=unknown
|
||||
|
||||
#
|
||||
# ONE ARGUMENT (sanity check)
|
||||
#
|
||||
|
||||
# This should fail, as there is no variant of gethostbyname_r() that takes
|
||||
# a single argument. If it actually compiles, then we can assume that
|
||||
# netdb.h is not declaring the function, and the compiler is thereby
|
||||
# assuming an implicit prototype. In which case, we're out of luck.
|
||||
#
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
|
||||
[
|
||||
char *name = "www.gnu.org";
|
||||
(void)gethostbyname_r(name) /* ; */
|
||||
])],
|
||||
[ac_cv_func_which_gethostbyname_r=no])
|
||||
|
||||
#
|
||||
# SIX ARGUMENTS
|
||||
# (e.g. Linux)
|
||||
#
|
||||
|
||||
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
|
||||
[
|
||||
char *name = "www.gnu.org";
|
||||
struct hostent ret, *retp;
|
||||
char buf@<:@1024@:>@;
|
||||
int buflen = 1024;
|
||||
int my_h_errno;
|
||||
(void)gethostbyname_r(name, &ret, buf, buflen, &retp, &my_h_errno) /* ; */
|
||||
])],
|
||||
[ac_cv_func_which_gethostbyname_r=six])
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
# FIVE ARGUMENTS
|
||||
# (e.g. Solaris)
|
||||
#
|
||||
|
||||
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
|
||||
[
|
||||
char *name = "www.gnu.org";
|
||||
struct hostent ret;
|
||||
char buf@<:@1024@:>@;
|
||||
int buflen = 1024;
|
||||
int my_h_errno;
|
||||
(void)gethostbyname_r(name, &ret, buf, buflen, &my_h_errno) /* ; */
|
||||
])],
|
||||
[ac_cv_func_which_gethostbyname_r=five])
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
# THREE ARGUMENTS
|
||||
# (e.g. AIX, HP-UX, Tru64)
|
||||
#
|
||||
|
||||
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
|
||||
[
|
||||
char *name = "www.gnu.org";
|
||||
struct hostent ret;
|
||||
struct hostent_data data;
|
||||
(void)gethostbyname_r(name, &ret, &data) /* ; */
|
||||
])],
|
||||
[ac_cv_func_which_gethostbyname_r=three])
|
||||
|
||||
fi
|
||||
|
||||
################################################################
|
||||
|
||||
]) dnl end AC_CACHE_VAL
|
||||
|
||||
case "$ac_cv_func_which_gethostbyname_r" in
|
||||
three|five|six)
|
||||
AC_DEFINE([HAVE_GETHOSTBYNAME_R], [1],
|
||||
[Define to 1 if you have some form of gethostbyname_r().])
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$ac_cv_func_which_gethostbyname_r" in
|
||||
three)
|
||||
AC_MSG_RESULT([three])
|
||||
AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_3], [1],
|
||||
[Define to 1 if you have the three-argument form of gethostbyname_r().])
|
||||
;;
|
||||
|
||||
five)
|
||||
AC_MSG_RESULT([five])
|
||||
AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_5], [1],
|
||||
[Define to 1 if you have the five-argument form of gethostbyname_r().])
|
||||
;;
|
||||
|
||||
six)
|
||||
AC_MSG_RESULT([six])
|
||||
AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_6], [1],
|
||||
[Define to 1 if you have the six-argument form of gethostbyname_r().])
|
||||
;;
|
||||
|
||||
no)
|
||||
AC_MSG_RESULT([cannot find function declaration in netdb.h])
|
||||
;;
|
||||
|
||||
unknown)
|
||||
AC_MSG_RESULT([can't tell])
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([internal error])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_LANG_POP
|
||||
|
||||
]) dnl end AC_DEFUN
|
||||
|
||||
+1
-3
@@ -1,4 +1,3 @@
|
||||
m4_include([TSRM/m4/gethostbyname.m4])
|
||||
|
||||
dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
|
||||
AC_DEFUN([TSRM_CHECK_GCC_ARG],[
|
||||
@@ -33,8 +32,6 @@ AC_CHECK_HEADERS(stdarg.h)
|
||||
|
||||
AC_CHECK_FUNCS(sigprocmask)
|
||||
|
||||
AX_FUNC_WHICH_GETHOSTBYNAME_R()
|
||||
|
||||
])
|
||||
|
||||
|
||||
@@ -92,6 +89,7 @@ else
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([TSRM_THREADS_CHECKS],[
|
||||
|
||||
dnl For the thread implementations, we always use --with-*
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+5
-17
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -43,13 +43,13 @@ static tsrm_win32_globals win32_globals;
|
||||
static void tsrm_win32_ctor(tsrm_win32_globals *globals)
|
||||
{
|
||||
#ifdef ZTS
|
||||
TSRMLS_CACHE_UPDATE();
|
||||
TSRMLS_CACHE_UPDATE;
|
||||
#endif
|
||||
globals->process = NULL;
|
||||
globals->shm = NULL;
|
||||
globals->process_size = 0;
|
||||
globals->shm_size = 0;
|
||||
globals->comspec = _strdup("cmd.exe");
|
||||
globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
|
||||
|
||||
/* Set it to INVALID_HANDLE_VALUE
|
||||
* It will be initialized correctly in tsrm_win32_access or set to
|
||||
@@ -437,7 +437,6 @@ static shm_pair *shm_get(int key, void *addr)
|
||||
TWG(shm) = newptr;
|
||||
ptr = newptr + TWG(shm_size);
|
||||
TWG(shm_size)++;
|
||||
memset(ptr, 0, sizeof(*ptr));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -599,8 +598,8 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
|
||||
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key);
|
||||
sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key);
|
||||
|
||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||
@@ -612,12 +611,6 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
created = TRUE;
|
||||
}
|
||||
if (!shm_handle || !info_handle) {
|
||||
if (shm_handle) {
|
||||
CloseHandle(shm_handle);
|
||||
}
|
||||
if (info_handle) {
|
||||
CloseHandle(info_handle);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -627,11 +620,6 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
}
|
||||
|
||||
shm = shm_get(key, NULL);
|
||||
if (!shm) {
|
||||
CloseHandle(shm_handle);
|
||||
CloseHandle(info_handle);
|
||||
return -1;
|
||||
}
|
||||
shm->segment = shm_handle;
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -72,7 +72,7 @@ typedef struct {
|
||||
|
||||
#ifdef ZTS
|
||||
# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
|
||||
TSRMLS_CACHE_EXTERN()
|
||||
TSRMLS_CACHE_EXTERN;
|
||||
#else
|
||||
# define TWG(v) (win32_globals.v)
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
PHP 7.0 UPGRADE NOTES
|
||||
$Id$
|
||||
|
||||
PHP X.Y UPGRADE NOTES
|
||||
|
||||
1. Backward Incompatible Changes
|
||||
2. New Features
|
||||
@@ -7,7 +9,7 @@
|
||||
5. Changed Functions
|
||||
6. New Functions
|
||||
7. New Classes and Interfaces
|
||||
8. Removed Extensions and SAPIs
|
||||
8. Removed Extensions
|
||||
9. Other Changes to Extensions
|
||||
10. New Global Constants
|
||||
11. Changes to INI File Handling
|
||||
@@ -19,431 +21,57 @@
|
||||
1. Backward Incompatible Changes
|
||||
========================================
|
||||
|
||||
Language changes
|
||||
================
|
||||
|
||||
Changes to variable handling
|
||||
----------------------------
|
||||
|
||||
* Indirect variable, property and method references are now interpreted with
|
||||
left-to-right semantics. Some examples:
|
||||
|
||||
$$foo['bar']['baz'] // interpreted as ($$foo)['bar']['baz']
|
||||
$foo->$bar['baz'] // interpreted as ($foo->$bar)['baz']
|
||||
$foo->$bar['baz']() // interpreted as ($foo->$bar)['baz']()
|
||||
Foo::$bar['baz']() // interpreted as (Foo::$bar)['baz']()
|
||||
|
||||
To restore the previous behavior add explicit curly braces:
|
||||
|
||||
${$foo['bar']['baz']}
|
||||
$foo->{$bar['baz']}
|
||||
$foo->{$bar['baz']}()
|
||||
Foo::{$bar['baz']}()
|
||||
|
||||
* The global keyword now only accepts simple variables. Instead of
|
||||
|
||||
global $$foo->bar;
|
||||
|
||||
it is now required to write the following:
|
||||
|
||||
global ${$foo->bar};
|
||||
|
||||
* Parentheses around variables or function calls no longer have any influence
|
||||
on behavior. For example the following code, where the result of a function
|
||||
call is passed to a by-reference function
|
||||
|
||||
function getArray() { return [1, 2, 3]; }
|
||||
|
||||
$last = array_pop(getArray());
|
||||
// Strict Standards: Only variables should be passed by reference
|
||||
$last = array_pop((getArray()));
|
||||
// Strict Standards: Only variables should be passed by reference
|
||||
|
||||
will now throw a strict standards error regardless of whether parentheses
|
||||
are used. Previously no notice was generated in the second case.
|
||||
|
||||
* Array elements or object properties that are automatically created during
|
||||
by-reference assignments will now result in a different order. For example
|
||||
|
||||
$array = [];
|
||||
$array["a"] =& $array["b"];
|
||||
$array["b"] = 1;
|
||||
var_dump($array);
|
||||
|
||||
now results in the array ["a" => 1, "b" => 1], while previously the result
|
||||
was ["b" => 1, "a" => 1];
|
||||
|
||||
Relevant RFCs:
|
||||
* https://wiki.php.net/rfc/uniform_variable_syntax
|
||||
* https://wiki.php.net/rfc/abstract_syntax_tree
|
||||
|
||||
Changes to list()
|
||||
-----------------
|
||||
|
||||
* list() will no longer assign variables in reverse order. For example
|
||||
|
||||
list($array[], $array[], $array[]) = [1, 2, 3];
|
||||
var_dump($array);
|
||||
|
||||
will now result in $array == [1, 2, 3] rather than [3, 2, 1]. Note that only
|
||||
the **order** of the assignments changed, but the assigned values stay the
|
||||
same. E.g. a normal usage like
|
||||
|
||||
list($a, $b, $c) = [1, 2, 3];
|
||||
// $a = 1; $b = 2; $c = 3;
|
||||
|
||||
will retain its current behavior.
|
||||
|
||||
* Empty list() assignments are no longer allowed. As such all of the following
|
||||
are invalid:
|
||||
|
||||
list() = $a;
|
||||
list(,,) = $a;
|
||||
list($x, list(), $y) = $a;
|
||||
|
||||
* list() no longer supports unpacking strings (while previously this was only
|
||||
supported in some cases). The code
|
||||
|
||||
$string = "xy";
|
||||
list($x, $y) = $string;
|
||||
|
||||
will now result in $x == null and $y == null (without notices) instead of
|
||||
$x == "x" and $y == "y". Furthermore list() is now always guaranteed to
|
||||
work with objects implementing ArrayAccess, e.g.
|
||||
|
||||
list($a, $b) = (object) new ArrayObject([0, 1]);
|
||||
|
||||
will now result in $a == 0 and $b == 1. Previously both $a and $b were null.
|
||||
|
||||
Relevant RFCs:
|
||||
* https://wiki.php.net/rfc/abstract_syntax_tree#changes_to_list
|
||||
* https://wiki.php.net/rfc/fix_list_behavior_inconsistency
|
||||
|
||||
Changes to foreach
|
||||
------------------
|
||||
|
||||
* Iteration with foreach() no longer has any effect on the internal array
|
||||
pointer, which can be accessed through the current()/next()/etc family of
|
||||
functions. For example
|
||||
|
||||
$array = [0, 1, 2];
|
||||
foreach ($array as &$val) {
|
||||
var_dump(current($array));
|
||||
}
|
||||
|
||||
will now print the value int(0) three times. Previously the output was int(1),
|
||||
int(2) and bool(false).
|
||||
|
||||
* When iterating arrays by-value, foreach will now always operate on a copy of
|
||||
the array, as such changes to the array during iteration will not influence
|
||||
iteration behavior. For example
|
||||
|
||||
$array = [0, 1, 2];
|
||||
$ref =& $array; // Necessary to trigger the old behavior
|
||||
foreach ($array as $val) {
|
||||
var_dump($val);
|
||||
unset($array[1]);
|
||||
}
|
||||
|
||||
will now print all three elements (0 1 2), while previously the second element
|
||||
1 was skipped (0 2).
|
||||
|
||||
* When iterating arrays by-reference, modifications to the array will continue
|
||||
to influence the iteration. However PHP will now do a better job of
|
||||
maintaining a correct position in a number of cases. E.g. appending to an
|
||||
array during by-reference iteration
|
||||
|
||||
$array = [0];
|
||||
foreach ($array as &$val) {
|
||||
var_dump($val);
|
||||
$array[1] = 1;
|
||||
}
|
||||
|
||||
will now iterate over the appended element as well. As such the output of this
|
||||
example will now be "int(0) int(1)", while previously it was only "int(0)".
|
||||
|
||||
* Iteration of plain (non-Traversable) objects by-value or by-reference will
|
||||
behave like by-reference iteration of arrays. This matches the previous
|
||||
behavior apart from the more accurate position management mentioned in the
|
||||
previous point.
|
||||
|
||||
* Iteration of Traversable objects remains unchanged.
|
||||
|
||||
Relevant RFC: https://wiki.php.net/rfc/php7_foreach
|
||||
|
||||
Changes to parameter handling
|
||||
-----------------------------
|
||||
|
||||
* It is no longer possible to define two function parameters with the same name.
|
||||
For example, the following method will trigger a compile-time error:
|
||||
|
||||
public function foo($a, $b, $unused, $unused) {
|
||||
// ...
|
||||
}
|
||||
|
||||
Code like this should be changed to use distinct parameter names, for example:
|
||||
|
||||
public function foo($a, $b, $unused1, $unused2) {
|
||||
// ...
|
||||
}
|
||||
|
||||
* The func_get_arg() and func_get_args() functions will no longer return the
|
||||
original value that was passed to a parameter and will instead provide the
|
||||
current value (which might have been modified). For example
|
||||
|
||||
function foo($x) {
|
||||
$x++;
|
||||
var_dump(func_get_arg(0));
|
||||
}
|
||||
foo(1);
|
||||
|
||||
will now print "2" instead of "1". This code should be changed to either
|
||||
perform modifications only after calling func_get_arg(s)
|
||||
|
||||
function foo($x) {
|
||||
var_dump(func_get_arg(0));
|
||||
$x++;
|
||||
}
|
||||
|
||||
or avoid modifying the parameters altogether:
|
||||
|
||||
function foo($x) {
|
||||
$newX = $x + 1;
|
||||
var_dump(func_get_arg(0));
|
||||
}
|
||||
|
||||
* Similarly exception backtraces will no longer display the original value that
|
||||
was passed to a function and show the modified value instead. For example
|
||||
|
||||
function foo($x) {
|
||||
$x = 42;
|
||||
throw new Exception;
|
||||
}
|
||||
foo("string");
|
||||
|
||||
will now result in the stack trace
|
||||
|
||||
Stack trace:
|
||||
#0 file.php(4): foo(42)
|
||||
#1 {main}
|
||||
|
||||
while previously it was:
|
||||
|
||||
Stack trace:
|
||||
#0 file.php(4): foo('string')
|
||||
#1 {main}
|
||||
|
||||
While this should not impact runtime behavior of your code, it is worthwhile
|
||||
to be aware of this difference for debugging purposes.
|
||||
|
||||
The same limitation also applies to debug_backtrace() and other functions
|
||||
inspecting function arguments.
|
||||
|
||||
Relevant RFC: https://wiki.php.net/phpng
|
||||
|
||||
Changes to integer handling
|
||||
---------------------------
|
||||
|
||||
* Invalid octal literals (containing digits larger than 7) now produce compile
|
||||
errors. For example, the following is no longer valid:
|
||||
|
||||
$i = 0781; // 8 is not a valid octal digit!
|
||||
|
||||
Previously the invalid digits (and any following valid digits) were simply
|
||||
ignored. As such $i previously held the value 7, because the last two digits
|
||||
were silently discarded.
|
||||
|
||||
* Bitwise shifts by negative numbers will now throw an ArithmeticError:
|
||||
|
||||
var_dump(1 >> -1);
|
||||
// ArithmeticError: Bit shift by negative number
|
||||
|
||||
* Left bitwise shifts by a number of bits beyond the bit width of an integer
|
||||
will always result in 0:
|
||||
|
||||
var_dump(1 << 64); // int(0)
|
||||
|
||||
Previously the behavior of this code was dependent on the used CPU
|
||||
architecture. For example on x86 (including x86-64) the result was int(1),
|
||||
because the shift operand was wrapped.
|
||||
|
||||
* Similarly right bitwise shifts by a number of bits beyond the bit width of an
|
||||
integer will always result in 0 or -1 (depending on sign):
|
||||
|
||||
var_dump(1 >> 64); // int(0)
|
||||
var_dump(-1 >> 64); // int(-1)
|
||||
|
||||
Relevant RFC: https://wiki.php.net/rfc/integer_semantics
|
||||
|
||||
Changes to string handling
|
||||
--------------------------
|
||||
|
||||
* Strings that contain hexadecimal numbers are no longer considered to be
|
||||
numeric and don't receive special treatment anymore. Some examples of the
|
||||
new behavior:
|
||||
|
||||
var_dump("0x123" == "291"); // bool(false) (previously true)
|
||||
var_dump(is_numeric("0x123")); // bool(false) (previously true)
|
||||
var_dump("0xe" + "0x1"); // int(0) (previously 16)
|
||||
|
||||
var_dump(substr("foo", "0x1")); // string(3) "foo" (previously "oo")
|
||||
// Notice: A non well formed numeric value encountered
|
||||
|
||||
filter_var() can be used to check if a string contains a hexadecimal number
|
||||
or convert such a string into an integer:
|
||||
|
||||
$str = "0xffff";
|
||||
$int = filter_var($str, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
|
||||
if (false === $int) {
|
||||
throw new Exception("Invalid integer!");
|
||||
}
|
||||
var_dump($int); // int(65535)
|
||||
|
||||
* Due to the addition of the Unicode Codepoint Escape Syntax for double-quoted
|
||||
strings and heredocs, "\u{" followed by an invalid sequence will now result in
|
||||
an error:
|
||||
|
||||
$str = "\u{xyz}"; // Fatal error: Invalid UTF-8 codepoint escape sequence
|
||||
|
||||
To avoid this the leading backslash should be escaped:
|
||||
|
||||
$str = "\\u{xyz}"; // Works fine
|
||||
|
||||
However, "\u" without a following { is unaffected. As such the following code
|
||||
won't error and will work the same as before:
|
||||
|
||||
$str = "\u202e"; // Works fine
|
||||
|
||||
Relevant RFCs:
|
||||
* https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
|
||||
* https://wiki.php.net/rfc/unicode_escape
|
||||
|
||||
Changes to error handling
|
||||
-------------------------
|
||||
|
||||
* There are now two exception classes: Exception and Error. Both classes
|
||||
implement a new interface Throwable. Type hints in exception handling code
|
||||
may need to be changed to account for this.
|
||||
|
||||
* Some fatal errors and recoverable fatal errors now throw an Error instead.
|
||||
As Error is a separate class from Exception, these exceptions will not be
|
||||
caught by existing try/catch blocks.
|
||||
|
||||
For the recoverable fatal errors which have been converted into an exception,
|
||||
it is no longer possible to silently ignore the error from an error handler.
|
||||
In particular, it is no longer possible to ignore type hint failures.
|
||||
|
||||
* Parser errors now generate a ParseError that extends Error. Error
|
||||
handling for eval()s on potentially invalid code should be changed to catch
|
||||
ParseError in addition to the previous return value / error_get_last()
|
||||
based handling.
|
||||
|
||||
* Constructors of internal classes will now always throw an exception on
|
||||
failure. Previously some constructors returned NULL or an unusable object.
|
||||
|
||||
* The error level of some E_STRICT notices has been changed.
|
||||
|
||||
Relevant RFCs:
|
||||
* https://wiki.php.net/rfc/engine_exceptions_for_php7
|
||||
* https://wiki.php.net/rfc/throwable-interface
|
||||
* https://wiki.php.net/rfc/internal_constructor_behaviour
|
||||
* https://wiki.php.net/rfc/reclassify_e_strict
|
||||
|
||||
Other language changes
|
||||
----------------------
|
||||
|
||||
* Removed support for static calls to non-static methods from an incompatible
|
||||
$this context. In this case $this will not be defined, but the call will be
|
||||
allowed with a deprecation notice. An example:
|
||||
|
||||
class A {
|
||||
public function test() { var_dump($this); }
|
||||
}
|
||||
|
||||
// Note: Does NOT extend A
|
||||
class B {
|
||||
public function callNonStaticMethodOfA() { A::test(); }
|
||||
}
|
||||
|
||||
(new B)->callNonStaticMethodOfA();
|
||||
|
||||
// Deprecated: Non-static method A::test() should not be called statically
|
||||
// Notice: Undefined variable $this
|
||||
NULL
|
||||
|
||||
Note that this only applies to calls from an incompatible context. If class B
|
||||
extended from A the call would be allowed without any notices.
|
||||
|
||||
* It is no longer possible to use the following class, interface and trait names
|
||||
(case-insensitive):
|
||||
|
||||
bool
|
||||
int
|
||||
float
|
||||
string
|
||||
null
|
||||
false
|
||||
true
|
||||
|
||||
This applies to class/interface/trait declarations, class_alias() and use
|
||||
statements.
|
||||
|
||||
Furthermore the following class, interface and trait names are now reserved
|
||||
for future use, but do not yet throw an error when used:
|
||||
|
||||
resource
|
||||
object
|
||||
mixed
|
||||
numeric
|
||||
|
||||
* The yield language construct no longer requires parentheses when used in an
|
||||
expression context. It is now a right-associative operator with precedence
|
||||
between the "print" and "=>" operators. This can result in different behavior
|
||||
in some cases, for example:
|
||||
|
||||
echo yield -1;
|
||||
// Was previously interpreted as
|
||||
echo (yield) - 1;
|
||||
// And is now interpreted as
|
||||
echo yield (-1);
|
||||
|
||||
yield $foo or die;
|
||||
// Was previously interpreted as
|
||||
yield ($foo or die);
|
||||
// And is now interpreted as
|
||||
(yield $foo) or die;
|
||||
|
||||
Such cases can always be resolved by adding additional parentheses.
|
||||
|
||||
- Core
|
||||
. list() now always supports ArrayAccess and never supports strings.
|
||||
Previously both were accepted in some situations and not in others.
|
||||
(RFC: https://wiki.php.net/rfc/fix_list_behavior_inconsistency)
|
||||
. Bitwise shifts by negative numbers of bits are disallowed (throws E_WARNING
|
||||
and gives FALSE, like a division by zero).
|
||||
. Left bitwise shifts by a number of bits beyond the bit width of an integer
|
||||
will always result in 0, even on CPUs which wrap around.
|
||||
. Right bitwise shifts by a number of bits beyond the bit width of an integer
|
||||
will always result in 0 or -1 (depending on sign), even on CPUs which wrap
|
||||
around.
|
||||
. Removed ASP (<%) and script (<script language=php>) tags.
|
||||
(RFC: https://wiki.php.net/rfc/remove_alternative_php_tags)
|
||||
. call_user_method() and call_user_method_array() no longer exists.
|
||||
. PHP 7 doesn't keep original values of arguments passed to user functions,
|
||||
so func_get_arg() and func_get_args() will return current value of argument
|
||||
instead of the actually passed. The following code is going to be affected:
|
||||
function foo($x) { $x = 2; return func_get_arg(0);} var_dump(foo(1));
|
||||
It will now produce 2, not 1.
|
||||
. Function parameters with duplicate name are not allowed anymore. Definitions
|
||||
like “function foo($x,$x) {}” will lead to compile time error.
|
||||
. Indirect variable, property and method references are now interpreted with
|
||||
left-to-right semantics. See details in:
|
||||
https://wiki.php.net/rfc/uniform_variable_syntax#semantic_differences_in_existing_syntax
|
||||
. The global keyword now only accepts simple variables. See details in:
|
||||
https://wiki.php.net/rfc/uniform_variable_syntax#global_keyword_takes_only_simple_variables
|
||||
. The addition of Unicode Codepoint Escape Syntax for double-quoted strings
|
||||
and heredocs means that \u{ followed by an invalid sequence will now error.
|
||||
However, \u without a following { is unaffected, so "\u202e" won't error and
|
||||
will work the same as before.
|
||||
. zend_function.common.num_args don't include the variadic argument anymore.
|
||||
. ob_start() no longer issues an E_ERROR, but instead an E_RECOVERABLE_ERROR in case an
|
||||
output buffer is created in an output buffer handler.
|
||||
. Removed support for assigning the result of new by reference.
|
||||
. Removed support for scoped calls to non-static methods from an incompatible
|
||||
$this context. See details in https://wiki.php.net/rfc/incompat_ctx.
|
||||
. Removed support for #-style comments in ini files. Use ;-style comments
|
||||
instead.
|
||||
. $HTTP_RAW_POST_DATA is no longer available. Use the php://input stream instead.
|
||||
|
||||
Standard library changes
|
||||
========================
|
||||
|
||||
. substr() now returns an empty string instead of FALSE when the truncation happens on boundaries.
|
||||
. call_user_method() and call_user_method_array() no longer exists.
|
||||
. ob_start() no longer issues an E_ERROR, but instead an E_RECOVERABLE_ERROR in case an
|
||||
output buffer is created in an output buffer handler.
|
||||
. The internal sorting algorithm has been improved, what may result in
|
||||
different sort order of elements that compare as equal.
|
||||
. Added zend_memnstr_ex, which is based on string matching sunday algo.
|
||||
. Added zend_memnrstr, zend_memnrstr_ex.
|
||||
. Added hybrid sorting algo zend_sort for better performance.
|
||||
. Added stable sorting algo zend_insert_sort.
|
||||
. Invalid octal literals in source code now produce compile errors, fixing
|
||||
PHPSadness #31. Previously, the invalid digits (and any following valid
|
||||
digits) were simply ignored, such that 0781 became 7.
|
||||
. Removed dl() function on fpm-fcgi.
|
||||
. setcookie() with an empty cookie name now issues a WARNING and doesn't send an empty set-cookie header line anymore.
|
||||
|
||||
Other
|
||||
=====
|
||||
|
||||
- Curl:
|
||||
. Removed support for disabling the CURLOPT_SAFE_UPLOAD option. All curl file
|
||||
uploads must use the curl_file / CURLFile APIs.
|
||||
. curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
|
||||
as a string (PHP >= 5.6.25)
|
||||
. Removed support for hexadecimal numeric strings. This means that some
|
||||
operations like == will no longer specially interpret strings containing
|
||||
hexadecimal numbers. Furthermore is_numeric() will not consider hexadecimal
|
||||
strings to be numeric (use FILTER_VALIDATE_INT instead).
|
||||
(RFC: https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings)
|
||||
|
||||
- Date:
|
||||
. Removed $is_dst parameter from mktime() and gmmktime().
|
||||
@@ -457,22 +85,6 @@ Other
|
||||
. gmp_setbit() and gmp_clrbit() now return FALSE for negative indices, making
|
||||
them consistent with other GMP functions.
|
||||
|
||||
- Intl:
|
||||
. Removed deprecated aliases datefmt_set_timezone_id() and
|
||||
IntlDateFormatter::setTimeZoneID(). Use datefmt_set_timezone() and
|
||||
IntlDateFormatter::setTimeZone() instead.
|
||||
|
||||
- libxml:
|
||||
. Added LIBXML_BIGLINES parser option. It's available starting with libxml 2.9.0
|
||||
and adds suppport for line numbers >16-bit in the error reporting.
|
||||
|
||||
- Mcrypt
|
||||
. Removed deprecated mcrypt_generic_end() alias in favor of
|
||||
mcrypt_generic_deinit().
|
||||
. Removed deprecated mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb()
|
||||
functions in favor of mcrypt_encrypt() and mcrypt_decrypt() with an
|
||||
MCRYPT_MODE_* flag.
|
||||
|
||||
- Session
|
||||
. session_start() accepts all INI settings as array. e.g. ['cache_limiter'=>'private']
|
||||
sets session.cache_limiter=private. It also supports 'read_and_close' which closes
|
||||
@@ -485,104 +97,30 @@ Other
|
||||
. session.lazy_write(default=On) INI setting enables only write session data when
|
||||
session data is updated.
|
||||
|
||||
- Opcache
|
||||
. Removed opcache.load_comments configuration directive. Now doc comments
|
||||
loading costs nothing and always enabled.
|
||||
|
||||
- OpenSSL:
|
||||
. Removed the "rsa_key_size" SSL context option in favor of automatically
|
||||
setting the appropriate size given the negotiated crypto algorithm.
|
||||
. Removed "CN_match" and "SNI_server_name" SSL context options. Use automatic
|
||||
detection or the "peer_name" option instead.
|
||||
|
||||
- PCRE:
|
||||
. Removed support for /e (PREG_REPLACE_EVAL) modifier. Use
|
||||
preg_replace_callback() instead.
|
||||
|
||||
- PDO_pgsql:
|
||||
. Removed PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT attribute in favor of
|
||||
ATTR_EMULATE_PREPARES.
|
||||
preg_reaplace_callback() instead.
|
||||
|
||||
- Standard:
|
||||
. Removed string category support in setlocale(). Use the LC_* constants
|
||||
instead.
|
||||
. Removed set_magic_quotes_runtime() and its alias magic_quotes_runtime().
|
||||
|
||||
- JSON:
|
||||
. Rejected RFC 7159 incompatible number formats in json_decode string -
|
||||
top level (07, 0xff, .1, -.1) and all levels ([1.], [1.e1])
|
||||
. Calling json_decode with 1st argument equal to empty PHP string or value that
|
||||
after casting to string is empty string (NULL, FALSE) results in JSON syntax error.
|
||||
|
||||
- Stream:
|
||||
. Removed set_socket_blocking() in favor of its alias stream_set_blocking().
|
||||
|
||||
- XSL:
|
||||
. Removed xsl.security_prefs ini option. Use XsltProcessor::setSecurityPrefs()
|
||||
instead.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
|
||||
- Core
|
||||
. Added group use declarations.
|
||||
(RFC: https://wiki.php.net/rfc/group_use_declarations)
|
||||
. Added null coalesce operator (??).
|
||||
(RFC: https://wiki.php.net/rfc/isset_ternary)
|
||||
. Support for strings with length >= 2^31 bytes in 64 bit builds.
|
||||
. Closure::call() method added (works only with userland classes).
|
||||
. Closure::call() method added.
|
||||
. Added \u{xxxxxx} Unicode Codepoint Escape Syntax for double-quoted strings
|
||||
and heredocs.
|
||||
. define() now supports arrays as constant values, fixing an oversight where
|
||||
define() did not support arrays yet const syntax did.
|
||||
. Added the comparison operator (<=>), aka the spaceship operator.
|
||||
(RFC: https://wiki.php.net/rfc/combined-comparison-operator)
|
||||
. Added the yield from operator for delegating Generators like coroutines.
|
||||
(RFC: https://wiki.php.net/rfc/generator-delegation)
|
||||
. Reserved keywords can now be used in various new contexts.
|
||||
(RFC: https://wiki.php.net/rfc/context_sensitive_lexer)
|
||||
. Added support for scalar type declarations and strict mode using
|
||||
declare(strict_types=1) (RFC: https://wiki.php.net/rfc/scalar_type_hints_v5)
|
||||
. Added support for cryptographically secure user land RNG
|
||||
(RFC: https://wiki.php.net/rfc/easy_userland_csprng)
|
||||
|
||||
- Opcache
|
||||
. Added second level file based opcode cache. It may be enabled by setting
|
||||
opcache.file_cache=<DIR> configuration directive in php.ini. The second
|
||||
level cache may improve performance when SHM is full, at server restart or
|
||||
SHM reset. In addition, it's possibe to use file cache without SHM at all,
|
||||
using opcache.file_cache_only=1 (this may be useful for sharing hosting),
|
||||
and disable file cache consistency check, to speedup loading at the cost of
|
||||
safety, using opcache.file_cache_consistency_checks=0.
|
||||
. Added ability to move PHP code pages (PHP TEXT segment) into HUGE pages.
|
||||
It's possible to enable/disable this feature in php.ini through
|
||||
opcache.huge_code_pages=0/1. OS should be configured to provide huge pages.
|
||||
. Added Windows only opcache.file_cache_fallback=1 ini option, which implies
|
||||
the implemented fallback mechanism. When OPcache was not able to reattach
|
||||
the shared memory segment to the desired address and opcache.file_cache
|
||||
is on, opcache.file_cache_only=1 will be automatically enforced.
|
||||
|
||||
- OpenSSL
|
||||
. Added "alpn_protocols" SSL context option allowing encrypted client/server
|
||||
streams to negotiate alternative protocols using the ALPN TLS extension when
|
||||
built against OpenSSL 1.0.2 or newer. Negotiated protocol information is
|
||||
accessible through stream_get_meta_data() output.
|
||||
|
||||
- Reflection
|
||||
. Added a ReflectionGenerator class (yield from Traces, current file/line,
|
||||
etc.)
|
||||
. Added a ReflectionType class to better support the new return type and
|
||||
scalar type declarations features. The new ReflectionParameter::getType()
|
||||
and ReflectionFunctionAbstract::getReturnType() methods both return an
|
||||
instance of ReflectionType.
|
||||
|
||||
- Stream:
|
||||
. New Windows only stream context options was added to allow blocking reads
|
||||
on pipes. To enable it, pass array("pipe" => array("blocking" => true))
|
||||
when creating the stream context. Be aware, that this option can under
|
||||
circumstances cause dead locks on the pipe buffer. However it can be useful
|
||||
in several CLI use case scenarios.
|
||||
. define() now supports arrays as constant values, fixing an oversight where define() did not support arrays yet const syntax did.
|
||||
|
||||
========================================
|
||||
3. Changes in SAPI modules
|
||||
@@ -596,132 +134,44 @@ Other
|
||||
4. Deprecated Functionality
|
||||
========================================
|
||||
|
||||
- Core
|
||||
. PHP 4 style constructors, where the constructor name is the same as the
|
||||
class name, are now deprecated.
|
||||
. Static calls to non-static methods are now deprecated.
|
||||
|
||||
- OpenSSL
|
||||
. The "capture_session_meta" SSL context option is now deprecated. Meta
|
||||
data concerning active crypto on a stream resource is now accessible
|
||||
through the return result from stream_get_meta_data().
|
||||
|
||||
========================================
|
||||
5. Changed Functions
|
||||
========================================
|
||||
|
||||
- parse_ini_file():
|
||||
- parse_ini_string():
|
||||
. Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
|
||||
- unserialize():
|
||||
. Added second parameter for unserialize function
|
||||
(RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify
|
||||
acceptable classes:
|
||||
unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]]);
|
||||
unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]);
|
||||
|
||||
- proc_open():
|
||||
. The maximum number of pipes used by proc_open() was previously limited by
|
||||
hardcoded value of 16. This limit is now removed and the number of pipes is
|
||||
effectively limited by the amount of memory available to PHP.
|
||||
. New Windows only configuration option "blocking_pipes" can be used to
|
||||
force blocking reads on child process pipes. This covers several
|
||||
edge cases in CLI usage however can lead to dead locks. Also, this
|
||||
correlates with the new stream context options for pipes.
|
||||
|
||||
- array_column():
|
||||
The function now supports an array of objects as well as two-dimensional
|
||||
arrays. Only public properties are considered, and objects that make use of
|
||||
__get() for dynamic properties must also implement __isset().
|
||||
|
||||
- stream_context_create()
|
||||
It accepts now a Windows only configuration
|
||||
array("pipe" => array("blocking" => <boolean>)) which forces blocking reads
|
||||
on pipes. This option should be used carefully because due to the
|
||||
platform restrictions dead locks on pipe buffers are possible.
|
||||
|
||||
- dirname()
|
||||
A new optional argument ($levels) allow to go up various times
|
||||
dirname(dirname($foo)) => dirname($foo, 2);
|
||||
|
||||
- debug_zval_dump
|
||||
It prints now "int" instead of "long", and "float" instead of "double".
|
||||
|
||||
- getenv()
|
||||
Since 7.0.9, getenv() has optional second parameter, making it only
|
||||
consider local environment and not SAPI environment if true.
|
||||
|
||||
========================================
|
||||
6. New Functions
|
||||
========================================
|
||||
|
||||
- GMP
|
||||
. Added gmp_random_seed().
|
||||
|
||||
- PCRE:
|
||||
. Added preg_replace_callback_array function
|
||||
(RFC: https://wiki.php.net/rfc/preg_replace_callback_array)
|
||||
|
||||
- Standard
|
||||
. Added intdiv() function for integer division.
|
||||
. Added error_clear_last() function to reset error state.
|
||||
|
||||
- Zip:
|
||||
. Added ZipArchive::setCompressionIndex() and ZipArchive::setCompressionName()
|
||||
for setting the compression method.
|
||||
|
||||
- Zlib:
|
||||
. Added deflate_init(), deflate_add(), inflate_init(), inflate_add()
|
||||
functions allowing incremental/streaming compression/decompression.
|
||||
|
||||
========================================
|
||||
7. New Classes and Interfaces
|
||||
========================================
|
||||
|
||||
- ReflectionGenerator
|
||||
- ReflectionType
|
||||
|
||||
========================================
|
||||
8. Removed Extensions and SAPIs
|
||||
8. Removed Extensions
|
||||
========================================
|
||||
|
||||
- sapi/aolserver
|
||||
- sapi/apache
|
||||
- sapi/apache_hooks
|
||||
- sapi/apache2filter
|
||||
- sapi/caudium
|
||||
- sapi/continuity
|
||||
- sapi/isapi
|
||||
- sapi/milter
|
||||
- sapi/nsapi
|
||||
- sapi/phttpd
|
||||
- sapi/pi3web
|
||||
- sapi/roxen
|
||||
- sapi/thttpd
|
||||
- sapi/tux
|
||||
- sapi/webjames
|
||||
- ext/mssql
|
||||
- ext/mysql
|
||||
- ext/sybase_ct
|
||||
- ext/ereg
|
||||
|
||||
For more details see
|
||||
|
||||
https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts
|
||||
https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
|
||||
|
||||
NOTE: NSAPI was not voted in the RFC, however it was removed afterwards. It turned
|
||||
out, that the corresponding SDK isn't available anymore.
|
||||
|
||||
========================================
|
||||
9. Other Changes to Extensions
|
||||
========================================
|
||||
|
||||
- Mhash
|
||||
Mhash is not an extension anymore, use function_exists("mhash") to check whether
|
||||
it is avaliable.
|
||||
|
||||
- GD
|
||||
The bundled libgd requires libwebp instead of libvpx for the WebP functionality.
|
||||
|
||||
- Openssl
|
||||
minimum supported OpenSSL version series was raised to 0.9.8
|
||||
|
||||
========================================
|
||||
10. New Global Constants
|
||||
@@ -730,48 +180,6 @@ out, that the corresponding SDK isn't available anymore.
|
||||
- Core
|
||||
. PHP_INT_MIN added.
|
||||
|
||||
- PCRE
|
||||
. This error constant is added to signal errors due to stack size limitations
|
||||
when PCRE JIT support is enabled:
|
||||
. PREG_JIT_STACKLIMIT_ERROR
|
||||
|
||||
- Zlib
|
||||
. These constants are added to control flush behavior with the new
|
||||
incremental deflate_add() and inflate_add() functions:
|
||||
. ZLIB_NO_FLUSH
|
||||
. ZLIB_PARTIAL_FLUSH
|
||||
. ZLIB_SYNC_FLUSH
|
||||
. ZLIB_FULL_FLUSH
|
||||
. ZLIB_BLOCK
|
||||
. ZLIB_FINISH
|
||||
|
||||
- GD
|
||||
. IMG_WEBP (>= 7.0.10)
|
||||
|
||||
. T1Lib support removed, thus lifting the optional dependency on T1Lib, the
|
||||
following is therefore not available anymore:
|
||||
|
||||
Functions:
|
||||
- imagepsbbox()
|
||||
- imagepsencodefont()
|
||||
- imagepsextendedfont()
|
||||
- imagepsfreefont()
|
||||
- imagepsloadfont()
|
||||
- imagepsslantfont()
|
||||
- imagepstext()
|
||||
|
||||
Resources:
|
||||
- 'gd PS font'
|
||||
- 'gd PS encoding'
|
||||
|
||||
- Zip
|
||||
. Filename encoding flags, as of 7.0.8
|
||||
- ZipArchive::FL_ENC_GUESS
|
||||
- ZipArchive::FL_ENC_RAW
|
||||
- ZipArchive::FL_ENC_STRICT
|
||||
- ZipArchive::FL_ENC_UTF_8
|
||||
- ZipArchive::FL_ENC_CP437
|
||||
|
||||
========================================
|
||||
11. Changes to INI File Handling
|
||||
========================================
|
||||
@@ -779,7 +187,6 @@ out, that the corresponding SDK isn't available anymore.
|
||||
- Core
|
||||
. Removed asp_tags ini directive. Trying to enable it will result in a fatal
|
||||
error.
|
||||
. Removed always_populate_raw_post_data ini directive.
|
||||
|
||||
========================================
|
||||
12. Windows Support
|
||||
@@ -788,19 +195,6 @@ out, that the corresponding SDK isn't available anymore.
|
||||
- Core
|
||||
. Support for native 64 bit integers in 64 bit builds.
|
||||
. Support for large files in 64 bit builds.
|
||||
. Support for getrusage()
|
||||
|
||||
- ftp
|
||||
. The ftp extension is always shipped shared
|
||||
. For SSL support, the dependency on the openssl extension was abolished. Instead
|
||||
it depends alone on the openssl library. If it's present at the compile time,
|
||||
ftp_ssl_connect() is enabled automatically.
|
||||
|
||||
- imap
|
||||
. Static building of ext/imap is disabled
|
||||
|
||||
- odbc
|
||||
. The odbc extension is always shipped shared
|
||||
|
||||
========================================
|
||||
13. Other Changes
|
||||
@@ -808,22 +202,7 @@ out, that the corresponding SDK isn't available anymore.
|
||||
|
||||
- Core
|
||||
. Instead of being undefined and platform-dependent, NaN and Infinity will
|
||||
always be zero when cast to integer.
|
||||
. Calling a method on a non-object now raises a catchable error instead of a
|
||||
fatal error; see: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
|
||||
. Error messages for zend_parse_parameters, type hints and conversions now
|
||||
always say "integer" and "float" instead of "long" and "double".
|
||||
. Output buffering now continues to work for an aborted connection if
|
||||
ignore_user_abort is set to true.
|
||||
. Zend Extensions API was extended with zend_extension.op_array_persist_calc()
|
||||
and zend_extensions.op_array_persist() handlers. They allow to store (or
|
||||
reset) associated with op_array addition information in Opcache Shared
|
||||
Memory.
|
||||
. zend_internal_function.reserved[] array was introduced to allow association
|
||||
of aditional information with internal functions. In PHP-5 it was possible
|
||||
to use zend_function.op_array.reserved[] even for internal functions, but
|
||||
now we don't allocate extra space.
|
||||
|
||||
- CURL
|
||||
. curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
|
||||
as a string (PHP >= 7.0.10)
|
||||
always be zero when casted to integer.
|
||||
. Calling a method on a non-object no longer raises a fatal error; see
|
||||
also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object.
|
||||
. Error messages for zend_parse_parameters, type hints and conversions now always say "integer" and "float" instead of "long" and "double".
|
||||
+15
-114
@@ -1,6 +1,7 @@
|
||||
$Id$
|
||||
|
||||
PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
|
||||
0. Wiki Examples
|
||||
1. Internal API changes
|
||||
e. New data types
|
||||
f. zend_parse_parameters() specs
|
||||
@@ -16,29 +17,17 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
||||
p. TSRM changes
|
||||
q. gc_collect_cycles() is now hookable
|
||||
r. PDO uses size_t for lengths
|
||||
s. Resource API changes
|
||||
t. Optimized strings concatenation.
|
||||
u. Streams changes
|
||||
v. Sort algorithm changes
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
b. Windows build system changes
|
||||
|
||||
3. Module changes
|
||||
|
||||
================
|
||||
0. Wiki Examples
|
||||
================
|
||||
|
||||
The wiki contains multiple examples and further explanations of the internal
|
||||
changes. See: https://wiki.php.net/phpng-upgrading
|
||||
|
||||
|
||||
========================
|
||||
1. Internal API changes
|
||||
========================
|
||||
|
||||
a. zend_set_memory_limit() now takes the TSRMLS_CC macro as its last argument
|
||||
e. New data types
|
||||
|
||||
String
|
||||
@@ -82,15 +71,15 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
g. sprintf() formats
|
||||
|
||||
New printf modifier 'p' was implemented to platform independently output zend_long,
|
||||
zend_ulong and php_size_t datatypes. That modifier can be used with 'd', 'u', 'x' and 'o'
|
||||
zend_ulong and php_size_t datatypes. That modifier can be used with'd', 'u', 'x' and 'o'
|
||||
printf format specs with spprintf, snprintf and the wrapping printf implementations.
|
||||
%pu is sufficient for both zend_ulong and php_size_t. the code using %p spec to output
|
||||
pointer address might need to be enclosed into #ifdef when it unlickily followed by 'd',
|
||||
'u', 'x' or 'o'.
|
||||
|
||||
The only exceptions are the snprintf and zend_sprintf functions yet, because in some cases
|
||||
they can use the implemenations available on the system, not the PHP one. With snprintf the
|
||||
macros ZEND_LONG_FMT and ZEND_ULONG_FMT should be used.
|
||||
they can use the implemenations available on the system, not the PHP one. Fro snprintf the
|
||||
the macros ZEND_INT_FMT ZEND_UINT_FMT should be used.
|
||||
|
||||
h. HashTable API
|
||||
|
||||
@@ -118,10 +107,6 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
- ZEND_ULONG_MAX replaces ULONG_MAX where appropriate
|
||||
- SIZEOF_ZEND_LONG reworked SIZEOF_ZEND_LONG representing the size of zend_long datatype
|
||||
- ZEND_SIZE_MAX Max value of size_t
|
||||
- Z_L casts an integral constant to zend_long
|
||||
- Z_UL casts an integral constant to zend_ulong
|
||||
|
||||
The macro ZEND_ENABLE_ZVAL_LONG64 reveals whether zval operates on 64 or 32 bit integer.
|
||||
|
||||
k. The get_class_entry object handler is no longer available. Instead
|
||||
zend_object.ce is always used.
|
||||
@@ -181,41 +166,11 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
before any globals was accessed.
|
||||
|
||||
Porting an extension or SAPI is usually as easy as removing all the TSRMLS_*
|
||||
occurrences and integrating the macros mentioned above. However if tsrm_ls
|
||||
is used explicitly, its usage can be considered obsolete in most cases.
|
||||
ocurrences and integrating the macros mentioned above. However if tsrm_ls
|
||||
is used explicitly, its usage can considered obsolete in most cases.
|
||||
Additionally, if an extension triggers its own threads, TSRMLS_CACHE shouldn't
|
||||
be passed to that threads directly.
|
||||
|
||||
When working with CTOR/DTOR for the extension globals, only the data passed
|
||||
as parameters should be touched. For example, don't use code like
|
||||
free(MYEXT_G(vars)); inside globals destructor, as it possibly can destroy
|
||||
the data from a wrong thread. Instead use the pointer to the data delivered
|
||||
into the destructor. So the previous example could look like
|
||||
free(my_struct->vars); given the income was casted to (struct my_struct *).
|
||||
|
||||
A new macro was introduced to simplify the declaration to the extension
|
||||
globals. A simplified declaration looks as follows
|
||||
|
||||
#define MYEXT_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(myext, v)
|
||||
|
||||
Another new macro ZEND_MODULE_GLOBALS_BULK(myext) delivers the corresponding
|
||||
globals struct as a whole.
|
||||
|
||||
Two new storage specifiers was introduced.
|
||||
|
||||
ZEND_EXT_TLS - expand to an appropriate thread specific storage specifier in
|
||||
the thread safe build, expands to empty in a non thread safe
|
||||
build.
|
||||
ZEND_TLS - expands to an appropriate thread specific storage specifier
|
||||
with static visibility in the thread safe build, expands to
|
||||
static specifier in a non thread safe build.
|
||||
|
||||
Variables declared with these storage specifiers can not be shared across
|
||||
threads. While ZEND_TLS enforces the local scope visibility, ZEND_EXT_TLS
|
||||
pertains to the visiblity across several compilation units. In both cases,
|
||||
there's no portable way to achieve the visibility across shared objects.
|
||||
Thus, these specifiers are not compatible with ZEND_API and PHPAPI specifiers.
|
||||
|
||||
q. gc_collect_cycles() is now a function pointer, and can be replaced in the
|
||||
same manner as zend_execute_ex() if needed (for example, to include the
|
||||
time spent in the garbage collector in a profiler). The default
|
||||
@@ -225,32 +180,6 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
r. In accordance with general use of size_t as string length, all PDO API
|
||||
functions now use size_t for string length.
|
||||
|
||||
s. Removed ZEND_REGISTER/FETCH_RESOURCE, use zend_fetch_resource and
|
||||
and zend_register_resource instead, zend_fetch_resource accepts a zend_resource *
|
||||
as first argument, if you still need to fetch a resource from zval, use
|
||||
zend_fetch_resource_ex. More details can be found in Zend/zend_list.c.
|
||||
|
||||
t. Optimized strings concatenation.
|
||||
ZEND_ADD_STRING/VAR/CHAR are replaced with ZEND_ROPE_INIT, ZEND_ROPE_ADD,
|
||||
ZEND_ROPE_END.
|
||||
Instead of reallocation and copying string on each ZEND_ADD_STRING/VAR/CAHR,
|
||||
collect all the strings and then allocate and construct the resulting string once.
|
||||
|
||||
u. Streams changes
|
||||
- It is possible to do blocking reads on Windows pipes. It can be done either
|
||||
using context stream option PHP_STREAM_OPTION_PIPE_BLOCKING or
|
||||
adding STREAM_USE_BLOCKING_PIPE when opening the stream.
|
||||
|
||||
v. Sort algorithm changes
|
||||
- Improved zend_qsort(using hybrid sorting algo) for better performance,
|
||||
and also renamed zend_qsort to zend_sort.
|
||||
- Added stable sorting algo zend_insert_sort.
|
||||
|
||||
w. Tick functions internal API change
|
||||
Tick functions have different declaration now. They expect a single
|
||||
parameter while before they were parameterless. When registering the
|
||||
tick function a value for this parameter must be passed. This value will be
|
||||
provided to the tick function on every execution.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
@@ -276,12 +205,6 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
and library manager. This solves the issues with the long command lines
|
||||
which can exceed the OS limit.
|
||||
|
||||
- with clang toolset, an option --with-uncritical-warn-choke is available,
|
||||
which suppresses the most frequent false positive warnings
|
||||
|
||||
- the --with-mp option will by default utilize all the available cores. It's
|
||||
enabled by default for release builds and can be disabled with the special
|
||||
"disable" keyword.
|
||||
|
||||
========================
|
||||
3. Module changes
|
||||
@@ -291,34 +214,12 @@ changes. See: https://wiki.php.net/phpng-upgrading
|
||||
|
||||
- PS_MOD_UPDATE_TIMESTAMP() session save handler definition is added. New
|
||||
save handler should use PS_MOD_UPDATE_TIMESTAMP() definition. Save handler
|
||||
must not refer/change PS() variables directly from save handler. Use
|
||||
parameters.
|
||||
- PS_MOD()/PS_MOD_SID() macro exist only for transition. Beware these
|
||||
save handlers are less secure and slower than PS_MOD_UPDATE_TIMESTAMP().
|
||||
- PS(invalid_session_id) was removed. It was never worked as it supposed.
|
||||
To report invalid session ID, use PS_VALIDATE_SID() handler.
|
||||
- PS_VALIDATE_SID() defines session ID validation handler. This handler
|
||||
must validate if requested session ID exists in session data storage or not.
|
||||
Do not access PS(id) directly, but use this handler and it's parameter.
|
||||
- PS_UPDATE_TIMESTAMP() defines timestamp updating handler. This handler
|
||||
must not refer/change PS() variables directly from save handler.
|
||||
- PS_MOD_UPDATE_TIMESTAMP() defines validate_sid() handler. This handler
|
||||
must validate if requested session ID is in session data storage or not.
|
||||
Internal save handler needed to asscess PS(id) directly to validate it.
|
||||
Do not access PS(id), but use this handler.
|
||||
- PS_MOD_UPDATE_TIMESTAMP() defines update_timestamp() handlers. This handler
|
||||
must update session data timestamp for GC if it is needed. e.g. Memcache
|
||||
updates timestamp on read, so it does not need to update timestamp. Return
|
||||
updates timestap on read, so it does not need to update timestamp. Return
|
||||
SUCCESS simply for this case.
|
||||
- PS_CREATE_SID() should check session ID collision. Return NULL for failure.
|
||||
- More documentation can be found in ext/session/mod_files.c as comments.
|
||||
mod_files.c may be used as reference implementation.
|
||||
|
||||
Openssl:
|
||||
- several ext/openssl functions require the inclusion of the applink shim
|
||||
as documented in the OpenSSL FAQ https://www.openssl.org/support/faq.html#PROG2
|
||||
to properly work on Windows. While this primarily affects the OpenSSL
|
||||
functionality, the shim needs to be included into the executable file
|
||||
which loads the extension DLL, not into the extension DLL itself. Alternatively
|
||||
it can be compiled and linked with the main program as a separate object file.
|
||||
More information and explanation in the linked OpenSSL FAQ.
|
||||
|
||||
Thus, this primarily affects any WAMP or other redistributions bundling the
|
||||
official PHP release zipballs or building from sources. The applink shim is
|
||||
already integrated with all the PHP executables from the official distribution
|
||||
starting with 7.0.0beta1.
|
||||
|
||||
+2
-2
@@ -12,13 +12,13 @@ libZend_la_SOURCES=\
|
||||
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
|
||||
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_sort.c zend_objects.c zend_object_handlers.c \
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c \
|
||||
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_smart_str.c
|
||||
zend_generators.c zend_virtual_cwd.c zend_ast.c
|
||||
|
||||
libZend_la_CFLAGS = -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
|
||||
libZend_la_LDFLAGS =
|
||||
|
||||
+31
-64
@@ -153,6 +153,14 @@ AC_ARG_ENABLE(debug,
|
||||
|
||||
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
|
||||
|
||||
AC_ARG_WITH(zend-vm,
|
||||
[ --with-zend-vm=TYPE Set virtual machine dispatch method. Type is
|
||||
one of "CALL", "SWITCH" or "GOTO" [TYPE=CALL]],[
|
||||
PHP_ZEND_VM=$withval
|
||||
],[
|
||||
PHP_ZEND_VM=CALL
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(maintainer-zts,
|
||||
[ --enable-maintainer-zts Enable thread safety - for code maintainers only!!],[
|
||||
ZEND_MAINTAINER_ZTS=$enableval
|
||||
@@ -168,6 +176,9 @@ AC_ARG_ENABLE(inline-optimization,
|
||||
ZEND_INLINE_OPTIMIZATION=yes
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([virtual machine dispatch method])
|
||||
AC_MSG_RESULT($PHP_ZEND_VM)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable thread-safety)
|
||||
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
|
||||
|
||||
@@ -177,6 +188,19 @@ AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
|
||||
AC_MSG_CHECKING(whether to enable Zend debugging)
|
||||
AC_MSG_RESULT($ZEND_DEBUG)
|
||||
|
||||
case $PHP_ZEND_VM in
|
||||
SWITCH)
|
||||
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
|
||||
;;
|
||||
GOTO)
|
||||
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_GOTO,[virtual machine dispatch method])
|
||||
;;
|
||||
*)
|
||||
PHP_ZEND_VM=CALL
|
||||
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_CALL,[virtual machine dispatch method])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ZEND_DEBUG" = "yes"; then
|
||||
AC_DEFINE(ZEND_DEBUG,1,[ ])
|
||||
echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
|
||||
@@ -401,68 +425,11 @@ if test -r "/dev/urandom" && test -c "/dev/urandom"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether /dev/arandom exists)
|
||||
if test -r "/dev/arandom" && test -c "/dev/arandom"; then
|
||||
AC_DEFINE([HAVE_DEV_ARANDOM], 1, [Define if the target system has /dev/arandom device])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(whether /dev/arandom exists)
|
||||
if test -r "/dev/arandom" && test -c "/dev/arandom"; then
|
||||
AC_DEFINE([HAVE_DEV_ARANDOM], 1, [Define if the target system has /dev/arandom device])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(gcc-global-regs,
|
||||
[ --disable-gcc-global-regs
|
||||
whether to enable GCC global register variables],[
|
||||
ZEND_GCC_GLOBAL_REGS=$enableval
|
||||
],[
|
||||
ZEND_GCC_GLOBAL_REGS=yes
|
||||
])
|
||||
AC_MSG_CHECKING(for global register variables support)
|
||||
if test "$ZEND_GCC_GLOBAL_REGS" != "no"; then
|
||||
AC_TRY_COMPILE([
|
||||
#if defined(__GNUC__)
|
||||
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
#else
|
||||
# define ZEND_GCC_VERSION 0
|
||||
#endif
|
||||
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(i386)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "%esi"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "%edi"
|
||||
#elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__x86_64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "%r14"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "%r15"
|
||||
#elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
#elif defined(__IBMC__) && ZEND_GCC_VERSION >= 4002 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
#else
|
||||
# error "global register variables are not supported"
|
||||
#endif
|
||||
typedef int (*opcode_handler_t)(void);
|
||||
register void *FP __asm__(ZEND_VM_FP_GLOBAL_REG);
|
||||
register const opcode_handler_t *IP __asm__(ZEND_VM_IP_GLOBAL_REG);
|
||||
int emu(const opcode_handler_t *ip, void *fp) {
|
||||
const opcode_handler_t *orig_ip = IP;
|
||||
void *orig_fp = FP;
|
||||
IP = ip;
|
||||
FP = fp;
|
||||
while ((*ip)());
|
||||
FP = orig_fp;
|
||||
IP = orig_ip;
|
||||
}
|
||||
], [
|
||||
], [
|
||||
ZEND_GCC_GLOBAL_REGS=yes
|
||||
], [
|
||||
ZEND_GCC_GLOBAL_REGS=no
|
||||
])
|
||||
fi
|
||||
if test "$ZEND_GCC_GLOBAL_REGS" = "yes"; then
|
||||
AC_DEFINE([HAVE_GCC_GLOBAL_REGS], 1, [Define if the target system has support for global register variables])
|
||||
else
|
||||
HAVE_GCC_GLOBAL_REGS=no
|
||||
fi
|
||||
AC_MSG_RESULT($ZEND_GCC_GLOBAL_REGS)
|
||||
+3
-3
@@ -90,10 +90,10 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#ifdef HAVE_FINITE
|
||||
#define zend_finite(a) finite(a)
|
||||
#elif defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(fpclassify)
|
||||
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
|
||||
#else
|
||||
|
||||
+2
-2
@@ -30,10 +30,10 @@ var_dump(get_class($f2));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
|
||||
Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
|
||||
string(3) "foo"
|
||||
|
||||
Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
|
||||
Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
|
||||
string(3) "foo"
|
||||
string(3) "foo"
|
||||
string(3) "foo"
|
||||
|
||||
+2
-2
@@ -201,7 +201,7 @@ class Point
|
||||
var $y;
|
||||
var $lable;
|
||||
|
||||
function __construct($x, $y) {
|
||||
function Point($x, $y) {
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ bool(false)
|
||||
bool(true)
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(11) "__construct"
|
||||
string(5) "Point"
|
||||
[1]=>
|
||||
string(8) "setLable"
|
||||
[2]=>
|
||||
|
||||
+1
-4
@@ -20,7 +20,4 @@ bool(true)
|
||||
|
||||
Notice: Undefined offset: 2 in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Function name must be a string in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Function name must be a string in %s on line %d
|
||||
+1
-4
@@ -16,7 +16,4 @@ var_dump($x::$x);
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
|
||||
Fatal error: Uncaught Error: Access to undeclared static property: Closure::$x in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Access to undeclared static property: Closure::$x in %s on line %d
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Using indirect append on ArrayAccess object
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class AA implements ArrayAccess {
|
||||
private $data = [];
|
||||
public function &offsetGet($name) {
|
||||
if (null === $name) {
|
||||
return $this->data[];
|
||||
} else {
|
||||
return $this->data[$name];
|
||||
}
|
||||
}
|
||||
public function offsetSet($name, $value) {
|
||||
$this->data[$name] = $value;
|
||||
}
|
||||
public function offsetUnset($name) {}
|
||||
public function offsetExists($name) {}
|
||||
}
|
||||
|
||||
$aa = new AA;
|
||||
$aa[3] = 1;
|
||||
$aa[][][0] = 2;
|
||||
var_dump($aa);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(AA)#1 (1) {
|
||||
["data":"AA":private]=>
|
||||
array(2) {
|
||||
[3]=>
|
||||
int(1)
|
||||
[4]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,5 @@ abstract class TestClass
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Strict Standards: Static function TestClass::getName() should not be abstract in %sabstract-static.php on line %d
|
||||
===DONE===
|
||||
@@ -28,9 +28,4 @@ new c;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Call to private method d::test2() from context 'a' in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): a->test()
|
||||
#1 %s(%d): c->__construct()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Call to private method d::test2() from context 'a' in %s on line %d
|
||||
+1
-14
@@ -8,25 +8,12 @@ $a = array(1,2,3);
|
||||
$o = new stdclass;
|
||||
$o->prop = "value";
|
||||
|
||||
try {
|
||||
var_dump($a + $o);
|
||||
} catch (Error $e) {
|
||||
echo "\nException: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$c = $a + $o;
|
||||
var_dump($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Object of class stdClass could not be converted to int in %sadd_002.php on line %d
|
||||
|
||||
Exception: Unsupported operand types
|
||||
|
||||
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Unsupported operand types in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Unsupported operand types in %s on line %d
|
||||
+1
-14
@@ -8,25 +8,12 @@ $a = array(1,2,3);
|
||||
$o = new stdclass;
|
||||
$o->prop = "value";
|
||||
|
||||
try {
|
||||
var_dump($o + $a);
|
||||
} catch (Error $e) {
|
||||
echo "\nException: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$c = $o + $a;
|
||||
var_dump($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Object of class stdClass could not be converted to int in %sadd_003.php on line %d
|
||||
|
||||
Exception: Unsupported operand types
|
||||
|
||||
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Unsupported operand types in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Unsupported operand types in %s on line %d
|
||||
+1
-12
@@ -5,21 +5,10 @@ adding numbers to arrays
|
||||
|
||||
$a = array(1,2,3);
|
||||
|
||||
try {
|
||||
var_dump($a + 5);
|
||||
} catch (Error $e) {
|
||||
echo "\nException: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$c = $a + 5;
|
||||
var_dump($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Exception: Unsupported operand types
|
||||
|
||||
Fatal error: Uncaught Error: Unsupported operand types in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Unsupported operand types in %s on line %d
|
||||
+1
-12
@@ -7,21 +7,10 @@ $a = array(1,2,3);
|
||||
|
||||
$s1 = "some string";
|
||||
|
||||
try {
|
||||
var_dump($a + $s1);
|
||||
} catch (Error $e) {
|
||||
echo "\nException: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$c = $a + $s1;
|
||||
var_dump($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Exception: Unsupported operand types
|
||||
|
||||
Fatal error: Uncaught Error: Unsupported operand types in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Unsupported operand types in %s on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
declare bare anonymous class
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(new class{});
|
||||
--EXPECTF--
|
||||
object(class@%s)#%d (0) {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
declare anonymous class extending another
|
||||
--FILE--
|
||||
<?php
|
||||
class A{}
|
||||
|
||||
interface B{
|
||||
public function method();
|
||||
}
|
||||
|
||||
$a = new class extends A implements B {
|
||||
public function method(){
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var_dump($a instanceof A, $a instanceof B);
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
--TEST--
|
||||
reusing anonymous classes
|
||||
--FILE--
|
||||
<?php
|
||||
while (@$i++<10) {
|
||||
var_dump(new class($i) {
|
||||
|
||||
public function __construct($i) {
|
||||
$this->i = $i;
|
||||
}
|
||||
});
|
||||
}
|
||||
--EXPECTF--
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(1)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(2)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(3)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(4)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(5)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(6)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(7)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(8)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(9)
|
||||
}
|
||||
object(class@%s)#1 (1) {
|
||||
["i"]=>
|
||||
int(10)
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
testing anonymous inheritance
|
||||
--FILE--
|
||||
<?php
|
||||
class Outer {
|
||||
protected $data;
|
||||
|
||||
public function __construct($data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getArrayAccess() {
|
||||
/* create a proxy object implementing array access */
|
||||
return new class($this->data) extends Outer implements ArrayAccess {
|
||||
public function offsetGet($offset) { return $this->data[$offset]; }
|
||||
public function offsetSet($offset, $data) { return ($this->data[$offset] = $data); }
|
||||
public function offsetUnset($offset) { unset($this->data[$offset]); }
|
||||
public function offsetExists($offset) { return isset($this->data[$offset]); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$outer = new Outer(array(
|
||||
rand(1, 100)
|
||||
));
|
||||
|
||||
/* not null because inheritance */
|
||||
var_dump($outer->getArrayAccess()[0]);
|
||||
--EXPECTF--
|
||||
int(%d)
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
testing reusing anons that implement an interface
|
||||
--FILE--
|
||||
<?php
|
||||
class Outer {
|
||||
protected $data;
|
||||
|
||||
public function __construct(&$data) {
|
||||
/* array access will be implemented by the time we get to here */
|
||||
$this->data = &$data;
|
||||
}
|
||||
|
||||
public function getArrayAccess() {
|
||||
/* create a child object implementing array access */
|
||||
/* this grants you access to protected methods and members */
|
||||
return new class($this->data) implements ArrayAccess {
|
||||
public function offsetGet($offset) { return $this->data[$offset]; }
|
||||
public function offsetSet($offset, $data) { return ($this->data[$offset] = $data); }
|
||||
public function offsetUnset($offset) { unset($this->data[$offset]); }
|
||||
public function offsetExists($offset) { return isset($this->data[$offset]); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
rand(1, 100),
|
||||
rand(2, 200)
|
||||
);
|
||||
|
||||
$outer = new Outer($data);
|
||||
$proxy = $outer->getArrayAccess();
|
||||
|
||||
/* null because no inheritance, so no access to protected member */
|
||||
var_dump(@$outer->getArrayAccess()[0]);
|
||||
--EXPECT--
|
||||
NULL
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
testing anon classes inside namespaces
|
||||
--FILE--
|
||||
<?php
|
||||
namespace lone {
|
||||
$hello = new class{} ;
|
||||
}
|
||||
|
||||
namespace {
|
||||
var_dump ($hello);
|
||||
}
|
||||
--EXPECTF--
|
||||
object(class@%s)#1 (0) {
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
testing anon classes in functions outside of classes in namespaces
|
||||
--FILE--
|
||||
<?php
|
||||
namespace lone {
|
||||
function my_factory() {
|
||||
return new class{};
|
||||
}
|
||||
|
||||
class Outer {
|
||||
|
||||
public function __construct() {
|
||||
var_dump(
|
||||
my_factory());
|
||||
}
|
||||
}
|
||||
|
||||
new Outer();
|
||||
}
|
||||
--EXPECTF--
|
||||
object(class@%s)#2 (0) {
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
testing static access for methods and properties in anon classes
|
||||
--FILE--
|
||||
<?php
|
||||
$anonClass = new class("cats", "dogs") {
|
||||
public static $foo;
|
||||
private static $bar;
|
||||
|
||||
public function __construct($foo, $bar) {
|
||||
static::$foo = $foo;
|
||||
static::$bar = $bar;
|
||||
}
|
||||
|
||||
public static function getBar() {
|
||||
return static::$bar;
|
||||
}
|
||||
};
|
||||
|
||||
var_dump($anonClass::$foo);
|
||||
var_dump($anonClass::getBar());
|
||||
--EXPECT--
|
||||
string(4) "cats"
|
||||
string(4) "dogs"
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
testing traits in anon classes
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait Foo {
|
||||
public function someMethod() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
$anonClass = new class {
|
||||
use Foo;
|
||||
};
|
||||
|
||||
var_dump($anonClass->someMethod());
|
||||
--EXPECT--
|
||||
string(3) "bar"
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Trait binding after anon class
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T {
|
||||
public function m1() { return 42; }
|
||||
}
|
||||
|
||||
class C {
|
||||
public function m2() {
|
||||
return new class {};
|
||||
}
|
||||
|
||||
use T;
|
||||
}
|
||||
|
||||
$c = new C;
|
||||
var_dump($c->m1());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Ensure proper inheritance with get_class(anon class instance) used via class_alias (see also bug #70106)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class_alias(get_class(new class { protected $foo = 1; }), "AnonBase");
|
||||
var_dump((new class extends AnonBase {
|
||||
function getFoo() {
|
||||
return $this->foo;
|
||||
}
|
||||
})->getFoo());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Ensure correct unmangling of private property names for anonymous class instances
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(new class { private $foo; });
|
||||
?>
|
||||
--EXPECT--
|
||||
object(class@anonymous)#1 (1) {
|
||||
["foo":"class@anonymous":private]=>
|
||||
NULL
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Array must be separated if unpacking by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function inc(&... $args) {
|
||||
foreach ($args as &$arg) {
|
||||
$arg++;
|
||||
}
|
||||
}
|
||||
|
||||
$arr = [1, 2];
|
||||
$arr[] = 3;
|
||||
$arr2 = $arr;
|
||||
inc(...$arr);
|
||||
var_dump($arr);
|
||||
var_dump($arr2);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(4)
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
@@ -7,18 +7,14 @@ set_error_handler(function($errno, $errstr) {
|
||||
var_dump($errstr);
|
||||
});
|
||||
|
||||
try {
|
||||
var_dump(...[1, 2, "foo" => 3, 4]);
|
||||
} catch (Error $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
try {
|
||||
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
|
||||
} catch (Error $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
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)
|
||||
@@ -13,4 +13,4 @@ class Sub extends Base {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of & Sub::test() should be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
|
||||
Strict Standards: Declaration of Sub::test() should be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
|
||||
@@ -13,4 +13,4 @@ class Sub extends Base {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of Sub::test($foo, array &$bar) should be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
|
||||
Strict Standards: Declaration of Sub::test() should be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
|
||||
@@ -16,4 +16,4 @@ class Sub extends Base {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of Sub::test() should be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
|
||||
Strict Standards: Declaration of Sub::test() should be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
|
||||
@@ -13,4 +13,4 @@ class Sub extends Base {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of Sub::test($foo, $extra) should be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
|
||||
Strict Standards: Declaration of Sub::test() should be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Array addition is not commutative -- do not swap operands
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = [1, 2, 3];
|
||||
$array = [4, 5, 6] + $array;
|
||||
var_dump($array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(4)
|
||||
[1]=>
|
||||
int(5)
|
||||
[2]=>
|
||||
int(6)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Accept hashes being equal to zero
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$hashes = [
|
||||
"\x8e\x1a\x63\x0f\x61" => 32,
|
||||
"\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
|
||||
];
|
||||
|
||||
foreach ($hashes as $hash => $bits) {
|
||||
var_dump($hashes[$hash], $bits);
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(32)
|
||||
int(32)
|
||||
int(64)
|
||||
int(64)
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Ensure "undefined offset" notice formats message corectly when undefined key is negative
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
[][-1];
|
||||
[][-1.1];
|
||||
(new ArrayObject)[-1];
|
||||
(new ArrayObject)[-1.1];
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined offset: -1 in %s on line 3
|
||||
|
||||
Notice: Undefined offset: -1 in %s on line 4
|
||||
|
||||
Notice: Undefined offset: -1 in %s on line 5
|
||||
|
||||
Notice: Undefined offset: -1 in %s on line 6
|
||||
Done
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Array type hint
|
||||
--FILE--
|
||||
<?php
|
||||
function foo(array $a) {
|
||||
echo count($a)."\n";
|
||||
}
|
||||
|
||||
foo(array(1,2,3));
|
||||
foo(123);
|
||||
?>
|
||||
--EXPECTF--
|
||||
3
|
||||
|
||||
Catchable fatal error: Argument 1 passed to foo() must be of the type array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70208 (scope information must be preserved with assert())
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function non_class_scope() {
|
||||
return true;
|
||||
}
|
||||
|
||||
class test {
|
||||
protected $prop = 1;
|
||||
|
||||
public function __construct() {
|
||||
assert('non_class_scope();');
|
||||
var_dump($this->prop);
|
||||
}
|
||||
}
|
||||
|
||||
new test;
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70528 (assert() with instanceof adds apostrophes around class name)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=0
|
||||
assert.warning=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
class Bar {}
|
||||
|
||||
$bar = "Bar";
|
||||
assert(new \stdClass instanceof $bar);
|
||||
assert(new \stdClass instanceof Bar);
|
||||
assert(new \stdClass instanceof \Foo\Bar);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(new \stdClass() instanceof $bar) failed in %sbug70528.php on line %d
|
||||
|
||||
Warning: assert(): assert(new \stdClass() instanceof Bar) failed in %sbug70528.php on line %d
|
||||
|
||||
Warning: assert(): assert(new \stdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
test passing assertion
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
assert(true);
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
test failing assertion
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
assert(false);
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_002.php:%d
|
||||
Stack trace:
|
||||
#0 %sexpect_002.php(%d): assert(false, 'assert(false)')
|
||||
#1 {main}
|
||||
thrown in %sexpect_002.php on line %d
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
test catching failed assertion
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
assert(false);
|
||||
} catch (AssertionError $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(13) "assert(false)"
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
test providing reason (fail)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
assert(false, "I require this to succeed");
|
||||
} catch (AssertionError $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(25) "I require this to succeed"
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
test providing reason (pass)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
/* by passing we test there are no leaks upon success */
|
||||
assert(true, "I require this to succeed");
|
||||
} catch (AssertionError $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
test looping assert (pass)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
for($i=0; $i<100000; $i++) {
|
||||
assert ($i < 100000, "The universe should make sense");
|
||||
}
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
test compiled reason
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
$next = 1;
|
||||
$data = array(
|
||||
"key" => "X-HTTP ",
|
||||
"value" => "testing"
|
||||
);
|
||||
|
||||
class HeaderMalfunctionError extends AssertionError {}
|
||||
|
||||
assert (preg_match("~^([a-zA-Z0-9-]+)$~", $data["key"]), new HeaderMalfunctionError("malformed key found at {$next} \"{$data["key"]}\""));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught HeaderMalfunctionError: malformed key found at 1 "X-HTTP " in %sexpect_007.php:10
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sexpect_007.php on line 10
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
test disabled expectations have no ill side effects
|
||||
--INI--
|
||||
zend.assertions=0
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
class One {
|
||||
public function __construct() {
|
||||
assert($this || 0);
|
||||
}
|
||||
}
|
||||
class Two extends One {}
|
||||
|
||||
class OdEar extends AssertionError {}
|
||||
|
||||
function blah(){ return 1; }
|
||||
|
||||
$variable = 1;
|
||||
assert(true, "constant message");
|
||||
assert(($variable && $variable) || php_sapi_name(), new OdEar("constant message"));
|
||||
assert(false);
|
||||
assert(blah(), blah());
|
||||
|
||||
new Two();
|
||||
new Two();
|
||||
new Two();
|
||||
|
||||
assert (blah() || blah() || blah(), blah() || blah() || blah() || blah());
|
||||
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
test stack trace is correct from failed exception in extended class
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
class One {
|
||||
public function __construct() {
|
||||
}
|
||||
}
|
||||
class Two extends One {
|
||||
public function __construct() {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
new Two();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_009.php:%d
|
||||
Stack trace:
|
||||
#0 %sexpect_009.php(%d): assert(false, 'assert(false)')
|
||||
#1 %sexpect_009.php(%d): Two->__construct()
|
||||
#2 {main}
|
||||
thrown in %sexpect_009.php on line %d
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
test stack trace is correct from failed exception in extended class (parent implementing constructor)
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
class One {
|
||||
public function __construct() {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
class Two extends One {}
|
||||
|
||||
new Two();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught AssertionError: assert(false) in %sexpect_010.php:%d
|
||||
Stack trace:
|
||||
#0 %sexpect_010.php(%d): assert(false, 'assert(false)')
|
||||
#1 %sexpect_010.php(%d): One->__construct()
|
||||
#2 {main}
|
||||
thrown in %sexpect_010.php on line %d
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
test overloaded __toString on custom exception
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
class MyExpectations extends AssertionError {
|
||||
public function __toString() {
|
||||
return sprintf(
|
||||
"[Message]: %s", __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
class One {
|
||||
public function __construct() {
|
||||
assert(false, (string) new MyExpectations());
|
||||
}
|
||||
}
|
||||
class Two extends One {}
|
||||
|
||||
new Two();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught AssertionError: [Message]: MyExpectations in %sexpect_011.php:%d
|
||||
Stack trace:
|
||||
#0 %sexpect_011.php(%d): assert(false, '[Message]: MyEx...')
|
||||
#1 %sexpect_011.php(%d): One->__construct()
|
||||
#2 {main}
|
||||
thrown in %sexpect_011.php on line %d
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
test enable/disable assertions at runtime
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump((integer)ini_get("zend.assertions"));
|
||||
ini_set("zend.assertions", 0);
|
||||
var_dump((integer)ini_get("zend.assertions"));
|
||||
assert(false);
|
||||
ini_set("zend.assertions", 1);
|
||||
var_dump((integer)ini_get("zend.assertions"));
|
||||
assert(true);
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(0)
|
||||
int(1)
|
||||
bool(true)
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
test failing assertion when disabled (with return value)
|
||||
--INI--
|
||||
zend.assertions=0
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(assert(false));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
test failing assertion when disabled
|
||||
--INI--
|
||||
zend.assertions=0
|
||||
assert.exception=1
|
||||
--FILE--
|
||||
<?php
|
||||
assert(false);
|
||||
var_dump(true);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,295 +0,0 @@
|
||||
--TEST--
|
||||
AST pretty-peinter
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
assert(0 && ($a = function () {
|
||||
global $a, $$b;
|
||||
static $c, $d = 0;
|
||||
unset($e);
|
||||
$x = isset($a) && !empty($b) || eval($c);
|
||||
$x = $a ? $b : $c;
|
||||
$x = $a ?: $c;
|
||||
$x = $a ?? $b;
|
||||
list($a, $b, $c) = [1, 2=>'x', 'z'=>'c'];
|
||||
@foo();
|
||||
$y = clone $x;
|
||||
yield 1 => 2;
|
||||
yield from $x;
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = "aaa";
|
||||
|
||||
public $a = 1, $b;
|
||||
protected $c;
|
||||
static private $d = null;
|
||||
|
||||
abstract function foo();
|
||||
|
||||
static private function f1() {
|
||||
for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
|
||||
$s[$i] = $a[$j];
|
||||
}
|
||||
foreach ($a as $key => &$val) {
|
||||
print "$key => $val\n";
|
||||
}
|
||||
while ($s[$i]) {
|
||||
$i++;
|
||||
}
|
||||
do {
|
||||
$i--;
|
||||
} while ($s[$i]);
|
||||
$x = foo($a + 1, 4, ...[1,2,3]);
|
||||
$x = ${$a . "_1"}();
|
||||
$x = A::foo();
|
||||
$x = ${$a . "_1"}::foo();
|
||||
$x = A::${$a . "_1"}();
|
||||
$x = $x->foo();
|
||||
$x = ${$a . "_1"}->foo();
|
||||
$x = $x->{$a . "_1"}();
|
||||
$x->a = C::C;
|
||||
${$a . "_1"}->a = ${$a . "_1"}::C;
|
||||
$x->{a . "_1"} = C::C;
|
||||
$x = C::$z;
|
||||
$x = ${$a . "_1"}::$z;
|
||||
$x = C::${$z . "_1"};
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
final class A {
|
||||
final protected function f2() {
|
||||
if (!$x) {
|
||||
return 0;
|
||||
}
|
||||
if ($x == 1) {
|
||||
return 1;
|
||||
} else if ($x == 2) {
|
||||
return 2;
|
||||
} else if ($x == 3) {
|
||||
return 3;
|
||||
} else {
|
||||
if ($x == 9) {
|
||||
return 9;
|
||||
}
|
||||
L0:
|
||||
do {
|
||||
switch ($x) {
|
||||
case 4: break;
|
||||
case 5: continue;
|
||||
case 6: break 2;
|
||||
case 7: continue 2;
|
||||
case 8: goto L0;
|
||||
default: return;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
class A {
|
||||
use T1, T2 {
|
||||
T1::foo insteadof foo;
|
||||
T2::foo as bar;
|
||||
baz as public;
|
||||
ops as protected x;
|
||||
}
|
||||
use T3;
|
||||
}
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &...$a) {
|
||||
declare(A=1,B=2);
|
||||
try {
|
||||
$i++;
|
||||
} catch (MyException $e) {
|
||||
echo 1;
|
||||
} catch (Exception $e) {
|
||||
echo 2;
|
||||
} finally {
|
||||
echo 3;
|
||||
}
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function () {
|
||||
declare(C=1) { echo 1; }
|
||||
$x = '\'"`$a';
|
||||
$x = "'\"`$a";
|
||||
$x = `'"\`$a`;
|
||||
$x = "{$a}b";
|
||||
$x = "${a}b";
|
||||
$x = " {$foo->bar} ${$foo->bar} ";
|
||||
$x = " ${'---'} ";
|
||||
foo();
|
||||
\foo();
|
||||
namespace\foo();
|
||||
$x = foo;
|
||||
$x = \foo;
|
||||
$x = namespace\foo;
|
||||
$x = new foo();
|
||||
$x = new \foo();
|
||||
$x = new namespace\foo();
|
||||
if ($a) {
|
||||
} elseif ($b) {
|
||||
}
|
||||
}));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(0 && ($a = function () {
|
||||
global $a;
|
||||
global $$b;
|
||||
static $c;
|
||||
static $d = 0;
|
||||
unset($e);
|
||||
$x = isset($a) && !empty($b) || eval($c);
|
||||
$x = $a ? $b : $c;
|
||||
$x = $a ?: $c;
|
||||
$x = $a ?? $b;
|
||||
list($a, $b, $c) = [1, 2 => 'x', 'z' => 'c'];
|
||||
@foo();
|
||||
$y = clone $x;
|
||||
yield 1 => 2;
|
||||
yield from $x;
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = 'aaa';
|
||||
public $a = 1, $b;
|
||||
protected $c;
|
||||
private static $d = null;
|
||||
public abstract function foo();
|
||||
|
||||
private static function f1() {
|
||||
for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
|
||||
$s[$i] = $a[$j];
|
||||
}
|
||||
foreach ($a as $key => &$val) {
|
||||
print "$key => $val\n";
|
||||
}
|
||||
while ($s[$i]) {
|
||||
$i++;
|
||||
}
|
||||
do {
|
||||
$i--;
|
||||
} while ($s[$i]);
|
||||
$x = foo($a + 1, 4, ...[1, 2, 3]);
|
||||
$x = ${$a . '_1'}();
|
||||
$x = A::foo();
|
||||
$x = ${$a . '_1'}::foo();
|
||||
$x = A::${$a . '_1'}();
|
||||
$x = $x->foo();
|
||||
$x = ${$a . '_1'}->foo();
|
||||
$x = $x->{$a . '_1'}();
|
||||
$x->a = C::C;
|
||||
${$a . '_1'}->a = ${$a . '_1'}::C;
|
||||
$x->{a . '_1'} = C::C;
|
||||
$x = C::$z;
|
||||
$x = ${$a . '_1'}::$z;
|
||||
$x = C::${$z . '_1'};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
final class A {
|
||||
protected final function f2() {
|
||||
if (!$x) {
|
||||
return 0;
|
||||
}
|
||||
if ($x == 1) {
|
||||
return 1;
|
||||
} else if ($x == 2) {
|
||||
return 2;
|
||||
} else if ($x == 3) {
|
||||
return 3;
|
||||
} else {
|
||||
if ($x == 9) {
|
||||
return 9;
|
||||
}
|
||||
L0:
|
||||
do {
|
||||
switch ($x) {
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
continue;
|
||||
case 6:
|
||||
break 2;
|
||||
case 7:
|
||||
continue 2;
|
||||
case 8:
|
||||
goto L0;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
class A {
|
||||
use T1, T2 {
|
||||
T1::foo insteadof foo;
|
||||
T2::foo as bar;
|
||||
baz as public;
|
||||
ops as protected x;
|
||||
}
|
||||
use T3;
|
||||
}
|
||||
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &...$a) {
|
||||
declare(A = 1, B = 2);
|
||||
try {
|
||||
$i++;
|
||||
} catch (MyException $e) {
|
||||
echo 1;
|
||||
} catch (Exception $e) {
|
||||
echo 2;
|
||||
} finally {
|
||||
echo 3;
|
||||
}
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function () {
|
||||
declare(C = 1) {
|
||||
echo 1;
|
||||
}
|
||||
$x = '\'"`$a';
|
||||
$x = "'\"`$a";
|
||||
$x = `'"\`$a`;
|
||||
$x = "{$a}b";
|
||||
$x = "{$a}b";
|
||||
$x = " {$foo->bar} {${$foo->bar}} ";
|
||||
$x = " ${---} ";
|
||||
foo();
|
||||
\foo();
|
||||
namespace\foo();
|
||||
$x = foo;
|
||||
$x = \foo;
|
||||
$x = namespace\foo;
|
||||
$x = new foo();
|
||||
$x = new \foo();
|
||||
$x = new namespace\foo();
|
||||
if ($a) {
|
||||
} elseif ($b) {
|
||||
}
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
test enable/disable assertions at runtime (assertions not completely disabled)
|
||||
--INI--
|
||||
zend.assertions=0
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("zend.assertions", 0);
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
ini_set("zend.assertions", 1);
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
ini_set("zend.assertions", -1);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_016.php on line 6
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_016.php on line 8
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
test enable/disable assertions at runtime (assertions completely disabled)
|
||||
--INI--
|
||||
zend.assertions=-1
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
ini_set("zend.assertions", 0);
|
||||
ini_set("zend.assertions", 1);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 4
|
||||
|
||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 5
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
test assertions in namespace
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
|
||||
ini_set("zend.assertions", 0);
|
||||
var_dump(\assert(false));
|
||||
var_dump(\assert(true));
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
ini_set("zend.assertions", 1);
|
||||
var_dump(\assert(false));
|
||||
var_dump(\assert(true));
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 10
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 12
|
||||
bool(false)
|
||||
bool(true)
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
test assertions in namespace (assertions completely disabled)
|
||||
--INI--
|
||||
zend.assertions=-1
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
|
||||
var_dump(\assert(false));
|
||||
var_dump(\assert(true));
|
||||
var_dump(assert(false));
|
||||
var_dump(assert(true));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Empty statement in assert() shouldn't segfault
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
assert((function () { return true;; })());
|
||||
echo "ok";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
assgin to object leaks with ref
|
||||
--FILE--
|
||||
<?php
|
||||
function &a($i) {
|
||||
$a = "str". $i ."ing";
|
||||
return $a;
|
||||
}
|
||||
|
||||
class A {
|
||||
public function test() {
|
||||
$this->a = a(1);
|
||||
unset($this->a);
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
|
||||
$a->test();
|
||||
$a->test();
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECT--
|
||||
okey
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Serialization of backtick literal is incorrect
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
assert_options(ASSERT_WARNING);
|
||||
assert(false && `echo -n ""`);
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(false && `echo -n ""`) failed in %s%east_serialize_backtick_literal.php on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
'break' error (non positive numbers)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
break 0;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: 'break' operator accepts only positive numbers in %sbreak_error_001.php on line 3
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
'break' error (operator with non-constant operand)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
break $x;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: 'break' operator with non-constant operand is no longer supported in %sbreak_error_002.php on line 3
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
'break' error (not in the loop context)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: 'break' not in the 'loop' or 'switch' context in %sbreak_error_003.php on line 3
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
'break' error (wrong level)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
while (1) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot 'break' 2 levels in %sbreak_error_004.php on line 4
|
||||
@@ -8,7 +8,7 @@ setlocale(LC_ALL, $g_lang);
|
||||
|
||||
class InfoBlob {
|
||||
var $foo;
|
||||
function __construct() {
|
||||
function InfoBlob() {
|
||||
$this->foo = "Foo";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class test
|
||||
{
|
||||
public $member;
|
||||
|
||||
function __construct() {
|
||||
function test() {
|
||||
$this->member = 1;
|
||||
register_shutdown_function(array($this, 'destructor'));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,4 @@ Bug #24773 (unset() of integers treated as arrays causes a crash)
|
||||
unset($array["lvl1"]["lvl2"]["b"]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
Fatal error: Cannot use string offset as an array in %s on line %d
|
||||
@@ -37,25 +37,25 @@ function my_error_handler($errno, $errstr, $errfile, $errline) {
|
||||
|
||||
set_error_handler('my_error_handler');
|
||||
|
||||
class NoneTest
|
||||
class None
|
||||
{
|
||||
function __toString() {
|
||||
}
|
||||
}
|
||||
|
||||
$o = new NoneTest;
|
||||
$o = new None;
|
||||
echo $o;
|
||||
|
||||
echo "===THROW===\n";
|
||||
|
||||
class ErrorTest
|
||||
class Error
|
||||
{
|
||||
function __toString() {
|
||||
throw new Exception("This is an error!");
|
||||
}
|
||||
}
|
||||
|
||||
$o = new ErrorTest;
|
||||
$o = new Error;
|
||||
try {
|
||||
echo $o;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ catch (Exception $e) {
|
||||
--EXPECTF--
|
||||
Hello World!
|
||||
===NONE===
|
||||
string(%d) "Method NoneTest::__toString() must return a string value"
|
||||
string(52) "Method None::__toString() must return a string value"
|
||||
===THROW===
|
||||
|
||||
Fatal error: Method ErrorTest::__toString() must not throw an exception, caught Exception: This is an error! in %sbug26166.php on line %d
|
||||
Fatal error: Method Error::__toString() must not throw an exception in %sbug26166.php on line %d
|
||||
Loaded 100 of 4481 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user