mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 10:10:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fad4c7375 |
No files matched your search
@@ -106,7 +106,7 @@ define dump_bt
|
||||
printf "%ld", $zvalue->value.lval
|
||||
end
|
||||
if $type == 2
|
||||
printf "%f", $zvalue->value.dval
|
||||
printf "%lf", $zvalue->value.dval
|
||||
end
|
||||
if $type == 3
|
||||
if $zvalue->value.lval
|
||||
@@ -185,7 +185,7 @@ define ____printzv_contents
|
||||
printf "long: %ld", $zvalue->value.lval
|
||||
end
|
||||
if $type == 2
|
||||
printf "double: %f", $zvalue->value.dval
|
||||
printf "double: %lf", $zvalue->value.dval
|
||||
end
|
||||
if $type == 3
|
||||
printf "bool: "
|
||||
|
||||
@@ -23,8 +23,6 @@ sapi/continuity/capi.c ident
|
||||
Zend/RFCs/002.txt ident
|
||||
Zend/RFCs/003.txt ident
|
||||
NEWS merge=NEWS
|
||||
UPGRADING merge=NEWS
|
||||
UPGRADING.INTERNALS merge=NEWS
|
||||
/ext/bz2/tests/with_strings.phpt -crlf
|
||||
/ext/dom/tests/bug40836.phpt -crlf
|
||||
/ext/dom/tests/domelement.phpt -crlf
|
||||
|
||||
@@ -96,8 +96,6 @@ stamp-h.in
|
||||
scan_makefile_in.awk
|
||||
TSRM/tsrm_config.h
|
||||
Zend/zend_config.h
|
||||
Zend/zend_dtrace_gen.h
|
||||
Zend/zend_dtrace_gen.hbak
|
||||
Zend/zend_ini_parser.c
|
||||
Zend/zend_ini_parser.h
|
||||
Zend/zend_ini_parser.output
|
||||
@@ -206,8 +204,6 @@ ext/pdo_sqlite/sqlite3.h
|
||||
ext/pdo_sqlite/tests/*.db
|
||||
ext/pdo_sqlite/tests/*.tmp
|
||||
ext/phar/phar.phar
|
||||
ext/phar/phar.1
|
||||
ext/phar/phar.phar.1
|
||||
ext/pspell/tests/*.tmp
|
||||
ext/reflection/xml
|
||||
ext/reflection/html
|
||||
@@ -239,14 +235,12 @@ sapi/apache/libphp5.module
|
||||
sapi/apache2handler/libphp5.module
|
||||
sapi/apache_hooks/libphp5.module
|
||||
sapi/cgi/php-cgi
|
||||
sapi/cgi/php-cgi.1
|
||||
sapi/cli/php.1
|
||||
sapi/fpm/php-fpm
|
||||
sapi/fpm/php-fpm.1
|
||||
sapi/fpm/init.d.php-fpm
|
||||
sapi/fpm/php-fpm.conf
|
||||
sapi/fpm/fpm/php-cgi
|
||||
sapi/phpdbg/phpdbg
|
||||
scripts/php-config
|
||||
scripts/phpize
|
||||
scripts/man1/*.1
|
||||
|
||||
+4
-27
@@ -1,32 +1,9 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
# We only specify one version so we only get one worker
|
||||
- 5.4
|
||||
branches:
|
||||
except:
|
||||
- /^PHP-5\.3.*/
|
||||
- /^PHP-5\.4.*/
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- MYSQL_TEST_HOST=127.0.0.1
|
||||
- MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
|
||||
- PDO_MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_PASS=
|
||||
- PDO_MYSQL_TEST_HOST=127.0.0.1
|
||||
matrix:
|
||||
- REPORT_EXIT_STATUS=1
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
# Setup Extensions
|
||||
- . ./travis/ext/mysql/setup.sh
|
||||
- . ./travis/ext/mysqli/setup.sh
|
||||
- . ./travis/ext/pdo_mysql/setup.sh
|
||||
- . ./travis/ext/pgsql/setup.sh
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
||||
+7
-30
@@ -59,8 +59,8 @@ Exceptions:
|
||||
you're calling.
|
||||
|
||||
7. When commenting out code using a #if statement, do NOT use 0 only. Instead
|
||||
use "<git username here>_0". For example, #if FOO_0, where FOO is your
|
||||
git user foo. This allows easier tracking of why code was commented out,
|
||||
use "<svn username here>_0". For example, #if FOO_0, where FOO is your
|
||||
svn user foo. This allows easier tracking of why code was commented out,
|
||||
especially in bundled libraries.
|
||||
|
||||
8. Do not define functions that are not available. For instance, if a
|
||||
@@ -82,7 +82,7 @@ Exceptions:
|
||||
library may need to control or free the memory, or when the memory in
|
||||
question needs to survive between multiple requests.
|
||||
|
||||
User Functions/Methods Naming Conventions
|
||||
Naming Conventions
|
||||
------------------
|
||||
|
||||
1. Function names for user-level functions should be enclosed with in
|
||||
@@ -151,7 +151,7 @@ User Functions/Methods Naming Conventions
|
||||
|
||||
7. Classes should be given descriptive names. Avoid using abbreviations where
|
||||
possible. Each word in the class name should start with a capital letter,
|
||||
without underscore delimiters (CamelCaps starting with a capital letter).
|
||||
without underscore delimiters (CampelCaps starting with a capital letter).
|
||||
The class name should be prefixed with the name of the 'parent set' (e.g.
|
||||
the name of the extension)::
|
||||
|
||||
@@ -163,26 +163,6 @@ User Functions/Methods Naming Conventions
|
||||
'foobar'
|
||||
'foo_bar'
|
||||
|
||||
Internal Function Naming Convensions
|
||||
----------------------
|
||||
|
||||
1. Functions that are part of the external API should be named
|
||||
'php_modulename_function()' to avoid symbol collision. They should be in
|
||||
lowercase, with words underscore delimited. Exposed API must be defined
|
||||
in 'php_modulename.h'.
|
||||
|
||||
PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS);
|
||||
|
||||
Unexposed module function should be static and should not be defined in
|
||||
'php_modulename.h'.
|
||||
|
||||
static int php_session_destroy(TSRMLS_D)
|
||||
|
||||
2. Main module source file must be named 'modulename.c'.
|
||||
|
||||
3. Header file that is used by other sources must be named 'php_modulename.h'.
|
||||
|
||||
|
||||
Syntax and indentation
|
||||
----------------------
|
||||
|
||||
@@ -201,9 +181,9 @@ Syntax and indentation
|
||||
of PHP or one of its standard modules, please maintain the K&R
|
||||
style. This applies to just about everything, starting with
|
||||
indentation and comment styles and up to function declaration
|
||||
syntax. Also see Indentstyle.
|
||||
syntax. Also see Indentstyle_.
|
||||
|
||||
Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
|
||||
|
||||
3. Be generous with whitespace and braces. Keep one empty line between the
|
||||
variable declaration section and the statements in a block, as well as
|
||||
@@ -279,10 +259,7 @@ The file labelled 'EXPERIMENTAL' should include the following
|
||||
information::
|
||||
|
||||
Any authoring information (known bugs, future directions of the module).
|
||||
Ongoing status notes which may not be appropriate for Git comments.
|
||||
|
||||
In general new features should go to PECL or experimental branches until
|
||||
there are specific reasons for directly adding it to the core distribution.
|
||||
Ongoing status notes which may not be appropriate for SVN comments.
|
||||
|
||||
Aliases & Legacy Documentation
|
||||
-----------------------------------
|
||||
|
||||
+2
-2
@@ -147,7 +147,7 @@ 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>
|
||||
PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -158,7 +158,7 @@ STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqlnd
|
||||
PRIMARY MAINTAINER: Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
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
|
||||
STATUS: Working
|
||||
SINCE: 5.3
|
||||
|
||||
@@ -1819,7 +1819,7 @@ Installation
|
||||
set of HTTP headers. The headers it did return are:
|
||||
10. Windows: I've followed all the instructions, but still can't get
|
||||
PHP and IIS to work together!
|
||||
11. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get
|
||||
11. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
|
||||
the following error: Security Alert! PHP CGI cannot be accessed
|
||||
directly..
|
||||
12. How do I know if my php.ini is being found and read? It seems like
|
||||
@@ -2007,7 +2007,7 @@ cgi error:
|
||||
And for IIS4 you need to tell it that PHP is a script engine.
|
||||
Also, you will want to read this faq.
|
||||
|
||||
When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get the
|
||||
When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the
|
||||
following error: Security Alert! PHP CGI cannot be accessed
|
||||
directly..
|
||||
You must set the cgi.force_redirect directive to 0. It defaults
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2012 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2010 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ $(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
|
||||
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
|
||||
|
||||
$(srcdir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
|
||||
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
|
||||
|
||||
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
|
||||
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
@@ -18,6 +18,6 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
|
||||
|
||||
$(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)
|
||||
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
|
||||
|
||||
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
|
||||
+8
-22
@@ -3,8 +3,6 @@
|
||||
# LCOV
|
||||
#
|
||||
|
||||
LCOV_INCLUDE="."
|
||||
|
||||
lcov: lcov-html
|
||||
|
||||
lcov-test: lcov-clean-data test
|
||||
@@ -14,7 +12,7 @@ php_lcov.info: lcov-test
|
||||
@rm -rf lcov_data/
|
||||
@$(mkinstalldirs) lcov_data/
|
||||
@echo
|
||||
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | uniq` ;\
|
||||
-@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq` ;\
|
||||
for x in $$files; do \
|
||||
echo -n . ;\
|
||||
y=`echo $$x | sed -e 's!\.libs/!!'`; \
|
||||
@@ -41,26 +39,14 @@ php_lcov.info: lcov-test
|
||||
if test -f "$(top_builddir)/$$y.c"; then \
|
||||
ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
|
||||
fi; \
|
||||
if test -f "$$x.gcno"; then \
|
||||
cp $$x.gcno lcov_data/$$y.gcno ; \
|
||||
fi; \
|
||||
if test -f "$$x.gcda"; then \
|
||||
cp $$x.gcda lcov_data/$$y.gcda ; \
|
||||
fi; \
|
||||
if test -f "$$x.da"; then \
|
||||
cp $$x.da lcov_data/$$y.da ; \
|
||||
fi; \
|
||||
if test -f "$$x.bb"; then \
|
||||
cp $$x.bb lcov_data/$$y.bb ; \
|
||||
fi; \
|
||||
if test -f "$$x.bbg"; then \
|
||||
cp $$x.bbg lcov_data/$$y.bbg ; \
|
||||
fi; \
|
||||
done; \
|
||||
test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \
|
||||
test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \
|
||||
test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \
|
||||
test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \
|
||||
test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \
|
||||
done
|
||||
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; \
|
||||
test -d lcov_data/$$dir && rm -rf lcov_data/$$dir ; \
|
||||
done
|
||||
@echo
|
||||
@echo "Generating $@"
|
||||
|
||||
+3
-15
@@ -86,7 +86,7 @@ PHP_TEST_SHARED_EXTENSIONS = ` \
|
||||
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
|
||||
|
||||
test: all
|
||||
@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
|
||||
if test "$$INI_FILE"; then \
|
||||
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
|
||||
@@ -102,9 +102,7 @@ test: all
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
|
||||
TEST_RESULT_EXIT_CODE=$$?; \
|
||||
rm $(top_builddir)/tmp-php.ini; \
|
||||
exit $$TEST_RESULT_EXIT_CODE; \
|
||||
else \
|
||||
echo "ERROR: Cannot run tests without CLI sapi."; \
|
||||
fi
|
||||
@@ -115,20 +113,10 @@ clean:
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
find . -name \*.1 | 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/*
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f php5.spec main/build-defs.h scripts/phpize
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
|
||||
rm -f ext/phar/phar.phar ext/phar/phar.php
|
||||
if test "$(srcdir)" != "$(builddir)"; then \
|
||||
rm -f ext/phar/phar/phar.inc; \
|
||||
fi
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak
|
||||
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
|
||||
that broke both source and binary compatibility. If you are
|
||||
maintaining a third party extension, here's how to update it:
|
||||
|
||||
If this was your old module entry:
|
||||
|
||||
zend_module_entry foo_module_entry = {
|
||||
"foo", /* extension name */
|
||||
foo_functions, /* extension function list */
|
||||
NULL, /* extension-wide startup function */
|
||||
NULL, /* extension-wide shutdown function */
|
||||
PHP_RINIT(foo), /* per-request startup function */
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
Here's how it should look if you want your code to build with PHP
|
||||
4.1.0 and up:
|
||||
|
||||
zend_module_entry foo_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"foo", /* extension name */
|
||||
foo_functions, /* extension function list */
|
||||
NULL, /* extension-wide startup function */
|
||||
NULL, /* extension-wide shutdown function */
|
||||
PHP_RINIT(foo), /* per-request startup function */
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
FOO_VERSION, /* extension version number (string) */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
If you don't care about source compatibility with earlier PHP releases
|
||||
than 4.1.0, you can drop the #if/#endif lines.
|
||||
+6
-29
@@ -31,11 +31,6 @@ HOW TO USE IT
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
The definition of PHP_MODULE_NAME_VERSION will be present in the
|
||||
php_module_name.h and injected into the zend_module_entry definition. This
|
||||
is required by the PECL website for the version string conformity checks
|
||||
against package.xml
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
@@ -45,29 +40,12 @@ HOW TO USE IT
|
||||
|
||||
--proto=filename.
|
||||
|
||||
SOURCE AND HEADER FILE NAME
|
||||
|
||||
./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source
|
||||
and header files. Keep these names.
|
||||
|
||||
Module functions (User functions) must be named
|
||||
|
||||
module_name_function()
|
||||
|
||||
When you need to expose module functions to other modules, expose functions
|
||||
strictly needed by others. Exposed internal function must be named
|
||||
|
||||
php_module_name_function()
|
||||
|
||||
See also CODING_STANDARDS.
|
||||
|
||||
|
||||
FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
All the definitions must be on one line. In it's simplest form, it's just
|
||||
the function name, e.g.
|
||||
|
||||
module_name_function
|
||||
my_function
|
||||
|
||||
but then you'll be left with an almost empty function body without any
|
||||
argument handling.
|
||||
@@ -89,9 +67,8 @@ FORMAT OF FUNCTION DEFINITIONS FILE
|
||||
|
||||
An example:
|
||||
|
||||
module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]])
|
||||
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
|
||||
|
||||
Arguments arg1 and arg2 are required.
|
||||
Arguments arg3 and arg4 are optional.
|
||||
|
||||
If possible, the function definition should also contain it's return type
|
||||
@@ -151,15 +128,15 @@ EXAMPLE
|
||||
|
||||
The following _one_ line
|
||||
|
||||
bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
|
||||
will create this function definition for you (note that there are a few
|
||||
question marks to be replaced by you, and you must of course add your own
|
||||
value definitions too):
|
||||
|
||||
/* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
|
||||
*/
|
||||
PHP_FUNCTION(module_name_drawtext)
|
||||
PHP_FUNCTION(my_drawtext)
|
||||
{
|
||||
char *text = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
@@ -182,7 +159,7 @@ PHP_FUNCTION(module_name_drawtext)
|
||||
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
|
||||
}
|
||||
|
||||
php_error(E_WARNING, "module_name_drawtext: not yet implemented");
|
||||
php_error(E_WARNING, "my_drawtext: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+3
-5
@@ -69,11 +69,9 @@ The next few rules are more of a technical nature::
|
||||
branches) an empty merge should be done.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file of *any
|
||||
stable release* version with the given change. In other words,
|
||||
news about a bug fix which went into PHP-5.4, PHP-5.5 and master
|
||||
should be noted in both PHP-5.4/NEWS and PHP-5.5/NEWS but
|
||||
not master, which is not a public released version yet.
|
||||
bug fixes, improvements, etc., should go into the NEWS file of the
|
||||
*first* to be released version with the given change. In other words
|
||||
any NEWS file change only needs to done in one branch.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
|
||||
@@ -28,17 +28,6 @@ Both functions return SUCCESS or FAILURE depending on the result.
|
||||
The auto-conversions are performed as necessary. Arrays, objects, and
|
||||
resources cannot be auto-converted.
|
||||
|
||||
PHP 5.5 includes a new function:
|
||||
|
||||
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
|
||||
(passed with double indirection). The passed zval may be changed in place as
|
||||
part of the conversion process.
|
||||
|
||||
See also https://wiki.php.net/rfc/zpp_improv#expose_zend_parse_arg_as_zend_parse_parameter
|
||||
|
||||
|
||||
Type specifiers
|
||||
---------------
|
||||
@@ -76,13 +65,9 @@ Type specifiers
|
||||
will not be touched by the parsing function if they are not
|
||||
passed to it.
|
||||
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
|
||||
! - the parameter it follows can be of specified type or NULL. If NULL is
|
||||
passed and the output for such type is a pointer, then the output
|
||||
pointer is set to a native NULL pointer.
|
||||
For 'b', 'l' and 'd', an extra argument of type zend_bool* must be
|
||||
passed after the corresponding bool*, long* or double* arguments,
|
||||
respectively. A non-zero value will be written to the zend_bool iif a
|
||||
PHP NULL is passed.
|
||||
! - the parameter it follows can be of specified type or NULL (applies
|
||||
to all specifiers except for 'b', 'l', and 'd'). If NULL is passed, the
|
||||
results pointer is set to NULL as well.
|
||||
|
||||
|
||||
Note on 64bit compatibility
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
1. strrpos() and strripos() now use the entire string as a needle. Be aware
|
||||
that the existing scripts may no longer work as you expect.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
var_dump(strrpos("ABCDEF","DEF"));
|
||||
var_dump(strrpos("ABCDEF","DAF"));
|
||||
?>
|
||||
|
||||
Will give you different results. The former returns 3 while the latter
|
||||
returns false rather than the position of the last occurrence of 'D'.
|
||||
The same applies to strripos().
|
||||
|
||||
2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
$a = "foo";
|
||||
unset($a[0][1][2]);
|
||||
?>
|
||||
|
||||
Fatal error: Cannot use string offset as an array in ... on line 1
|
||||
|
||||
3. array_merge() was changed to accept only arrays. If a non-array variable is
|
||||
passed, a E_WARNING will be thrown for every such parameter. Be careful
|
||||
because your code may start emitting E_WARNING out of the blue.
|
||||
|
||||
4. Be careful when porting from ext/mysql to ext/mysqli. The following
|
||||
functions return NULL when no more data is available in the result set
|
||||
(ext/mysql's functions return FALSE).
|
||||
|
||||
- mysqli_fetch_row()
|
||||
- mysqli_fetch_array()
|
||||
- mysqli_fetch_assoc()
|
||||
|
||||
5. PATH_TRANSLATED server variable is no longer set implicitly under
|
||||
Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
|
||||
same value as the SCRIPT_FILENAME server variable when it is not populated
|
||||
by Apache. This change was made to comply with the CGI specification.
|
||||
Please refer to bug #23610 for further information.
|
||||
|
||||
6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
|
||||
ext/tokenizer extension. If error_reporting is set to E_ALL notices will
|
||||
be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
|
||||
is used, thus both // and /* */ are resolved as the T_COMMENT constant.
|
||||
However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
|
||||
by PHP, are recongnized as T_DOC_COMMENT.
|
||||
|
||||
7. $_SERVER should be populated with argc and argv if variables_order
|
||||
includes "S". If you have specifically configured your system to not
|
||||
create $_SERVER, then of course it shouldn't be there. The change was to
|
||||
always make argc and argv available in the CLI version regardless of the
|
||||
variables_order setting. As in, the CLI version will now always populate
|
||||
the global $argc and $argv variables.
|
||||
|
||||
8. In some cases classes must be declared before used. It only happens only
|
||||
if some of the new features of PHP 5 are used. Otherwise the behaviour is
|
||||
the old.
|
||||
Example 1 (works with no errors):
|
||||
<?php
|
||||
$a = new a();
|
||||
class a {
|
||||
}
|
||||
?>
|
||||
|
||||
Example 2 (throws an error):
|
||||
<?php
|
||||
$a = new a();
|
||||
interface b{
|
||||
}
|
||||
class a implements b {
|
||||
}
|
||||
?>
|
||||
|
||||
Output (example 2) :
|
||||
Fatal error: Class 'a' not found in /tmp/cl.php on line 2
|
||||
|
||||
9. get_class() starting PHP 5 returns the name of the class as it was
|
||||
declared which may lead to problems in older scripts that rely on
|
||||
the previous behaviour - the class name is lowercased. Expect the
|
||||
same behaviour from get_parent_class() when applicable.
|
||||
Example :
|
||||
<?php
|
||||
class FooBar {
|
||||
}
|
||||
class ExtFooBar extends FooBar{}
|
||||
$a = new FooBar();
|
||||
var_dump(get_class($a), get_parent_class($a));
|
||||
?>
|
||||
|
||||
Output (PHP 4):
|
||||
string(6) "foobar"
|
||||
string(9) "extfoobar"
|
||||
|
||||
Output (PHP 5):
|
||||
string(6) "FooBar"
|
||||
string(9) "ExtFooBar"
|
||||
----------------------------------------------------------------------
|
||||
Example code that will break :
|
||||
//....
|
||||
function someMethod($p) {
|
||||
if (get_class($p) != 'helpingclass') {
|
||||
return FALSE;
|
||||
}
|
||||
//...
|
||||
}
|
||||
//...
|
||||
Possible solution is to search for get_class() and get_parent_class() in
|
||||
all your scripts and use strtolower().
|
||||
|
||||
10. get_class_methods() returns the names of the methods of a class as they
|
||||
declared. In PHP4 the names are all lowercased.
|
||||
Example code :
|
||||
<?php
|
||||
class Foo{
|
||||
function doFoo(){}
|
||||
function hasFoo(){}
|
||||
}
|
||||
var_dump(get_class_methods("Foo"));
|
||||
?>
|
||||
Output (PHP4):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "dofoo"
|
||||
[1]=>
|
||||
string(6) "hasfoo"
|
||||
}
|
||||
Output (PHP5):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "doFoo"
|
||||
[1]=>
|
||||
string(6) "hasFoo"
|
||||
}
|
||||
|
||||
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
|
||||
meaning in class methods and is recognized by the PHP parser. The latter
|
||||
will generate a parse error when assignment to $this is found
|
||||
Example code :
|
||||
<?php
|
||||
class Foo {
|
||||
function assignNew($obj) {
|
||||
$this = $obj;
|
||||
}
|
||||
}
|
||||
$a = new Foo();
|
||||
$b = new Foo();
|
||||
$a->assignNew($b);
|
||||
echo "I was executed\n";
|
||||
?>
|
||||
Output (PHP 4):
|
||||
I was executed
|
||||
Output (PHP 5):
|
||||
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
|
||||
|
||||
+70
-80
@@ -8,16 +8,15 @@ General notes and tips
|
||||
1. Do not release on Fridays, Saturdays or Sundays
|
||||
because the sysadmins can not upgrade stuff then.
|
||||
|
||||
2. Package two days before a release. So if the release is to be on Thursday,
|
||||
package on Tuesday. Think about timezones as well.
|
||||
2. Package the day before a release. So if the release is to be on Thursday,
|
||||
package on Wednesday.
|
||||
|
||||
3. Ensure that Windows builds will work before packaging
|
||||
|
||||
4. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
|
||||
Johannes/Stas/Derick/Ilia) before proceeding. Ideally make sure that for the
|
||||
first releases one of the previous RM's is around to answer questions. For the
|
||||
steps related to the php/QA/bug websites try to have someone from the webmaster
|
||||
team (Bjori) on hand.
|
||||
4. Follow all steps to the letter. When unclear ask previous RM's (Derick/Ilia)
|
||||
before proceeding. Ideally make sure that for the first releases one of the
|
||||
previous RM's is around to answer questions. For the steps related to the
|
||||
php/QA/bug websites try to have someone from the webmaster team (Bjori) on hand.
|
||||
|
||||
5. Verify the tags to be extra sure everything was tagged properly.
|
||||
|
||||
@@ -51,44 +50,30 @@ Rolling a non stable release (alpha/beta/RC)
|
||||
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
3. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
|
||||
3. Checkout the release branch for this release (e.g., PHP-5.4.2).
|
||||
|
||||
4. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
Do not use abbreviations for alpha and beta. Do not use dashes, you should
|
||||
``#define PHP_VERSION "5.4.22RC1"`` and not ``#define PHP_VERSION "5.4.22-RC1"``
|
||||
Do not use abbreviations for alpha and beta.
|
||||
|
||||
5. Compile and make test, with and without ZTS, using the right Bison version
|
||||
(for example, for 5.5, Bison 2.4.1 is used)
|
||||
5. Commit these changes to the branch with ``git commit -a``.
|
||||
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
|
||||
7. If all is right, commit the changes to the release branch with ``git commit -a``.
|
||||
|
||||
8. Tag the repository release branch with the version, e.g.:
|
||||
6. Tag the repository with the version, e.g.:
|
||||
``git tag -u YOURKEYID php-5.4.2RC2``
|
||||
|
||||
9. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
|
||||
in the *main* branch (PHP-5.4 for example) to prepare for the **next** version.
|
||||
F.e. if the RC is "5.4.1RC1" then the new one should be "5.4.2-dev" - regardless if we get
|
||||
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
|
||||
Commit the changes to the main branch.
|
||||
|
||||
10. Push the changes to the main repo, the tag, the main branch and the release branch :
|
||||
7. Push the changes to the main repo:
|
||||
``git push --tags origin HEAD``
|
||||
``git push origin {main branch}``
|
||||
``git push origin {release branch}``
|
||||
|
||||
11. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
8. run: ``./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
|
||||
12. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
9. Copy those two tarballs to www.php.net, in your homedir there should be a
|
||||
directory "downloads/". Copy them into there, so that the system can generate
|
||||
MD5 sums. If you do not have this directory, talk to Derick or Dan.
|
||||
MD5 sums. If you do not have this directory, talk to Derick.
|
||||
|
||||
13. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
10. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
f.e. http://downloads.php.net/derick/
|
||||
|
||||
14. Once the release has been tagged, contact the PHP Windows development team
|
||||
11. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
those are made, they should be placed into the same directory as the source snapshots.
|
||||
|
||||
@@ -101,10 +86,10 @@ pointing out "the location of the release" and "the possible release date of
|
||||
either the next RC, or the final release".
|
||||
|
||||
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tester@lists.php.net``.
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tests@lists.php.net``.
|
||||
This email is to notify the selected projects about a new release so that they
|
||||
can make sure their projects keep working. Make sure that you have been setup
|
||||
as a moderator for ``primary-qa-tester@lists.php.net`` by having someone (Hannes, Dan,
|
||||
as a moderator for ``primary-qa-tests@lists.php.net`` by having someone (Wez,
|
||||
Derick) run the following commands for you:
|
||||
|
||||
``ssh lists.php.net``
|
||||
@@ -120,9 +105,9 @@ Derick) run the following commands for you:
|
||||
|
||||
Note: Remember to update the MD5 checksum information.
|
||||
|
||||
4. Update ``web/php.git/include/version.inc`` (x=major version number)
|
||||
4. Update ``php.git/include/version.inc`` (x=major version number)
|
||||
|
||||
a. ``$PHP_x_RC`` = "5.4.0RC1" (should be set to "false" before)
|
||||
a. ``$PHP_x_RC`` = "5.4.0RC1"
|
||||
|
||||
b. ``$PHP_x_RC_DATE`` = "06 September 2007"
|
||||
|
||||
@@ -133,61 +118,67 @@ Derick) run the following commands for you:
|
||||
6. For the first RC, write the doc team (phpdoc@lists.php.net) about updating the
|
||||
INSTALL and win32/install.txt files which are generated from the PHP manual sources.
|
||||
|
||||
7. Publish the announce on www.php.net as well (for all releases, alpha, RCs or other)
|
||||
|
||||
Rolling a stable release
|
||||
------------------------
|
||||
|
||||
1. Checkout your release branch, you should have created when releasing previous RC
|
||||
and bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
|
||||
|
||||
2. If a CVE commit needs to be merged to the release, then have it commited to
|
||||
the base branches and merged upwards as usual (f.e commit the CVE fix to 5.3,
|
||||
merge to 5.4, 5.5 etc...). Then you can cherry-pick it in your release branch.
|
||||
Don't forget to update NEWS manually in an extra commit then.
|
||||
2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
|
||||
3. Commit those changes
|
||||
3. **Merge** all related sections in NEWS (f.e. merge the 5.4.1RC1 and 5.4.0 sections)
|
||||
|
||||
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
4. Commit those changes
|
||||
|
||||
5. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
5. Compile and make test, with and without ZTS, using the right Bison version
|
||||
(for example, for 5.5, Bison 2.4.1 is used)
|
||||
6. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
|
||||
(of course, you need to change that to the version you're rolling an RC for).
|
||||
When making 5.X release, you need to tag the Zend directory separately!!
|
||||
|
||||
6. Check ./sapi/cli/php -v output for version matching.
|
||||
7. Bump up the version numbers in ``main/php_version.h``, ``configure.in`` and
|
||||
possibly ``NEWS`` again, to the **next** version. F.e. if the release candidate
|
||||
was "5.4.1RC1" then the new one should be "5.4.1RC2-dev" - regardless if we get
|
||||
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
|
||||
|
||||
7. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
|
||||
8. Commit those changes
|
||||
|
||||
8. Push the tag f.e. "``git push origin php-5.4.1``"
|
||||
9. Log in onto the snaps box and go into the correct tree (f.e. the PHP-5.4
|
||||
branch if you're rolling 5.5.x releases).
|
||||
|
||||
9. run: ``PHPROOT=. ./makedist php 5.4.1``, this will export the tag, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
Check if the pear files are updated (phar).
|
||||
10. You do not have to update the tree, but of course you can with "``git pull
|
||||
origin <branch>``".
|
||||
|
||||
10. Generate the GPG signature files for the archives.
|
||||
``gpg -u YOUREMAIL --armor --detach-sign php-X.Y.Z.tar.xxx``
|
||||
11. run: ``./makedist php 5.4.1``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
|
||||
11. Commit and push all the tarballs and signature files to web/php-distributions.git,
|
||||
then update the git submodule reference in web/php.git:
|
||||
``git submodule init;
|
||||
12. Commit those two tarballs to web/php-distributions.git, then update the git
|
||||
submodule reference in web/php.git:
|
||||
git submodule init;
|
||||
git submodule update;
|
||||
cd distributions;
|
||||
git pull origin master;
|
||||
cd ..;
|
||||
git commit distributions;
|
||||
git push;``
|
||||
This is to fetch the last commit id from php-distributions.git and commit this
|
||||
last commit id to web/php.git, then, mirrors will now sync
|
||||
git push;
|
||||
|
||||
12. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created.
|
||||
13. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
those are made, they should be committed to SVN too.
|
||||
|
||||
14. Check if the pear files are updated (phar for 5.1+ or run pear/make-pear-bundle.php with 4.4)
|
||||
|
||||
15. When making a final release, also remind the PHP Windows development team
|
||||
(internals-win@lists.php.net) to prepare the installer packages for Win32.
|
||||
|
||||
Getting the stable release announced
|
||||
------------------------------------
|
||||
|
||||
1. Run the bumpRelease script for phpweb on your local checkout
|
||||
|
||||
a. ``php bin/bumpRelease 5`` to create the release file (releases/x_y_z.php)
|
||||
The release announcement file should list in detail security fixes and
|
||||
changes in behavior (whether due to a bug fix or not).
|
||||
a. ``php bin/bumpRelease 5`` (or ``php bin/bumpRelease 4`` for PHP4)
|
||||
|
||||
b. In case multiple PHP minor versions are in active development you have
|
||||
to manually copy the old information to include/releases.inc
|
||||
@@ -207,13 +198,7 @@ Getting the stable release announced
|
||||
|
||||
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
|
||||
3. Update phpweb/include/releases.php with the old release info
|
||||
(updates the download archives)
|
||||
|
||||
4. Update php-qa/include/release-qa.php and add the next version as an QARELEASE
|
||||
(prepare for next RC)
|
||||
|
||||
5. Update the ChangeLog file for the given major version
|
||||
3. Update the ChangeLog file for the given major version
|
||||
f.e. ``ChangeLog-5.php`` from the NEWS file
|
||||
|
||||
a. go over the list and put every element on one line
|
||||
@@ -233,10 +218,19 @@ f.e. ``ChangeLog-5.php`` from the NEWS file
|
||||
IV. ``s/Fixed PECL bug #\([0-9]\+\)/<?php peclbugfix(\1); ?>/``
|
||||
|
||||
V. ``s/FR #\([0-9]\+\)/FR <?php bugl(\1); ?>/``
|
||||
|
||||
e. You may want to try php-web/bin/news2html to automate this task
|
||||
|
||||
6. Add a short notice to phpweb stating that there is a new release, and
|
||||
4. ``cp releases/5_4_0.php releases/5_4_1.php``
|
||||
|
||||
5. ``git add releases/5_4_1.php``
|
||||
|
||||
6. Update the ``releases/*.php`` file with relevant data. The release
|
||||
announcement file should list in detail:
|
||||
|
||||
a. security fixes,
|
||||
|
||||
b. changes in behavior (whether due to a bug fix or not)
|
||||
|
||||
7. Add a short notice to phpweb stating that there is a new release, and
|
||||
highlight the major important things (security fixes) and when it is important
|
||||
to upgrade.
|
||||
|
||||
@@ -244,11 +238,7 @@ to upgrade.
|
||||
|
||||
b. Add the content for the news entry
|
||||
|
||||
7. **Check mirrors have been synced before announcing or pushing news**
|
||||
Try, f.e. http://www.php.net/get/php-5.5.1.tar.bz2/from/a/mirror
|
||||
Try several mirrors, mirrors may update slowly (may take an hour)
|
||||
|
||||
8. Commit all the changes to their respective git repos
|
||||
8. Commit all the changes.
|
||||
|
||||
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
|
||||
|
||||
@@ -153,18 +153,3 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
|
||||
PECL SITE CONFORMITY
|
||||
|
||||
If you plan to release an extension to the PECL website, there are several
|
||||
points to be regarded.
|
||||
|
||||
1. Add LICENSE or COPYING to the package.xml
|
||||
|
||||
2. The following should be defined in one of the extension header files
|
||||
|
||||
#define PHP_FOO_VERSION "1.2.3"
|
||||
|
||||
This macros has to be used within your foo_module_entry to indicate the
|
||||
extension version.
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ Opening Streams
|
||||
===============
|
||||
In most cases, you should use this API:
|
||||
|
||||
PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
|
||||
PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
|
||||
int options, char **opened_path TSRMLS_DC);
|
||||
|
||||
Where:
|
||||
|
||||
+14
-25
@@ -5,7 +5,7 @@ This document describes how to submit an enhancement or patch for PHP.
|
||||
It's easy!
|
||||
|
||||
You don't need any login accounts or special access to download,
|
||||
build, debug and begin submitting PHP or PECL code, tests or
|
||||
build, debug and begin submitting PHP, PECL or PEAR code, tests or
|
||||
documentation. Once you've followed this README and had several
|
||||
patches accepted, commit privileges are often quickly granted.
|
||||
|
||||
@@ -16,8 +16,8 @@ http://phpadvent.org/2008/less-whining-more-coding-by-elizabeth-smith
|
||||
Online Forums
|
||||
-------------
|
||||
There are several IRC channels where PHP developers are often
|
||||
available to discuss questions. They include #php.pecl and #php.doc
|
||||
on the EFNet network and #php-dev-win on FreeNode.
|
||||
available to discuss questions. They include #php.pecl, #php.doc and
|
||||
#pear on the EFNet network and #php-dev-win on FreeNode.
|
||||
|
||||
|
||||
PHP Patches
|
||||
@@ -50,17 +50,6 @@ Please make the mail subject prefix "[PATCH]". If attaching a patch,
|
||||
ensure it has a file extension of ".txt". This is because only MIME
|
||||
attachments of type 'text/*' are accepted.
|
||||
|
||||
The preferred way to propose PHP patch is sending pull request from
|
||||
github.
|
||||
|
||||
https://github.com/php/php-src
|
||||
|
||||
Fork the official PHP repository and send a pull request. A
|
||||
notification will be sent to the pull request mailing list. Sending a
|
||||
note to PHP Internals list (internals@lists.php.net) may help getting
|
||||
more feedback and quicker turnaround. You can also add pull requests
|
||||
to bug reports at http://bugs.php.net/.
|
||||
|
||||
|
||||
PHP Documentation Patches
|
||||
-------------------------
|
||||
@@ -89,7 +78,7 @@ of type 'text/*' are accepted.
|
||||
PECL Extension Patches: http://pecl.php.net/
|
||||
--------------------------------------------
|
||||
If you are fixing broken functionality in a PECL extension then create
|
||||
a bug or identify an existing bug at http://bugs.php.net/. A bug
|
||||
a bug or identify an existing bug at http://pecl.php.net/bugs/. A bug
|
||||
can be used to track the patch progress and prevent your changes
|
||||
getting lost in the PHP mail archives.
|
||||
|
||||
@@ -125,15 +114,15 @@ http://pear.php.net/manual/en/guide-developers.php
|
||||
|
||||
How to create your PHP, PHP Documentation or PECL patch
|
||||
-------------------------------------------------------
|
||||
PHP and most PECL packages use Git for revision control. Some PECL
|
||||
packages use Subversion (SVN) Read http://www.php.net/git.php for help
|
||||
on using Git to get and build PHP source code. We recommend to look
|
||||
at our workflow on https://wiki.php.net/vcs/gitworkflow and our FAQ
|
||||
https://wiki.php.net/vcs/gitfaq.
|
||||
PHP and PECL use Subversion (SVN) for revision control. Read
|
||||
http://www.php.net/svn.php for help on using SVN to get and build PHP
|
||||
source code. We recommend using a Sparse Directory checkout described
|
||||
in http://wiki.php.net/vcs/svnfaq. If you are new to SVN, read
|
||||
http://svnbook.red-bean.com.
|
||||
|
||||
Generally we ask that bug fix patches work on the current stable PHP
|
||||
development branches and on "master". New PHP features only need to
|
||||
work on "master".
|
||||
development branches and on "trunk". New PHP features only need to
|
||||
work on "trunk".
|
||||
|
||||
Read CODING_STANDARDS before you start working.
|
||||
|
||||
@@ -145,7 +134,7 @@ comprehensive.
|
||||
|
||||
After testing is finished, create a patch file using the command:
|
||||
|
||||
git diff > your_patch.txt
|
||||
svn diff > your_patch.txt
|
||||
|
||||
For ease of review and later troubleshooting, submit individual
|
||||
patches for each bug or feature.
|
||||
@@ -153,7 +142,7 @@ patches for each bug or feature.
|
||||
|
||||
Checklist for submitting your PHP or PECL code patch
|
||||
----------------------------------------------------
|
||||
- Update git source just before running your final 'diff' and
|
||||
- Update SVN source just before running your final 'diff' and
|
||||
before testing.
|
||||
- Add in-line comments and/or have external documentation ready.
|
||||
Use only "/* */" style comments, not "//".
|
||||
@@ -186,7 +175,7 @@ about these questions:
|
||||
|
||||
What happens when your PHP or PECL patch is applied
|
||||
---------------------------------------------------
|
||||
Your name will likely be included in the Git commit log. If your
|
||||
Your name will likely be included in the SVN commit log. If your
|
||||
patch affects end users, a brief description and your name might be
|
||||
added to the NEWS file.
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
------------------
|
||||
Failed tests usually indicate a problem with your local system setup
|
||||
and not within PHP itself (at least for official PHP release versions).
|
||||
You may decide to automatically submit a test summary to our QA workflow
|
||||
You may decide to automaticaly submit a test summary to our QA workflow
|
||||
at the end of a test run.
|
||||
Please do *not* submit a failed test as a bug or ask for help on why
|
||||
it failed on your system without providing substantial backup information
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
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)
|
||||
|
||||
Pull Requests
|
||||
=============
|
||||
PHP accepts pull requests via github. Discussions are done on github, but
|
||||
depending on the topic can also be relayed to the official PHP developer
|
||||
mailinglist internals@lists.php.net.
|
||||
|
||||
New features require an RFC and must be accepted by the developers.
|
||||
See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more
|
||||
information on the process.
|
||||
|
||||
Bug fixes **do not** require an RFC, but require a bugtracker ticket. Always
|
||||
open a ticket at https://bugs.php.net and reference the bug id using #NNNNNN.
|
||||
|
||||
Fix #55371: get_magic_quotes_gpc() throws deprecation warning
|
||||
|
||||
After removing magic quotes, the get_magic_quotes_gpc function caused
|
||||
a deprecate warning. get_magic_quotes_gpc can be used to detected
|
||||
the magic_quotes behavior and therefore should not raise a warning at any
|
||||
time. The patch removes this warning
|
||||
|
||||
We do not merge pull requests directly on github. All PRs will be
|
||||
pulled and pushed through http://git.php.net.
|
||||
|
||||
|
||||
Guidelines for contributors
|
||||
===========================
|
||||
- [CODING_STANDARDS](/CODING_STANDARDS)
|
||||
- [README.GIT-RULES](/README.GIT-RULES)
|
||||
- [README.MAILINGLIST_RULES](/README.MAILINGLIST_RULES)
|
||||
- [README.RELEASE_PROCESS](/README.RELEASE_PROCESS)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
## process this file with automake to produce Makefile.am
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
noinst_LTLIBRARIES=libtsrm.la
|
||||
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c
|
||||
libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
|
||||
|
||||
depend:
|
||||
@@ -143,6 +143,10 @@ SOURCE=.\tsrm_strtok_r.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -171,6 +175,10 @@ SOURCE=.\tsrm_strtok_r.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tsrm_win32.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// vim:ft=javascript
|
||||
// $Id$
|
||||
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define TSRM_CONFIG_W32_H
|
||||
|
||||
#include <../main/config.w32.h>
|
||||
#include "Zend/zend_config.w32.h"
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
@@ -12,4 +11,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
|
||||
#undef inline
|
||||
#ifdef ZEND_WIN32_FORCE_INLINE
|
||||
# define inline __forceinline
|
||||
#else
|
||||
# define inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 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 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -30,8 +30,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_virtual_cwd.h"
|
||||
#include "tsrm_virtual_cwd.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
@@ -127,6 +126,7 @@ static int php_check_dots(const char *element, int n)
|
||||
#define TOKENIZER_STRING "/"
|
||||
#endif
|
||||
|
||||
|
||||
/* default macros */
|
||||
|
||||
#ifndef IS_DIRECTORY_UP
|
||||
@@ -149,21 +149,11 @@ static int php_check_dots(const char *element, int n)
|
||||
|
||||
#define CWD_STATE_COPY(d, s) \
|
||||
(d)->cwd_length = (s)->cwd_length; \
|
||||
(d)->cwd = (char *) emalloc((s)->cwd_length+1); \
|
||||
(d)->cwd = (char *) malloc((s)->cwd_length+1); \
|
||||
memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
|
||||
|
||||
#define CWD_STATE_FREE(s) \
|
||||
efree((s)->cwd);
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# define CWD_STATE_FREE_ERR(state) do { \
|
||||
DWORD last_error = GetLastError(); \
|
||||
CWD_STATE_FREE(state); \
|
||||
SetLastError(last_error); \
|
||||
} while (0)
|
||||
#else
|
||||
# define CWD_STATE_FREE_ERR(state) CWD_STATE_FREE(state)
|
||||
#endif
|
||||
free((s)->cwd);
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
|
||||
@@ -296,7 +286,6 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
__int64 t;
|
||||
const size_t path_len = strlen(path);
|
||||
ALLOCA_FLAG(use_heap_large);
|
||||
|
||||
if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) {
|
||||
return stat(path, buf);
|
||||
@@ -348,15 +337,16 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
HANDLE hLink = NULL;
|
||||
REPARSE_DATA_BUFFER * pbuffer;
|
||||
unsigned int retlength = 0;
|
||||
TSRM_ALLOCA_FLAG(use_heap_large);
|
||||
|
||||
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if(hLink == INVALID_HANDLE_VALUE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
CloseHandle(hLink);
|
||||
return -1;
|
||||
}
|
||||
@@ -373,7 +363,7 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
buf->st_mode |=;
|
||||
}
|
||||
#endif
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
} else {
|
||||
buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
|
||||
buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
|
||||
@@ -439,6 +429,7 @@ static void cwd_globals_ctor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */
|
||||
|
||||
static void cwd_globals_dtor(virtual_cwd_globals *cwd_g TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
CWD_STATE_FREE(&cwd_g->cwd);
|
||||
realpath_cache_clean(TSRMLS_C);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -499,25 +490,6 @@ CWD_API void virtual_cwd_shutdown(void) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int virtual_cwd_activate(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
if (CWDG(cwd).cwd == NULL) {
|
||||
CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int virtual_cwd_deactivate(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
if (CWDG(cwd).cwd != NULL) {
|
||||
CWD_STATE_FREE(&CWDG(cwd));
|
||||
CWDG(cwd).cwd = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state *state;
|
||||
@@ -528,7 +500,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
char *retval;
|
||||
|
||||
*length = 1;
|
||||
retval = (char *) emalloc(2);
|
||||
retval = (char *) malloc(2);
|
||||
if (retval == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -543,7 +515,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
char *retval;
|
||||
|
||||
*length = state->cwd_length+1;
|
||||
retval = (char *) emalloc(*length+1);
|
||||
retval = (char *) malloc(*length+1);
|
||||
if (retval == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -555,7 +527,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
#endif
|
||||
*length = state->cwd_length;
|
||||
return estrdup(state->cwd);
|
||||
return strdup(state->cwd);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -571,12 +543,12 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */
|
||||
return cwd;
|
||||
}
|
||||
if (length > size-1) {
|
||||
efree(cwd);
|
||||
free(cwd);
|
||||
errno = ERANGE; /* Is this OK? */
|
||||
return NULL;
|
||||
}
|
||||
memcpy(buf, cwd, length+1);
|
||||
efree(cwd);
|
||||
free(cwd);
|
||||
return buf;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -782,13 +754,13 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
#ifdef TSRM_WIN32
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE hFind;
|
||||
ALLOCA_FLAG(use_heap_large)
|
||||
TSRM_ALLOCA_FLAG(use_heap_large)
|
||||
#else
|
||||
struct stat st;
|
||||
#endif
|
||||
realpath_cache_bucket *bucket;
|
||||
char *tmp;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
TSRM_ALLOCA_FLAG(use_heap)
|
||||
|
||||
while (1) {
|
||||
if (len <= start) {
|
||||
@@ -888,7 +860,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
tmp = do_alloca(len+1, use_heap);
|
||||
tmp = tsrm_do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
if(save &&
|
||||
@@ -915,12 +887,12 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
return -1;
|
||||
}
|
||||
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
if (pbuffer == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
CloseHandle(hLink);
|
||||
return -1;
|
||||
}
|
||||
@@ -936,7 +908,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
printname_len + 1,
|
||||
printname, MAX_PATH, NULL, NULL
|
||||
)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
return -1;
|
||||
};
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
@@ -948,7 +920,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
substitutename_len + 1,
|
||||
substitutename, MAX_PATH, NULL, NULL
|
||||
)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
return -1;
|
||||
};
|
||||
substitutename[substitutename_len] = 0;
|
||||
@@ -962,7 +934,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
printname_len + 1,
|
||||
printname, MAX_PATH, NULL, NULL
|
||||
)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
return -1;
|
||||
};
|
||||
printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0;
|
||||
@@ -973,7 +945,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
substitutename_len + 1,
|
||||
substitutename, MAX_PATH, NULL, NULL
|
||||
)) {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
return -1;
|
||||
};
|
||||
substitutename[substitutename_len] = 0;
|
||||
@@ -983,7 +955,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
memcpy(substitutename, path, len + 1);
|
||||
substitutename_len = len;
|
||||
} else {
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1027,21 +999,21 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
fprintf(stderr, "sub: %s ", substitutename);
|
||||
fprintf(stderr, "resolved: %s ", path);
|
||||
#endif
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
|
||||
if(isabsolute == 1) {
|
||||
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
|
||||
/* use_realpath is 0 in the call below coz path is absolute*/
|
||||
j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC);
|
||||
if(j < 0) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(i + j >= MAXPATHLEN - 1) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1050,7 +1022,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
path[i-1] = DEFAULT_SLASH;
|
||||
j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
|
||||
if(j < 0) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1071,7 +1043,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
|
||||
#elif defined(NETWARE)
|
||||
save = 0;
|
||||
tmp = do_alloca(len+1, use_heap);
|
||||
tmp = tsrm_do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
#else
|
||||
if (save && php_sys_lstat(path, &st) < 0) {
|
||||
@@ -1083,25 +1055,25 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
save = 0;
|
||||
}
|
||||
|
||||
tmp = do_alloca(len+1, use_heap);
|
||||
tmp = tsrm_do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
if (save && S_ISLNK(st.st_mode)) {
|
||||
if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) {
|
||||
/* too many links or broken symlinks */
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
path[j] = 0;
|
||||
if (IS_ABSOLUTE_PATH(path, j)) {
|
||||
j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
|
||||
if (j < 0) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (i + j >= MAXPATHLEN-1) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1; /* buffer overflow */
|
||||
}
|
||||
memmove(path+i, path, j+1);
|
||||
@@ -1109,7 +1081,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
path[i-1] = DEFAULT_SLASH;
|
||||
j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
|
||||
if (j < 0) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1124,7 +1096,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
if (is_dir && !directory) {
|
||||
/* not a directory */
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1140,7 +1112,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
#ifdef TSRM_WIN32
|
||||
if (j < 0 || j + len - i >= MAXPATHLEN-1) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
if (save) {
|
||||
@@ -1155,7 +1127,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
#else
|
||||
if (j < 0 || j + len - i >= MAXPATHLEN-1) {
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
memcpy(path+j, tmp+i, len-i+1);
|
||||
@@ -1168,7 +1140,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC);
|
||||
}
|
||||
|
||||
free_alloca(tmp, use_heap);
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@@ -1344,7 +1316,7 @@ verify:
|
||||
CWD_STATE_COPY(&old_state, state);
|
||||
state->cwd_length = path_length;
|
||||
|
||||
tmp = erealloc(state->cwd, state->cwd_length+1);
|
||||
tmp = realloc(state->cwd, state->cwd_length+1);
|
||||
if (tmp == NULL) {
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
@@ -1364,7 +1336,7 @@ verify:
|
||||
}
|
||||
} else {
|
||||
state->cwd_length = path_length;
|
||||
tmp = erealloc(state->cwd, state->cwd_length+1);
|
||||
tmp = realloc(state->cwd, state->cwd_length+1);
|
||||
if (tmp == NULL) {
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
@@ -1395,7 +1367,7 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
|
||||
int length = strlen(path);
|
||||
char *temp;
|
||||
int retval;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
TSRM_ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (length == 0) {
|
||||
return 1; /* Can't cd to empty string */
|
||||
@@ -1412,14 +1384,14 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
|
||||
if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
|
||||
length++;
|
||||
}
|
||||
temp = (char *) do_alloca(length+1, use_heap);
|
||||
temp = (char *) tsrm_do_alloca(length+1, use_heap);
|
||||
memcpy(temp, path, length);
|
||||
temp[length] = 0;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "Changing directory to %s\n", temp);
|
||||
#endif
|
||||
retval = p_chdir(temp TSRMLS_CC);
|
||||
free_alloca(temp, use_heap);
|
||||
tsrm_free_alloca(temp, use_heap);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1432,7 +1404,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
|
||||
|
||||
/* realpath("") returns CWD */
|
||||
if (!*path) {
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
retval = NULL;
|
||||
goto end;
|
||||
@@ -1445,7 +1417,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
|
||||
} else if (!IS_ABSOLUTE_PATH(path, strlen(path))) {
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
} else {
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
retval = NULL;
|
||||
goto end;
|
||||
@@ -1502,14 +1474,13 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f = fopen(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1521,7 +1492,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1531,7 +1502,7 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
|
||||
ret = access(new_state.cwd, mode);
|
||||
#endif
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1594,7 +1565,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1604,7 +1575,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /
|
||||
ret = utime(new_state.cwd, buf);
|
||||
#endif
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1617,13 +1588,13 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = chmod(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1636,7 +1607,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1650,7 +1621,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
|
||||
ret = chown(new_state.cwd, owner, group);
|
||||
}
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1663,7 +1634,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1679,7 +1650,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
|
||||
} else {
|
||||
f = open(new_state.cwd, flags);
|
||||
}
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1691,18 +1662,18 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
f = creat(new_state.cwd, mode);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /* {{{ */
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state old_state;
|
||||
cwd_state new_state;
|
||||
@@ -1710,15 +1681,15 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /
|
||||
|
||||
CWD_STATE_COPY(&old_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&old_state);
|
||||
CWD_STATE_FREE(&old_state);
|
||||
return -1;
|
||||
}
|
||||
oldname = old_state.cwd;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, newname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&old_state);
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
newname = new_state.cwd;
|
||||
@@ -1732,8 +1703,8 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /
|
||||
retval = rename(oldname, newname);
|
||||
#endif
|
||||
|
||||
CWD_STATE_FREE_ERR(&old_state);
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -1746,13 +1717,13 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = php_sys_stat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1764,13 +1735,13 @@ CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ *
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = php_sys_lstat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1782,13 +1753,13 @@ CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = unlink(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1800,7 +1771,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1809,7 +1780,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
#else
|
||||
retval = mkdir(new_state.cwd, mode);
|
||||
#endif
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1821,13 +1792,13 @@ CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = rmdir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1843,13 +1814,13 @@ CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) /* {{{ */
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
retval = opendir(new_state.cwd);
|
||||
|
||||
CWD_STATE_FREE_ERR(&new_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1911,7 +1882,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
|
||||
dir_length = CWDG(cwd).cwd_length;
|
||||
dir = CWDG(cwd).cwd;
|
||||
|
||||
ptr = command_line = (char *) emalloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1);
|
||||
ptr = command_line = (char *) malloc(command_length + sizeof("cd '' ; ") + dir_length + extra+1+1);
|
||||
if (!command_line) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1945,7 +1916,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
|
||||
memcpy(ptr, command, command_length+1);
|
||||
retval = popen(command_line, type);
|
||||
|
||||
efree(command_line);
|
||||
free(command_line);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1958,7 +1929,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
|
||||
|
||||
/* realpath("") returns CWD */
|
||||
if (!*path) {
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1969,10 +1940,10 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
|
||||
}
|
||||
} else if (!IS_ABSOLUTE_PATH(path, strlen(path)) &&
|
||||
VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
new_state.cwd = estrdup(cwd);
|
||||
new_state.cwd = strdup(cwd);
|
||||
new_state.cwd_length = strlen(cwd);
|
||||
} else {
|
||||
new_state.cwd = (char*)emalloc(1);
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1981,7 +1952,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
|
||||
}
|
||||
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
efree(new_state.cwd);
|
||||
free(new_state.cwd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1989,7 +1960,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
|
||||
int copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length;
|
||||
memcpy(real_path, new_state.cwd, copy_len);
|
||||
real_path[copy_len] = '\0';
|
||||
efree(new_state.cwd);
|
||||
free(new_state.cwd);
|
||||
return real_path;
|
||||
} else {
|
||||
return new_state.cwd;
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -151,8 +151,6 @@ typedef int (*verify_path_func)(const cwd_state *);
|
||||
|
||||
CWD_API void virtual_cwd_startup(void);
|
||||
CWD_API void virtual_cwd_shutdown(void);
|
||||
CWD_API int virtual_cwd_activate(TSRMLS_D);
|
||||
CWD_API int virtual_cwd_deactivate(TSRMLS_D);
|
||||
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
|
||||
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
|
||||
@@ -163,7 +161,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifdef TSRM_WIN32
|
||||
#include <Sddl.h>
|
||||
#include "tsrm_win32.h"
|
||||
#include "zend_virtual_cwd.h"
|
||||
#include "tsrm_virtual_cwd.h"
|
||||
|
||||
#ifdef ZTS
|
||||
static ts_rsrc_id win32_globals_id;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
| Copyright (c) 1997-2013 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,184 +1,820 @@
|
||||
$Id$
|
||||
|
||||
PHP X.Y UPGRADE NOTES
|
||||
PHP 5.4 UPGRADE NOTES
|
||||
|
||||
1. Backward Incompatible Changes
|
||||
2. New Features
|
||||
2. Changes in SAPI modules
|
||||
3. Deprecated Functionality
|
||||
4. Changed Functions
|
||||
5. New Functions
|
||||
6. New Classes and Interfaces
|
||||
7. Removed Extensions
|
||||
8. Other Changes to Extensions
|
||||
9. New Global Constants
|
||||
10. Changes to INI File Handling
|
||||
11. Other Changes
|
||||
===========
|
||||
0. Contents
|
||||
===========
|
||||
|
||||
1. Changes to INI directives
|
||||
2. Changes to reserved words and classes
|
||||
3. Changes to engine behavior
|
||||
4. Changes to existing functions
|
||||
5. Changes to existing classes
|
||||
6. Changes to existing methods
|
||||
7. Deprecated Functionality
|
||||
8. Removed Functionality
|
||||
a. Removed features
|
||||
b. Removed functions
|
||||
c. Removed syntax
|
||||
d. Removed hash algorithms
|
||||
9. Extension Changes:
|
||||
a. Extensions no longer maintained
|
||||
b. Extensions with changed behavior
|
||||
10. Changes in SAPI support
|
||||
11. Windows support
|
||||
12. New in PHP 5.4:
|
||||
a. New features
|
||||
b. Syntax additions
|
||||
c. New functions
|
||||
d. New global constants
|
||||
e. New classes
|
||||
f. New methods
|
||||
g. New hash algorithms
|
||||
|
||||
=============================
|
||||
1. Changes to INI directives
|
||||
=============================
|
||||
|
||||
- PHP 5.4 now checks at compile time if /dev/urandom or /dev/arandom
|
||||
are present. If either is available, session.entropy_file now
|
||||
defaults to that file and session.entropy_length defaults to 32.
|
||||
This provides non-blocking entropy to session id generation. If you
|
||||
do not want extra entropy for your session ids, add:
|
||||
|
||||
session.entropy_file=
|
||||
session.entropy_length=0
|
||||
|
||||
to your php.ini to preserve pre-PHP 5.4 behavior.
|
||||
|
||||
- Deprecated php.ini directives will now throw an E_CORE_WARNING's
|
||||
instead of the previous E_WARNING's.
|
||||
|
||||
- The following php.ini directives are no longer available in PHP 5.4
|
||||
and will now throw an E_CORE_ERROR upon startup:
|
||||
- allow_call_time_pass_reference
|
||||
- define_syslog_variables
|
||||
- highlight.bg
|
||||
- magic_quotes_gpc
|
||||
- magic_quotes_runtime
|
||||
- magic_quotes_sybase
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- safe_mode
|
||||
- safe_mode_gid
|
||||
- safe_mode_include_dir
|
||||
- safe_mode_exec_dir
|
||||
- safe_mode_allowed_env_vars
|
||||
- safe_mode_protected_env_vars
|
||||
- session.bug_compat_42
|
||||
- session.bug_compat_warn
|
||||
- y2k_compliance
|
||||
- zend.ze1_compatibility_mode
|
||||
|
||||
- the following new php.ini directives were added:
|
||||
- max_input_vars - specifies how many GET/POST/COOKIE input
|
||||
variables may be accepted. The default value is 1000.
|
||||
|
||||
- E_ALL now includes E_STRICT.
|
||||
|
||||
- The recommended production value for error_reporting changed to E_ALL &
|
||||
~E_DEPRECATED & ~E_STRICT.
|
||||
|
||||
- Added new session support directives:
|
||||
session.upload_progress.enabled
|
||||
session.upload_progress.cleanup
|
||||
session.upload_progress.prefix
|
||||
session.upload_progress.name
|
||||
session.upload_progress.freq
|
||||
session.upload_progress.min_freq
|
||||
|
||||
- Added a zend.multibyte directive as a replacement of the PHP compile time
|
||||
configuration option --enable-zend-multibyte. Now the Zend Engine always
|
||||
contains code for multibyte support, which can be enabled or disabled at
|
||||
runtime. Note: It doesn't make a lot of sense to enable this option if
|
||||
ext/mbstring is not enabled, because most functionality is implemented by
|
||||
mbstrings callbacks.
|
||||
|
||||
- Added zend.script_encoding. This value will be used unless a
|
||||
"declare(encoding=...)" directive appears at the top of the script.
|
||||
|
||||
- Added zend.signal_check to check for replaced signal handlers on shutdown
|
||||
|
||||
- Added enable_post_data_reading, which is enabled by default. When it's
|
||||
disabled, the POST data is not read (or processed); the behavior is similar
|
||||
to that of other request methods with body, like PUT. This allows reading
|
||||
the raw POST data in multipart requests and reading/processing the POST data
|
||||
in a stream fashion (through php://input) without having it copied in memory
|
||||
multiple times.
|
||||
|
||||
- Added windows_show_crt_warning. This directive shows the CRT warnings when
|
||||
enabled. These warnings were displayed by default until now. It is disabled
|
||||
by default.
|
||||
|
||||
- Added cli.pager to set a pager for CLI interactive shell output.
|
||||
|
||||
- Added cli.prompt to configure the CLI interactive shell prompt.
|
||||
|
||||
- Added cli_server.color to enable the CLI web server to use ANSI color coding
|
||||
in terminal output.
|
||||
|
||||
========================================
|
||||
1. Backward Incompatible Changes
|
||||
2. Changes to reserved words and classes
|
||||
========================================
|
||||
|
||||
- JSON:
|
||||
json_decode() no longer accepts non-lowercase variants of lone JSON true,
|
||||
false or null values. For example, True or FALSE will now cause json_decode to
|
||||
return NULL and set an error value you can fetch with json_last_error().
|
||||
This affects JSON texts consisting solely of true, false or null. Text
|
||||
containing non-lowercase values inside JSON arrays or objects has never been
|
||||
accepted.
|
||||
- "callable", "insteadof" and "trait" are now reserved words.
|
||||
|
||||
- openssl:
|
||||
To prevent Man-in-the-Middle attacks against encrypted transfers client
|
||||
streams now verify peer certificates by default. Previous versions
|
||||
required users to manually enable peer verification. As a result of this
|
||||
change, existing code using ssl:// or tls:// stream wrappers (e.g.
|
||||
file_get_contents(), fsockopen(), stream_socket_client()) may no longer
|
||||
connect successfully without manually disabling peer verification via the
|
||||
stream context's "verify_peer" setting. Encrypted transfers delegate to
|
||||
operating system certificate stores by default, so many/most users *should*
|
||||
be unaffected by this transparent security enhancement.
|
||||
=============================
|
||||
3. Changes to engine behavior
|
||||
=============================
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
- The __construct arguments of an extended abstract constructor must
|
||||
now match:
|
||||
|
||||
- Added constant scalar expressions syntax.
|
||||
(https://wiki.php.net/rfc/const_scalar_exprs)
|
||||
abstract class Base
|
||||
{
|
||||
abstract public function __construct();
|
||||
}
|
||||
class Foo extends Base
|
||||
{
|
||||
public function __construct($bar) {}
|
||||
}
|
||||
|
||||
- Added dedicated syntax for variadic functions.
|
||||
(https://wiki.php.net/rfc/variadics)
|
||||
This now emits a Fatal error due the incompatible declaration.
|
||||
|
||||
- Added support for argument unpacking to complement the variadic syntax.
|
||||
(https://wiki.php.net/rfc/argument_unpacking)
|
||||
- In previous versions, superglobal names could be used for parameter
|
||||
names, thereby shadowing the corresponding superglobal. In PHP 5.4
|
||||
this now causes a fatal error such as "Cannot re-assign auto-global
|
||||
variable GLOBALS".
|
||||
|
||||
- Added T_POW (**) operator.
|
||||
(https://wiki.php.net/rfc/pow-operator)
|
||||
- Turning null, false or an empty string into an object by adding a
|
||||
property will now emit a warning instead of an E_STRICT error.
|
||||
|
||||
- The php://input stream is now re-usable and can be used concurrently with
|
||||
enable_post_data_reading=0.
|
||||
$test = null;
|
||||
$test->baz = 1;
|
||||
|
||||
- Added gost-crypto (CryptoPro S-box) hash algo.
|
||||
To create a generic object you can use StdClass:
|
||||
|
||||
- Added openssl certificate fingerprint support (inclusive stream context
|
||||
option).
|
||||
$test = new StdClass;
|
||||
$test->baz = 1;
|
||||
|
||||
- Added openssl crypto method stream context option.
|
||||
- Converting an array to a string now will cause an E_NOTICE warning.
|
||||
|
||||
- Added openssl peer verification support for SAN x509 extension
|
||||
- Non-numeric string offsets, e.g. $a['foo'] where $a is a string, now
|
||||
return false on isset() and true on empty(), and produce warning if
|
||||
trying to use them. Offsets of types double, bool and null produce
|
||||
notice. Numeric strings ($a['2']) still work as before.
|
||||
|
||||
- Added use function and use const.
|
||||
(https://wiki.php.net/rfc/use_function)
|
||||
Note that offsets like '12.3' and '5 and a half' are considered
|
||||
non-numeric and produce warning, but are converted to 12 and 5
|
||||
respectively for backwards compatibility reasons.
|
||||
|
||||
========================================
|
||||
2. Changes in SAPI modules
|
||||
========================================
|
||||
- Long numeric strings that do not fit in integer or double (such as
|
||||
"92233720368547758070") are compared using string comparison if
|
||||
they could otherwise result in precision loss - since 5.4.4.
|
||||
|
||||
- Added phpdbg sapi.
|
||||
(https://wiki.php.net/rfc/phpdbg)
|
||||
- Closures now support scopes and $this and can be rebound to
|
||||
objects using Closure::bind() and Closure::bindTo().
|
||||
|
||||
========================================
|
||||
3. Deprecated Functionality
|
||||
========================================
|
||||
- <?= is now always available regardless of the short_open_tag
|
||||
setting.
|
||||
|
||||
- Incompatible context calls:
|
||||
Instance calls from an incompatible context are now deprecated and issue
|
||||
E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx
|
||||
- Parse error messages are changed to contain more information about
|
||||
the error.
|
||||
|
||||
========================================
|
||||
4. Changed Functions
|
||||
========================================
|
||||
- __clone and __destruct since 5.4.4 follow the same scoping rules as
|
||||
the rest of the methods (see bug #61782 for details).
|
||||
|
||||
- cURL:
|
||||
CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file
|
||||
do not work unless it is explicitly set to false.
|
||||
================================
|
||||
4. Changes to existing functions
|
||||
================================
|
||||
|
||||
- Crypt:
|
||||
crypt() will now raise an E_NOTICE error if the salt parameter is omitted.
|
||||
See: https://wiki.php.net/rfc/crypt_function_salt
|
||||
- array_combine now returns array() instead of FALSE when two empty arrays are
|
||||
provided as parameters.
|
||||
|
||||
- XMLReader:
|
||||
XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
|
||||
the attribute could not be found, just like XMLReader::getAttribute.
|
||||
- dns_get_record() has an extra parameter which allows requesting DNS records
|
||||
by numeric type and makes the result include only the raw data of the
|
||||
response.
|
||||
|
||||
========================================
|
||||
5. New Functions
|
||||
========================================
|
||||
- call_user_func_array() no longer allows call-time pass by reference.
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
- the default character set for htmlspecialchars() and htmlentities() is
|
||||
now UTF-8. In previous versions it was ISO-8859-1. Note that changing
|
||||
your output charset via the php.ini default_charset directive does not
|
||||
affect htmlspecialchars/htmlentities unless you are passing "" (an
|
||||
empty string) as the encoding parameter to your htmlspecialchars/htmlentities
|
||||
calls.
|
||||
|
||||
- Openssl:
|
||||
Added string openssl_x509_fingerprint($x509, $type, $binary).
|
||||
Added string openssl_spki_new($private_key, $challenge, $algorithm)
|
||||
Added bool openssl_spki_verify($spkac)
|
||||
Added string openssl_spki_export($spkac)
|
||||
Added string openssl_spki_export_challenge($spkac)
|
||||
- htmlentities() and htmlspecialchars() are stricter in the code units they
|
||||
accept for the asian encodings. For Big5-HKSCS, the octets 0x80 and 0xFF are
|
||||
rejected. For GB2312/EUC-CN, the octets 0x8E, 0x8F, 0xA0 and 0xFF are
|
||||
rejected. For SJIS, the octets 0x80, 0xA0, 0xFD, 0xFE and 0xFF are rejected,
|
||||
except maybe after a valid starting byte. For EUC-JP, the octets 0xA0 and
|
||||
0xFF are rejected.
|
||||
|
||||
- LDAP:
|
||||
Added ldap_escape($value, $ignore = "", $flags = 0).
|
||||
- htmlentities() now emits an E_STRICT warning when used with asian characters,
|
||||
as in that case htmlentities has (and already had before this version) the
|
||||
same functionality as htmlspecialchars.
|
||||
|
||||
- Zip:
|
||||
Added ZipArchive::setPassword($password)
|
||||
- htmlentities() no longer numerically encodes high characters for single-byte
|
||||
encodings (except when there's actually a corresponding named entity). This
|
||||
behavior was not documented and was inconsistent with that for "UTF-8".
|
||||
|
||||
========================================
|
||||
6. New Classes and Interfaces
|
||||
========================================
|
||||
- html_entity_decode() and htmlspecialchars_decode() behave more consistently,
|
||||
now decoding entities in malformed strings such as "&&" or "&#&".
|
||||
|
||||
- htmlentities(), htmlspecialchars(), html_entity_decode(), and
|
||||
htmlspecialchars_decode: Added the flags ENT_HTML401, ENT_XML1, ENT_XHTML,
|
||||
and ENT_HTML5. The behavior of these functions including, but not limited to,
|
||||
the characters that are encoded and the entities that are decoded depend on
|
||||
the document type that is specified by those flags.
|
||||
|
||||
- htmlentities() and htmlspecialchars() with !$double_encode do more strict
|
||||
checks on the validity of the entities. Numerical entities are checked for a
|
||||
valid range (0 to 0x10FFFF); if the flag ENT_DISALLOWED is given, the
|
||||
validity of such numerical entity in the target document type is also
|
||||
checked. Named entities are checked for necessary existence in the target
|
||||
document type instead of only checking whether they were constituted by
|
||||
alphanumeric characters.
|
||||
|
||||
- The flag ENT_DISALLOWED was added. In addition to the behavior described in
|
||||
the item before, it also makes htmlentities() and htmlspecialchars()
|
||||
substitute characters that appear literally in the argument string and which
|
||||
are not allowed in the target document type with U+FFFD (UTF-8) or �.
|
||||
|
||||
- The flag ENT_SUBSTITUTE was added. This flag makes invalid multibyte
|
||||
sequences be replaced by U+FFFD (UTF-8) or &#FFFD; by htmlspecialchars() and
|
||||
htmlentities(). It is an alternative to the default behavior, which just
|
||||
returns an empty string and to ENT_IGNORE, which is a security risk. The
|
||||
behavior follows the recommendations of Unicode Technical Report #36.
|
||||
|
||||
- htmlspecialchars_decode() and html_entity_decode() now decode ' if the
|
||||
document type is ENT_XML1, ENT_XHTML, or ENT_HTML5.
|
||||
|
||||
- Charset detection with $charset == '' no longer turns to mbstring's
|
||||
internal encoding defined through mb_internal_encoding(). Only the encoding
|
||||
defined through the php.ini setting mbstring.internal_encoding is considered.
|
||||
|
||||
- number_format() no longer truncates multibyte decimal points and thousand
|
||||
separators to the first byte.
|
||||
|
||||
- The third parameter ($matches) to preg_match_all() is now optional. If
|
||||
omitted, the function will simply return the number of times the pattern was
|
||||
matched in the subject and will have no other side effects.
|
||||
|
||||
- The second argument of scandir() now accepts SCANDIR_SORT_NONE (2) as a
|
||||
possible value. This value results in scandir() performing no sorting: on
|
||||
local filesystems, this allows files to be returned in native filesystem
|
||||
order.
|
||||
|
||||
- stream_select() now preserves the keys of the passed array, be they numeric or
|
||||
strings. This breaks code that iterated the resulting stream array using a
|
||||
numeric index, but makes easier to identify which of the passed streams are
|
||||
present in the result.
|
||||
|
||||
- stream_set_write_buffer() no longer disables the read buffer of a plain
|
||||
stream when 0 is given as the second argument.
|
||||
|
||||
- stream_set_write_buffer() no longer changes the chunk size in socket streams.
|
||||
|
||||
- fclose() closes streams with resource refcount > 1; it doesn't merely
|
||||
decrement the resource refcount.
|
||||
|
||||
- socket_set_options() and socket_get_options() now support multicast options.
|
||||
|
||||
- The raw data parameter in openssl_encrypt() and openssl_decrypt() is now an
|
||||
options integer rather than a boolean. A value of true produces the same
|
||||
behavior.
|
||||
|
||||
- Write operations within XSLT (for example with the extension sax:output) are
|
||||
disabled by default. You can define what is forbidden with the method
|
||||
XsltProcess::setSecurityPrefs($options).
|
||||
|
||||
- Added AES support to OpenSSL.
|
||||
|
||||
- openssl_csr_new() expects the textual data to be in UTF-8.
|
||||
|
||||
- Added no-padding option to openssl_encrypt() and openssl_decrypt().
|
||||
|
||||
- Added a "no_ticket" SSL context option to disable the SessionTicket TLS
|
||||
extension.
|
||||
|
||||
- Added new json_encode() options: JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES,
|
||||
JSON_NUMERIC_CHECK, JSON_BIGINT_AS_STRING, JSON_UNESCAPED_UNICODE.
|
||||
|
||||
- Added Tokyo Cabinet and Berkley DB 5 support to DBA extension.
|
||||
|
||||
- Added support for CURLOPT_MAX_SEND_SPEED_LARGE and CURLOPT_MAX_RECV_SPEED_LARGE
|
||||
to cURL.
|
||||
|
||||
- Added optional argument to debug_backtrace() and debug_print_backtrace()
|
||||
to limit the amount of stack frames returned.
|
||||
|
||||
- Fixed crypt_blowfish handling of 8-bit characters. crypt() in Blowfish mode
|
||||
now supports hashes marked $2a$, $2x$, $2y$ and $2z$.
|
||||
|
||||
- mbstring now supports following encodings: Shift_JIS/UTF-8 Emoji,
|
||||
JIS X0213:2004 (Shift_JIS-2004, EUC-JP-2004, ISO-2022-JP-2004),
|
||||
MacJapanese (Shift_JIS), gb18030.
|
||||
|
||||
- Added encode and decode in hex format to mb_encode_numericentity() and
|
||||
mb_decode_numericentity().
|
||||
|
||||
- Added support for SORT_NATURAL and SORT_FLAG_CASE in array sort functions:
|
||||
sort(), rsort(), ksort(), krsort(), asort(), arsort() and array_multisort().
|
||||
|
||||
- is_a() and is_subclass_of() now have third boolean parameter, which specifies
|
||||
if the first argument can be a string class name. Default if false for is_a
|
||||
and true for is_subclass_of() for BC reasons.
|
||||
|
||||
- ob_start() will now treat a chunk size of 1 as meaning 1 byte, rather than
|
||||
the previous special case behavior of treating it as 4096 bytes.
|
||||
|
||||
- idn_to_ascii() and idn_to_utf8() now take two extra parameters, one indicating
|
||||
the variant (IDNA 2003 or UTS #46) and another, passed by reference, to return
|
||||
details about the operation in case UTS #46 is chosen.
|
||||
|
||||
- gzencode() used with FORCE_DEFLATE now generates RFC1950 compliant data.
|
||||
|
||||
- ob_start() no longer starts multiple output buffers when passed
|
||||
array("callback1", "callback2", "callback3", ...).
|
||||
|
||||
- Since 5.4.4, "php://fd" stream syntax is available only in CLI build.
|
||||
|
||||
- Since 5.4.5, resourcebundle_create() accepts null for the first two arguments.
|
||||
|
||||
- Since 5.4.6, SimpleXMLElement::getDocNamespaces() has and extra parameter which
|
||||
allows for toggling if the list of namespaces starts from the document root
|
||||
or from the node you call the method on
|
||||
|
||||
- Since 5.4.7, ctor is always called when new user stream wrapper object is created.
|
||||
Before, it was called only when stream_open was called.
|
||||
|
||||
==============================
|
||||
5. Changes to existing classes
|
||||
==============================
|
||||
|
||||
- Classes that implement stream wrappers can define a method called
|
||||
stream_truncate that will respond to truncation, e.g. through ftruncate.
|
||||
Strictly speaking, this is an addition to the user-space stream wrapper
|
||||
template, not a change to an actual class.
|
||||
|
||||
- Classes that implement stream wrappers can define a method called
|
||||
stream_metadata that will be called on touch(), chmod(), chgrp(), chown().
|
||||
|
||||
- Arrays cast from SimpleXMLElement now always contain all nodes instead of
|
||||
just the first matching node.
|
||||
|
||||
- All SimpleXMLElement children are now always printed when using var_dump(),
|
||||
var_export(), and print_r().
|
||||
|
||||
- Added iterator support in MySQLi. mysqli_result implements Traversable.
|
||||
|
||||
==============================
|
||||
6. Changes to existing methods
|
||||
==============================
|
||||
|
||||
- DateTime::parseFromFormat() now has a "+" modifier to allow trailing text in
|
||||
the string to parse without throwing an error.
|
||||
|
||||
- Added the ability to pass options to DOMDocument::loadHTML().
|
||||
|
||||
- FilesystemIterator, GlobIterator and (Recursive)DirectoryIterator now use
|
||||
the default stream context.
|
||||
|
||||
- Since 5.4.5, the constructor of ResourceBundle accepts NULL for the first two
|
||||
arguments.
|
||||
|
||||
===========================
|
||||
7. Deprecated Functionality
|
||||
===========================
|
||||
|
||||
- The following functions are deprecated in PHP 5.4:
|
||||
- mcrypt_generic_end(): use mcrypt_generic_deinit() instead
|
||||
- mysql_list_dbs()
|
||||
|
||||
========================
|
||||
8. Removed Functionality
|
||||
========================
|
||||
|
||||
a. Removed features
|
||||
|
||||
The following features have been removed from PHP 5.4:
|
||||
|
||||
- Magic quotes
|
||||
- Register globals
|
||||
- Safe mode
|
||||
- Session extension bug compatibility mode
|
||||
- Y2K compliance mode
|
||||
|
||||
b. Removed functions
|
||||
|
||||
The following functions are no longer available in PHP 5.4:
|
||||
|
||||
- define_syslog_variables()
|
||||
- import_request_variables()
|
||||
- session_is_registered()
|
||||
- session_register()
|
||||
- session_unregister()
|
||||
- set_magic_quotes_runtime()
|
||||
- mysqli_bind_param() (alias of mysqli_stmt_bind_param())
|
||||
- mysqli_bind_result() (alias of mysqli_stmt_bind_result())
|
||||
- mysqli_client_encoding() (alias of mysqli_character_set_name())
|
||||
- mysqli_fetch() (alias of mysqli_stmt_fetch())
|
||||
- mysqli_param_count() (alias of mysqli_stmt_param_count())
|
||||
- mysqli_get_metadata() (alias of mysqli_stmt_result_metadata())
|
||||
- mysqli_send_long_data() (alias of mysqli_stmt_send_long_data())
|
||||
- mysqli::client_encoding() (alias of mysqli::character_set_name)
|
||||
- mysqli_stmt::stmt() (never worked/always throws, undocumented)
|
||||
|
||||
c. Removed syntax
|
||||
|
||||
- break $var;
|
||||
- continue $var;
|
||||
|
||||
d. Removed hash algorithms
|
||||
|
||||
- Salsa10 and Salsa20, which are actually stream ciphers
|
||||
|
||||
====================
|
||||
9. Extension Changes
|
||||
====================
|
||||
|
||||
a. Extensions no longer maintained
|
||||
|
||||
- ext/sqlite is no longer part of the base distribution and has been moved
|
||||
to PECL. Use sqlite3 or PDO_SQLITE instead.
|
||||
|
||||
b. Extensions with changed behavior
|
||||
|
||||
- The MySQL extensions (ext/mysql, mysqli and PDO_MYSQL) use mysqlnd
|
||||
as the default library now. It is still possible to use libmysql by
|
||||
specifying a path to the configure options.
|
||||
|
||||
- PDO_MYSQL: Support for linking with MySQL client libraries older
|
||||
than 4.1 is removed.
|
||||
|
||||
- The session extension now can hook into the file upload feature
|
||||
in order to provide upload progress information through session
|
||||
variables.
|
||||
|
||||
- SNMP extension
|
||||
- Functions in SNMP extension now returns FALSE on every error
|
||||
condition including SNMP-related (no such instance, end of MIB,
|
||||
etc). Thus, in patricular, breaks previous behavior of get/walk
|
||||
functions returning an empty string on SNMP-related errors.
|
||||
- Multi OID get/getnext/set queries are now supported.
|
||||
- New constants added for use in snmp_set_oid_output_format()
|
||||
function.
|
||||
- Function snmp_set_valueretrieval() changed it's behavior:
|
||||
SNMP_VALUE_OBJECT can be combined with one of
|
||||
SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY resulting OID value
|
||||
changes. When no SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY
|
||||
is supplied with SNMP_VALUE_OBJECT, SNMP_VALUE_LIBRARY is used.
|
||||
Prior to 5.4.0 when no SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY
|
||||
was supplied with SNMP_VALUE_OBJECT, SNMP_VALUE_PLAIN was used.
|
||||
- Added feature-rich OO API (SNMP class)
|
||||
- Dropped UCD-SNMP compatibility code. Consider upgrading to
|
||||
net-snmp v5.3+. Net-SNMP v5.4+ is required for Windows version.
|
||||
- In sake of adding support for IPv6 DNS name resolution of
|
||||
remote SNMP agent (peer) is done by extension now, not by Net-SNMP
|
||||
library anymore.
|
||||
|
||||
- Date extension
|
||||
- Setting the timezone with the TZ environment variable is no longer
|
||||
supported, instead date.timezone and/or date_default_timezone_set()
|
||||
have to be used.
|
||||
- The extension will no longer guess the default timezone if none
|
||||
is set with date.timezone and/or date_default_timezone_set().
|
||||
Instead it will always fall back to "UTC".
|
||||
|
||||
- Hash extension
|
||||
- the output of the tiger hash family has been corrected, see
|
||||
https://bugs.php.net/61307
|
||||
|
||||
===========================
|
||||
10. Changes in SAPI support
|
||||
===========================
|
||||
|
||||
- A REQUEST_TIME_FLOAT value returns a floating point number indicating the
|
||||
time with microsecond precision. All SAPIs providing this value should be
|
||||
returning float and not time_t.
|
||||
|
||||
- apache_child_terminate(), getallheaders(), apache_request_headers()
|
||||
and apache_response_headers() are now supported on FastCGI.
|
||||
|
||||
- The interactive shell allows a shortcut #inisetting=value to change php.ini
|
||||
settings at run-time.
|
||||
|
||||
- The interactive shell now works with the shared readline extension.
|
||||
|
||||
- The interactive shell no longer terminates on fatal errors.
|
||||
|
||||
- A new PHP CLI command line option --rz <name> shows information about the
|
||||
named Zend extension.
|
||||
|
||||
===================
|
||||
11. Windows support
|
||||
===================
|
||||
|
||||
- is_link now works properly for symbolic links on Windows Vista
|
||||
or later. Earlier systems do not support symbolic links.
|
||||
|
||||
- As of PHP 5.4.5 and above the COM extension isn't compiled statically in PHP
|
||||
anymore but shared. It'll still be delivered with the standard PHP release but
|
||||
must be activated manually with the "extension = php_com_dotnet.dll" directive
|
||||
in php.ini.
|
||||
|
||||
- Apache 2.4 handler is supported as of PHP 5.4.9
|
||||
|
||||
==================
|
||||
12. New in PHP 5.4
|
||||
==================
|
||||
|
||||
a. New Features
|
||||
|
||||
- A built-in CLI web server for testing purposes is now available:
|
||||
$ php -S 127.0.0.1:8888
|
||||
|
||||
- File Upload Progress support is implemented in the Session extension.
|
||||
|
||||
b. Syntax additions
|
||||
|
||||
- Traits:
|
||||
trait HelloWorld {
|
||||
public function sayHello() {
|
||||
echo 'Hello World!';
|
||||
}
|
||||
}
|
||||
|
||||
class CanIGetHello {
|
||||
use HelloWorld;
|
||||
}
|
||||
|
||||
$hello = new CanIGetHello();
|
||||
$hello->sayHello();
|
||||
|
||||
- Function call result array access, e.g.:
|
||||
foo()[0]
|
||||
$foo->bar()[0]
|
||||
|
||||
- Callable typehint indicating argument must be callable:
|
||||
function foo(callable $do) {
|
||||
}
|
||||
foo("strcmp");
|
||||
foo(function() {});
|
||||
$o = new ArrayObject();
|
||||
foo(array($o, "count"));
|
||||
|
||||
- Short array syntax:
|
||||
$a = [1, 2, 3, 4];
|
||||
$a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];
|
||||
$a = ['one' => 1, 2, 'three' => 3, 4];
|
||||
|
||||
- Binary number format:
|
||||
0b00100 0b010101
|
||||
|
||||
- Chained string array offsets now work.
|
||||
$a = "abc";
|
||||
echo $a[0][0];
|
||||
|
||||
- Anonymous functions now support using $this and class scope.
|
||||
Anonymous function can be declared as "static" to ignore the scope.
|
||||
|
||||
- Class::{expr}() syntax is now supported:
|
||||
class A {
|
||||
static function foo() {
|
||||
echo "Hello world!\n";
|
||||
}
|
||||
}
|
||||
$x = "f";
|
||||
$y = "o";
|
||||
A::{$x.$y.$y}();
|
||||
|
||||
- Class member access on instantiation:
|
||||
(new foo)->method()
|
||||
(new foo)->property
|
||||
(new foo)[0]
|
||||
|
||||
|
||||
========================================
|
||||
7. Removed Extensions
|
||||
========================================
|
||||
c. New functions
|
||||
|
||||
- Core:
|
||||
- get_declared_traits()
|
||||
- getimagesizefromstring()
|
||||
- hex2bin()
|
||||
- header_register_callback()
|
||||
- http_response_code()
|
||||
- stream_set_chunk_size()
|
||||
- socket_import_stream()
|
||||
- trait_exists()
|
||||
|
||||
========================================
|
||||
8. Other Changes to Extensions
|
||||
========================================
|
||||
- Intl:
|
||||
- transliterator_create()
|
||||
- transliterator_create_from_rules()
|
||||
- transliterator_create_inverse()
|
||||
- transliterator_get_error_code()
|
||||
- transliterator_get_error_message()
|
||||
- transliterator_list_ids()
|
||||
- transliterator_transliterate()
|
||||
|
||||
- GMP:
|
||||
The GMP extension now uses objects as the underlying data structure, rather
|
||||
than resources. GMP instances now support dumping, serialization, cloning,
|
||||
casts to primitive types and have overloaded operators.
|
||||
(RFC: https://wiki.php.net/rfc/operator_overloading_gmp)
|
||||
- LDAP:
|
||||
- ldap_control_paged_result()
|
||||
- ldap_control_paged_result_response()
|
||||
|
||||
- OCI8:
|
||||
- Added Implicit Result Set support for Oracle Database 12c with a
|
||||
new oci_get_implicit_resultset() function.
|
||||
- Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no longer
|
||||
unnecessarily initiates an internal ROLLBACK during connection
|
||||
close.
|
||||
- Added DTrace probes enabled with PHP's generic --enable-dtrace
|
||||
- The oci_internal_debug() function is now a no-op.
|
||||
- The phpinfo() output format for OCI8 has changed.
|
||||
- libxml:
|
||||
- libxml_set_external_entity_loader()
|
||||
|
||||
========================================
|
||||
9. New Global Constants
|
||||
========================================
|
||||
- mysqli:
|
||||
- mysqli_error_list()
|
||||
- mysqli_stmt_error_list()
|
||||
|
||||
- LDAP:
|
||||
LDAP_ESCAPE_FILTER int(1)
|
||||
LDAP_ESCAPE_DN int(2)
|
||||
- pgsql
|
||||
- pg_escape_identifier() (5.4.4)
|
||||
- pg_escape_literal() (5.4.4)
|
||||
|
||||
========================================
|
||||
10. Changes to INI File Handling
|
||||
========================================
|
||||
- Session:
|
||||
- session_register_shutdown()
|
||||
- session_status()
|
||||
|
||||
- Core:
|
||||
Changed always_populate_raw_post_data to throw a deprecation warning when
|
||||
enabled and to recognize ohe value -1 for never populating the global
|
||||
$HTTP_RAW_POST_DATA variable, which will be default in future PHP versions.
|
||||
- SPL
|
||||
- class_uses()
|
||||
|
||||
========================================
|
||||
11. Other Changes
|
||||
========================================
|
||||
- SplFixedArray
|
||||
- SplFixedArray::__wakeup() (5.4.18)
|
||||
|
||||
- File upload:
|
||||
Uploads equal or greater than 2GB in size are now accepted.
|
||||
d. New global constants
|
||||
|
||||
- HTTP stream wrapper:
|
||||
HTTP 1.1 requests now include a Connection: close header unless explicitly
|
||||
overridden by setting a Connection header via the header context option.
|
||||
- CURLOPT_MAX_RECV_SPEED_LARGE
|
||||
- CURLOPT_MAX_SEND_SPEED_LARGE
|
||||
- ENT_DISALLOWED
|
||||
- ENT_HTML401
|
||||
- ENT_HTML5
|
||||
- ENT_SUBSTITUTE
|
||||
- ENT_XHTML
|
||||
- ENT_XML1
|
||||
- IPPROTO_IP
|
||||
- IPPROTO_IPV6
|
||||
- IPV6_MULTICAST_HOPS
|
||||
- IPV6_MULTICAST_IF
|
||||
- IPV6_MULTICAST_LOOP
|
||||
- IP_MULTICAST_IF
|
||||
- IP_MULTICAST_LOOP
|
||||
- IP_MULTICAST_TTL
|
||||
- JSON_BIGINT_AS_STRING
|
||||
- JSON_OBJECT_AS_ARRAY
|
||||
- JSON_PRETTY_PRINT
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
- JSON_UNESCAPED_UNICODE
|
||||
- LIBXML_HTML_NODEFDTD
|
||||
- LIBXML_HTML_NOIMPLIED
|
||||
- LIBXML_PEDANTIC
|
||||
- MCAST_JOIN_GROUP
|
||||
- MCAST_LEAVE_GROUP
|
||||
- MCAST_BLOCK_SOURCE
|
||||
- MCAST_UNBLOCK_SOURCE
|
||||
- MCAST_JOIN_SOURCE_GROUP
|
||||
- MCAST_LEAVE_SOURCE_GROUP
|
||||
- OPENSSL_CIPHER_AES_128_CBC
|
||||
- OPENSSL_CIPHER_AES_192_CBC
|
||||
- OPENSSL_CIPHER_AES_256_CBC
|
||||
- OPENSSL_RAW_DATA
|
||||
- OPENSSL_ZERO_PADDING
|
||||
- PHP_OUTPUT_HANDLER_CLEAN
|
||||
- PHP_OUTPUT_HANDLER_CLEANABLE
|
||||
- PHP_OUTPUT_HANDLER_DISABLED
|
||||
- PHP_OUTPUT_HANDLER_FINAL
|
||||
- PHP_OUTPUT_HANDLER_FLUSH
|
||||
- PHP_OUTPUT_HANDLER_FLUSHABLE
|
||||
- PHP_OUTPUT_HANDLER_REMOVABLE
|
||||
- PHP_OUTPUT_HANDLER_STARTED
|
||||
- PHP_OUTPUT_HANDLER_STDFLAGS
|
||||
- PHP_OUTPUT_HANDLER_WRITE
|
||||
- PHP_QUERY_RFC1738
|
||||
- PHP_QUERY_RFC3986
|
||||
- PHP_SESSION_ACTIVE
|
||||
- PHP_SESSION_DISABLED
|
||||
- PHP_SESSION_NONE
|
||||
- SCANDIR_SORT_ASCENDING
|
||||
- SCANDIR_SORT_DESCENDING
|
||||
- SCANDIR_SORT_NONE
|
||||
- SORT_FLAG_CASE
|
||||
- SORT_NATURAL
|
||||
- STREAM_META_ACCESS
|
||||
- STREAM_META_GROUP
|
||||
- STREAM_META_GROUP_NAME
|
||||
- STREAM_META_OWNER
|
||||
- STREAM_META_OWNER_NAME
|
||||
- STREAM_META_TOUCH
|
||||
- T_CALLABLE
|
||||
- T_INSTEADOF
|
||||
- T_TRAIT
|
||||
- T_TRAIT_C
|
||||
- ZLIB_ENCODING_DEFLATE
|
||||
- ZLIB_ENCODING_GZIP
|
||||
- ZLIB_ENCODING_RAW
|
||||
- U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR
|
||||
- IDNA_CHECK_BIDI
|
||||
- IDNA_CHECK_CONTEXTJ
|
||||
- IDNA_NONTRANSITIONAL_TO_ASCII
|
||||
- IDNA_NONTRANSITIONAL_TO_UNICODE
|
||||
- INTL_IDNA_VARIANT_2003
|
||||
- INTL_IDNA_VARIANT_UTS46
|
||||
- IDNA_ERROR_EMPTY_LABEL
|
||||
- IDNA_ERROR_LABEL_TOO_LONG
|
||||
- IDNA_ERROR_DOMAIN_NAME_TOO_LONG
|
||||
- IDNA_ERROR_LEADING_HYPHEN
|
||||
- IDNA_ERROR_TRAILING_HYPHEN
|
||||
- IDNA_ERROR_HYPHEN_3_4
|
||||
- IDNA_ERROR_LEADING_COMBINING_MARK
|
||||
- IDNA_ERROR_DISALLOWED
|
||||
- IDNA_ERROR_PUNYCODE
|
||||
- IDNA_ERROR_LABEL_HAS_DOT
|
||||
- IDNA_ERROR_INVALID_ACE_LABEL
|
||||
- IDNA_ERROR_BIDI
|
||||
- IDNA_ERROR_CONTEXTJ
|
||||
|
||||
- Zip:
|
||||
New --with-libzip option allow to use system libzip. Version > 0.11 required,
|
||||
Version >= 0.11.2 recommended for all features.
|
||||
e. New classes
|
||||
|
||||
- Reflection:
|
||||
- ReflectionZendExtension
|
||||
|
||||
- Intl:
|
||||
- Transliterator
|
||||
- Spoofchecker
|
||||
|
||||
- JSON:
|
||||
- JsonSerializable
|
||||
|
||||
- Session:
|
||||
- SessionHandler
|
||||
|
||||
- SNMP:
|
||||
- SNMP
|
||||
|
||||
- SPL:
|
||||
- CallbackFilterIterator
|
||||
- RecursiveCallbackFilterIterator
|
||||
|
||||
f. New methods
|
||||
|
||||
- Closure:
|
||||
- Closure::bind()
|
||||
- Closure::bindTo()
|
||||
|
||||
- Reflection:
|
||||
- ReflectionClass::getTraitAliases()
|
||||
- ReflectionClass::getTraitNames()
|
||||
- ReflectionClass::getTraits()
|
||||
- ReflectionClass::isCloneable()
|
||||
- ReflectionClass::isTrait()
|
||||
- ReflectionClass::newInstanceWithoutConstructor()
|
||||
- ReflectionExtension::isPersistent()
|
||||
- ReflectionExtension::isTemporary()
|
||||
- ReflectionFunction::getClosure()
|
||||
- ReflectionFunction::getClosureScopeClass()
|
||||
- ReflectionFunction::getClosureThis()
|
||||
- ReflectionFunctionAbstract::getClosureScopeClass()
|
||||
- ReflectionFunctionAbstract::getClosureThis()
|
||||
- ReflectionMethod::getClosure()
|
||||
- ReflectionMethod::getClosureScopeClass()
|
||||
- ReflectionMethod::getClosureThis()
|
||||
- ReflectionObject::getTraitAliases()
|
||||
- ReflectionObject::getTraitNames()
|
||||
- ReflectionObject::getTraits()
|
||||
- ReflectionObject::isCloneable()
|
||||
- ReflectionObject::isTrait()
|
||||
- ReflectionObject::newInstanceWithoutConstructor()
|
||||
- ReflectionParameter::canBePassedByValue()
|
||||
- ReflectionParameter::isCallable()
|
||||
|
||||
- PDO_DBLIB:
|
||||
- PDO::newRowset()
|
||||
|
||||
- SPL:
|
||||
- DirectoryIterator::getExtension()
|
||||
- RegexIterator::getRegex()
|
||||
- SplDoublyLinkedList::serialize()
|
||||
- SplDoublyLinkedList::unserialize()
|
||||
- SplFileInfo::getExtension()
|
||||
- SplFileObject::fputcsv()
|
||||
- SplObjectStorage::getHash()
|
||||
- SplQueue::serialize
|
||||
- SplQueue::unserialize
|
||||
- SplStack::serialize
|
||||
- SplStack::unserialize
|
||||
- SplTempFileObject::fputcsv
|
||||
|
||||
- XSLT:
|
||||
- XsltProcessor::setSecurityPrefs()
|
||||
- XsltProcessor::getSecurityPrefs()
|
||||
|
||||
- Zlib:
|
||||
- zlib_decode()
|
||||
- zlib_encode()
|
||||
|
||||
g. New Hash algorithms
|
||||
|
||||
- fnv132
|
||||
- fnv164
|
||||
- joaat
|
||||
+162
-79
@@ -3,10 +3,15 @@ $Id$
|
||||
UPGRADE NOTES - PHP X.Y
|
||||
|
||||
1. Internal API changes
|
||||
a. Addition of do_operation and compare object handlers
|
||||
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
|
||||
c. POST data handling
|
||||
d. Arginfo changes
|
||||
a. virtual_file_ex
|
||||
b. stat/lstat support
|
||||
c. readlink support
|
||||
d. layout of some core ZE structures (zend_op_array, zend_class_entry, ...)
|
||||
e. Zend\zend_fast_cache.h has been removed
|
||||
f. streams that enclose private streams
|
||||
g. leak_variable
|
||||
h. API Signature changes
|
||||
i. new TSRM function expand_filepath_with_mode
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
@@ -17,108 +22,186 @@ UPGRADE NOTES - PHP X.Y
|
||||
1. Internal API changes
|
||||
========================
|
||||
|
||||
a. Addition of do_operation and compare object handlers
|
||||
a. virtual_file_ex
|
||||
|
||||
Two new object handlers have been added:
|
||||
virtual_file_ex takes now a TSRM context as last parameter:
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path,
|
||||
verify_path_func verify_path, int use_realpath TSRLS_DC);
|
||||
|
||||
do_operation:
|
||||
typedef int (*zend_object_do_operation_t)(
|
||||
zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC
|
||||
);
|
||||
|
||||
compare:
|
||||
typedef int (*zend_object_compare_zvals_t)(
|
||||
zval *result, zval *op1, zval *op2 TSRMLS_DC
|
||||
);
|
||||
b. stat/lstat support
|
||||
|
||||
The first handler is used to overload arithmetic operations. The first
|
||||
argument specifies the opcode of the operator, result is the target zval,
|
||||
op1 the first operand and op2 the second operand. For unary operations
|
||||
op2 is NULL. If the handler returns FAILURE PHP falls back to the default
|
||||
behavior for the operation.
|
||||
lstat is now available on all platforms. On unix-like platform
|
||||
php_sys_lstat is an alias to lstat (when avaible). On Windows it is now
|
||||
available using php_sys_lstat. php_sys_stat and php_sys_lstat usage is recommended
|
||||
instead of calling lstat directly, to ensure portability.
|
||||
|
||||
The second handler is used to perform comparison operations with
|
||||
non-objects. The value written into result must be an IS_LONG with value
|
||||
-1 (smaller), 0 (equal) or 1 (greater). The return value is a SUCCESS/FAILURE
|
||||
return code. The difference between this handler and compare_objects is
|
||||
that it will be triggered for comparisons with non-objects and objects of
|
||||
different types. It takes precedence over compare_objects.
|
||||
|
||||
Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp
|
||||
c. readlink support
|
||||
|
||||
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
|
||||
readlink is now available on all platforms. On unix-like platform
|
||||
php_sys_readlink is an alias to readlink (when avaible). On Windows it is now
|
||||
available using php_sys_readlink. php_sys_readlink usage is recommended
|
||||
instead of calling readlink directly, to ensure portability.
|
||||
|
||||
The return_value_ptr argument to internal functions is now always set.
|
||||
Previously it was only available for functions returning by-reference.
|
||||
return_value_ptr can now be used to return zvals without copying them.
|
||||
For this purpose two new macros are provided:
|
||||
|
||||
RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */
|
||||
RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */
|
||||
d. layout of some core ZE structures (zend_op_array, zend_class_entry, ...)
|
||||
|
||||
The macros behave similarly to the non-FAST variants with copy=1 and
|
||||
dtor=0, but will try to return the zval without making a copy by utilizing
|
||||
return_value_ptr.
|
||||
. zend_function.pass_rest_by_reference is replaced by
|
||||
ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags
|
||||
. zend_function.return_reference is replaced by ZEND_ACC_RETURN_REFERENCE
|
||||
in zend_function.fn_flags
|
||||
. zend_arg_info.required_num_args removed. it was needed only for internal
|
||||
functions. Now the first arg_info for internal function (which has special
|
||||
meaning) is represented by zend_internal_function_info structure.
|
||||
. zend_op_array.size, size_var, size_literal, current_brk_cont,
|
||||
backpatch_count moved into CG(context), because they are used only during
|
||||
compilation.
|
||||
. zend_op_array.start_op is moved into EG(start_op), because it's used
|
||||
only for 'interactive' execution of single top-level op-array.
|
||||
. zend_op_array.done_pass_two is replaced by ZEND_ACC_DONE_PASS_TWO in
|
||||
zend_op_array.fn_flags.
|
||||
. op_array.vars array is trimmed (reallocated) during pass_two.
|
||||
. zend_class_entry.constants_updated is replaced by
|
||||
ZEND_ACC_CONSTANTS_UPDATED in zend_class_entry.ce_flags
|
||||
. the size of zend_class_entry is reduced by sharing the same memory space
|
||||
by different information for internal and user classes.
|
||||
See zend_class_inttry.info union.
|
||||
|
||||
c. POST data handling
|
||||
|
||||
The sapi_request_info's members post_data, post_data_len and raw_post_data as
|
||||
well as raw_post_data_len have been replaced with a temp PHP stream
|
||||
request_body.
|
||||
|
||||
The recommended way to access raw POST data is to open and use a php://input
|
||||
stream wrapper. It is safe to be used concurrently and more than once.
|
||||
|
||||
d. Arginfo changes
|
||||
e. Zend\zend_fast_cache.h
|
||||
|
||||
The pass_rest_by_reference argument of the ZEND_BEGIN_ARG_INFO and
|
||||
ZEND_BEGIN_ARG_INFO_EX() is no longer used. The value passed to it is ignored.
|
||||
It should not have been used anymore since php5, but now this header has
|
||||
been removed. The following macros are not available anymore:
|
||||
|
||||
Instead a variadic argument is created using ZEND_ARG_VARIADIC_INFO():
|
||||
ZEND_FAST_ALLOC(p, type, fc_type)
|
||||
ZEND_FAST_FREE(p, fc_type)
|
||||
ZEND_FAST_ALLOC_REL(p, type, fc_type)
|
||||
ZEND_FAST_FREE_REL(p, fc_type)
|
||||
|
||||
ZEND_ARG_VARIADIC_INFO(0, name) /* pass rest by value */
|
||||
ZEND_ARG_VARIADIC_INFO(1, name) /* pass rest by reference */
|
||||
ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, name)
|
||||
/* pass rest by prefer-ref */
|
||||
Use emalloc, emalloc_rel, efree or efree_rel instead.
|
||||
|
||||
ZEND_ARG_VARIADIC_INFO() should only be used for the last argument.
|
||||
|
||||
The following changes were applied to the zend_arg_info struct:
|
||||
f. Streams that enclose private streams
|
||||
|
||||
typedef struct _zend_arg_info {
|
||||
const char *class_name;
|
||||
zend_uint class_name_len;
|
||||
zend_uchar type_hint;
|
||||
+ zend_uchar pass_by_reference;
|
||||
zend_bool allow_null;
|
||||
- zend_bool pass_by_reference;
|
||||
+ zend_bool is_variadic;
|
||||
} zend_arg_info;
|
||||
Some streams, like the temp:// stream, may enclose private streams. If the
|
||||
outer stream leaks due to a programming error or is not exposed through a
|
||||
zval (and therefore is not deleted when all the zvals are gone), it will
|
||||
be destroyed on shutdown.
|
||||
The problem is that the outer usually wants itself to close the inner stream,
|
||||
so that it may do any other shutdown action that requires the inner stream to
|
||||
be live (e.g. commit data to it). If the outer stream is exposed through a
|
||||
zval and the inner one isn't, this is not a problem because the outer stream
|
||||
will be freed when the zval is destroyed, which happens before the resources
|
||||
are destroyed on shutdown.
|
||||
On resource list shutdown, the cleanup happens in reverse order of resource
|
||||
creation, so if the inner stream was created in the opener of the outer stream,
|
||||
it will be destroyed first.
|
||||
The following functions were added to the streams API to force a predictable
|
||||
destruction order:
|
||||
|
||||
The following changes were applied to the zend_internal_function_info struct:
|
||||
PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclosed);
|
||||
#define php_stream_free_enclosed(stream_enclosed, close_options)
|
||||
PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options TSRMLS_DC);
|
||||
|
||||
typedef struct _zend_internal_function_info {
|
||||
zend_uint required_num_args;
|
||||
zend_uchar _type_hint;
|
||||
zend_bool return_reference;
|
||||
- zend_bool pass_rest_by_reference;
|
||||
+ zend_bool _allow_null;
|
||||
+ zend_bool _is_variadic;
|
||||
} zend_internal_function_info;
|
||||
Additionally, the following member was added to php_stream:
|
||||
|
||||
The CHECK_ARG_SEND_TYPE(), ARG_MUST_BE_SENT_BY_REF(),
|
||||
ARG_SHOULD_BE_SENT_BY_REF() and ARG_MAY_BE_SENT_BY_REF() macros now assume
|
||||
that the argument passed to them is a zend_function* and that it is non-NULL.
|
||||
struct _php_stream *enclosing_stream;
|
||||
|
||||
and the following macro was added:
|
||||
|
||||
#define PHP_STREAM_FREE_IGNORE_ENCLOSING 32
|
||||
|
||||
The function php_stream_encloses declares the first stream encloses the second.
|
||||
This has the effect that, when the inner stream is closed from a resource
|
||||
destructor it will abort and try to free its enclosing stream instead.
|
||||
To prevent this from happening when the inner stream is freed from the outer
|
||||
stream, the macro php_stream_free_enclosed should be used instead of
|
||||
php_stream_free/php_stream_close/php_stream_pclose, or the flag
|
||||
PHP_STREAM_FREE_IGNORE_ENCLOSING should be directly passed to php_stream_free.
|
||||
The outer stream cannot abstain, in its close callback, from closing the inner
|
||||
stream or clear the enclosing_stream pointer in its enclosed stream by calling
|
||||
php_stream_encloses with the 2nd argument NULL. If this is not done, there will
|
||||
be problems, so observe this requirement when using php_stream_encloses.
|
||||
|
||||
|
||||
g. leak_variable
|
||||
|
||||
The function leak_variable(variable [, leak_data]) was added. It is only
|
||||
available on debug builds. It increments the refcount of a zval or, if the
|
||||
second argument is true and the variable is either an object or a resource
|
||||
it increments the refcounts of those objects instead.
|
||||
|
||||
|
||||
h. API Signature changes
|
||||
|
||||
. zend_list_insert
|
||||
ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
|
||||
call: zend_list_insert(a, SOMETYPE TSRMLS_CC);
|
||||
NB: If zend_list_insert is used to register a resource,
|
||||
ZEND_REGISTER_RESOURCE could be used instead.
|
||||
|
||||
. php_le_stream_context(TSRMLS_C)
|
||||
PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D)
|
||||
call: context = php_stream_context_alloc(TSRMLS_C);
|
||||
|
||||
. php_stream_context_alloc
|
||||
PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D);
|
||||
call: context = php_stream_context_alloc(TSRMLS_C);
|
||||
|
||||
. sapi_get_request_time(TSRMLS_D);
|
||||
SAPI_API double sapi_get_request_time(TSRMLS_D);
|
||||
|
||||
. sapi_register_default_post_reader
|
||||
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC);
|
||||
|
||||
. sapi_register_treat_data
|
||||
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC);
|
||||
|
||||
. sapi_register_input_filter
|
||||
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC);
|
||||
|
||||
. tsrm_win32_access
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
|
||||
|
||||
. popen_ex (win32)
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
|
||||
|
||||
. php_get_current_user
|
||||
PHPAPI php_get_current_user(TSRMLS_D)
|
||||
Call: char *user = php_get_current_user(TSRMLS_C);
|
||||
|
||||
. php_idate
|
||||
PHPAPI php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
Call: int ret = php_idate(format, ts, localtime TSRMLS_CC)
|
||||
|
||||
. php_escape_html_entities
|
||||
(size_t parameters were ints, previous "quote_style" (now flags) has expanded meaning)
|
||||
PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC);
|
||||
|
||||
. php_escape_html_entities_ex
|
||||
PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC);
|
||||
|
||||
. php_unescape_html_entities
|
||||
PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC);
|
||||
|
||||
i.
|
||||
PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
|
||||
expand_filepath_with_mode lets define how realpath will behave, using one of the existing mode: CWD_EXPAND , CWD_FILEPATH or CWD_REALPATH.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
========================
|
||||
|
||||
a. Unix build system changes
|
||||
- The bison version check is now a blacklist instead of a whitelist.
|
||||
- The bison binary can be specified through the YACC environment/configure
|
||||
variable. Previously `bison` was assumed to be in $PATH.
|
||||
|
||||
- Changes in SAPI module build:
|
||||
. When adding new binary SAPI (executable, like CLI/CGI/FPM) use CLI config.m4 and Makefile.frag files as templates and replace CLI/cli with your SAPI name.
|
||||
|
||||
- New macros:
|
||||
. PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])
|
||||
|
||||
|
||||
b. Windows build system changes
|
||||
-
|
||||
-
|
||||
|
||||
+4
-5
@@ -10,15 +10,14 @@ libZend_la_SOURCES=\
|
||||
zend_ini_parser.y zend_ini_scanner.l \
|
||||
zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
|
||||
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_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_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.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_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c
|
||||
|
||||
libZend_la_LDFLAGS =
|
||||
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
|
||||
@@ -32,7 +31,7 @@ zend_ini_scanner.lo: zend_ini_parser.h
|
||||
# Language parser/scanner rules
|
||||
|
||||
zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
|
||||
$(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/zend_language_scanner.l
|
||||
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/zend_language_scanner.l
|
||||
|
||||
zend_language_parser.h: zend_language_parser.c
|
||||
zend_language_parser.c: $(srcdir)/zend_language_parser.y
|
||||
@@ -44,7 +43,7 @@ zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
|
||||
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
|
||||
|
||||
zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
|
||||
$(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l
|
||||
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l
|
||||
|
||||
zend_ini_parser.h: zend_ini_parser.c
|
||||
|
||||
|
||||
+3
-3
@@ -9,11 +9,11 @@ Modified: 2001-09-17
|
||||
1. Background/Need
|
||||
==================
|
||||
|
||||
Many internal functions of PHP will reject parameters because of their
|
||||
Many internal function of PHP will reject parameters because of their
|
||||
type (the array and variable function come to mind). For userland
|
||||
this is not an easy task as there is no uniform way to do it. An
|
||||
addition to the engine for requiring loose types would allow
|
||||
developers to know that the data passed to their functions are of the
|
||||
delevopers to know that the data passed to their functions is of the
|
||||
correct type and reduce the need for duplicating the same code in
|
||||
every function to check for the type of data.
|
||||
|
||||
@@ -57,7 +57,7 @@ function foo (array $var){
|
||||
===========
|
||||
|
||||
Mis-matches in type should be reported as fatal errors and should halt
|
||||
the execution of a script as that function cannot be run and code
|
||||
the execution of a script as that function can not be run and code
|
||||
following could not reliably run.
|
||||
|
||||
|
||||
|
||||
@@ -119,10 +119,6 @@ SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ast.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_builtin_functions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -163,10 +159,6 @@ SOURCE=.\zend_float.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_generators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -265,14 +257,6 @@ SOURCE=.\zend_ts_hash.c
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_vm_opcodes.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_virtual_cwd.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
@@ -140,10 +140,6 @@ SOURCE=.\zend_alloc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_ast.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_API.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -189,10 +185,6 @@ SOURCE=.\zend_extensions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_generators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -295,10 +287,6 @@ SOURCE=.\zend_ts_hash.c
|
||||
|
||||
SOURCE=.\zend_variables.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_vm_opcodes.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
+10
-19
@@ -3,13 +3,8 @@ dnl
|
||||
dnl This file contains local autoconf functions.
|
||||
|
||||
AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
# we only support certain bison versions;
|
||||
# min: 2.4 (i.e. 204, major * 100 + minor for easier comparison)
|
||||
bison_version_min="204"
|
||||
# non-working versions, e.g. "3.0 3.2";
|
||||
# remove "none" when introducing the first incompatible bison version an
|
||||
# separate any following additions by spaces
|
||||
bison_version_exclude="3.0"
|
||||
# we only support certain bison versions
|
||||
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4"
|
||||
|
||||
# for standalone build of Zend Engine
|
||||
test -z "$SED" && SED=sed
|
||||
@@ -17,27 +12,23 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
bison_version=none
|
||||
if test "$YACC"; then
|
||||
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
|
||||
bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z`
|
||||
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
|
||||
php_cv_bison_version=invalid
|
||||
if test -n "$bison_version_vars"; then
|
||||
set $bison_version_vars
|
||||
bison_version="${1}.${2}"
|
||||
bison_version_num="`expr ${1} \* 100 + ${2}`"
|
||||
if test $bison_version_num -ge $bison_version_min; then
|
||||
php_cv_bison_version="$bison_version (ok)"
|
||||
for bison_check_version in $bison_version_exclude; do
|
||||
if test "$bison_version" = "$bison_check_version"; then
|
||||
php_cv_bison_version=invalid
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for bison_check_version in $bison_version_list; do
|
||||
if test "$bison_version" = "$bison_check_version"; then
|
||||
php_cv_bison_version="$bison_check_version (ok)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
fi
|
||||
case $php_cv_bison_version in
|
||||
""|invalid[)]
|
||||
bison_msg="This bison version is not supported for regeneration of the Zend/PHP parsers (found: $bison_version, min: $bison_version_min, excluded: $bison_version_exclude)."
|
||||
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
|
||||
AC_MSG_WARN([$bison_msg])
|
||||
YACC="exit 0;"
|
||||
;;
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
--TEST--
|
||||
Basic argument unpacking
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
|
||||
function test2($arg1, $arg2, $arg3 = null) {
|
||||
var_dump($arg1, $arg2, $arg3);
|
||||
}
|
||||
|
||||
function getArray($array) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
function arrayGen($array) {
|
||||
foreach ($array as $element) {
|
||||
yield $element;
|
||||
}
|
||||
}
|
||||
|
||||
$array = [1, 2, 3];
|
||||
|
||||
test(...[]);
|
||||
test(...[1, 2, 3]);
|
||||
test(...$array);
|
||||
test(...getArray([1, 2, 3]));
|
||||
test(...arrayGen([]));
|
||||
test(...arrayGen([1, 2, 3]));
|
||||
|
||||
test(1, ...[2, 3], ...[4, 5], 6);
|
||||
test(1, ...getArray([2, 3]), ...arrayGen([4, 5]), 6);
|
||||
|
||||
test2(...[1, 2]);
|
||||
test2(...[1, 2, 3]);
|
||||
test2(...[1], ...[], ...[], ...[2, 3], 4, ...[5, 6]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
[5]=>
|
||||
int(6)
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
NULL
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
@@ -1,149 +0,0 @@
|
||||
--TEST--
|
||||
Argument unpacking with by-ref arguments
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function test1(&...$args) {
|
||||
foreach ($args as &$arg) {
|
||||
$arg++;
|
||||
}
|
||||
}
|
||||
|
||||
test1(...[1, 2, 3]);
|
||||
|
||||
$array = [1, 2, 3];
|
||||
test1(...$array);
|
||||
var_dump($array);
|
||||
|
||||
$array1 = [1, 2]; $val2 = 3; $array2 = [4, 5];
|
||||
test1(...$array1, $val2, ...$array2);
|
||||
var_dump($array1, $val2, $array2);
|
||||
|
||||
function test2($val1, &$ref1, $val2, &$ref2) {
|
||||
$ref1++;
|
||||
$ref2++;
|
||||
}
|
||||
|
||||
$array = [1, 2, 3, 4];
|
||||
test2(...$array);
|
||||
var_dump($array);
|
||||
|
||||
$a = $b = $c = $d = 0;
|
||||
|
||||
$array = [];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
$array = [1];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
$array = [1, 2];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
$array = [1, 2, 3];
|
||||
test2(...$array, $a, $b, $c, $d);
|
||||
var_dump($array, $a, $b, $c, $d);
|
||||
|
||||
$vars = [];
|
||||
$array = [];
|
||||
test2(...$array, $vars['a'], $vars['b'], $vars['c'], $vars['d']);
|
||||
var_dump($vars);
|
||||
|
||||
$vars = [];
|
||||
$array = [1];
|
||||
test2(...$array, $vars['a'], $vars['b'], $vars['c'], $vars['d']);
|
||||
var_dump($vars);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(4)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
int(4)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(6)
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(5)
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
int(0)
|
||||
int(1)
|
||||
int(0)
|
||||
int(1)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
int(1)
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
int(2)
|
||||
int(2)
|
||||
int(1)
|
||||
int(1)
|
||||
|
||||
Notice: Undefined index: a in %s on line %d
|
||||
|
||||
Notice: Undefined index: c in %s on line %d
|
||||
array(2) {
|
||||
["b"]=>
|
||||
int(1)
|
||||
["d"]=>
|
||||
int(1)
|
||||
}
|
||||
|
||||
Notice: Undefined index: b in %s on line %d
|
||||
|
||||
Notice: Undefined index: d in %s on line %d
|
||||
array(2) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
["c"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Unpack arguments for dynamic call
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$fn = function(...$args) {
|
||||
var_dump($args);
|
||||
};
|
||||
|
||||
$fn(...[]);
|
||||
$fn(...[1, 2, 3]);
|
||||
$fn(1, ...[2, 3], ...[], 4, 5);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Argument unpacking with internal functions
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arrays = [
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
[7, 8, 9],
|
||||
];
|
||||
var_dump(array_map(null, ...$arrays));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(7)
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(5)
|
||||
[2]=>
|
||||
int(8)
|
||||
}
|
||||
[2]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
int(6)
|
||||
[2]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
--TEST--
|
||||
Only arrays and Traversables can be unpacked
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
|
||||
test(...null);
|
||||
test(...42);
|
||||
test(...new stdClass);
|
||||
|
||||
test(1, 2, 3, ..."foo", ...[4, 5]);
|
||||
test(1, 2, ...new StdClass, 3, ...3.14, ...[4, 5]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
|
||||
Warning: Only arrays and Traversables can be unpacked in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Argument unpacking with many arguments
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function fn(...$args) {
|
||||
var_dump(count($args));
|
||||
}
|
||||
|
||||
$array = array_fill(0, 10000, 42);
|
||||
fn(...$array, ...$array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(20000)
|
||||
@@ -1,45 +0,0 @@
|
||||
--TEST--
|
||||
Unpack arguments for method calls
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
public function test(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
|
||||
public static function test2(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Foo;
|
||||
$foo->test(...[1, 2], 3, 4, ...[], 5);
|
||||
Foo::test2(1, 2, ...[3, 4], ...[], 5);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Unpack arguments for new expression
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
public function __construct(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
}
|
||||
|
||||
new Foo(...[]);
|
||||
new Foo(...[1, 2, 3]);
|
||||
new Foo(...[1], 2, ...[], ...[3, 4], 5);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Argument unpacking does not work with string keys (forward compatibility for named args)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($errno, $errstr) {
|
||||
var_dump($errstr);
|
||||
});
|
||||
|
||||
var_dump(...[1, 2, "foo" => 3, 4]);
|
||||
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(36) "Cannot unpack array with string keys"
|
||||
int(1)
|
||||
int(2)
|
||||
string(42) "Cannot unpack Traversable with string keys"
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Traversables that throw exceptions are properly handled during argument unpack
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(...$args) {
|
||||
var_dump($args);
|
||||
}
|
||||
|
||||
class Foo implements IteratorAggregate {
|
||||
public function getIterator() {
|
||||
throw new Exception('getIterator');
|
||||
}
|
||||
}
|
||||
|
||||
function gen() {
|
||||
yield 1;
|
||||
yield 2;
|
||||
throw new Exception('gen');
|
||||
}
|
||||
|
||||
try {
|
||||
test(1, 2, ...new Foo, 3, 4);
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
try {
|
||||
test(1, 2, ...gen(), 3, 4);
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(11) "getIterator"
|
||||
string(3) "gen"
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Traversables cannot be unpacked into by-reference parameters
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($val1, $val2, $val3, &$ref) {
|
||||
$ref = 42;
|
||||
}
|
||||
|
||||
function gen($array) {
|
||||
foreach ($array as $element) {
|
||||
yield $element;
|
||||
}
|
||||
}
|
||||
|
||||
test(...gen([1, 2, 3]), $a);
|
||||
var_dump($a);
|
||||
test(1, 2, 3, $b, ...gen([4, 5, 6]));
|
||||
var_dump($b);
|
||||
|
||||
test(...gen([1, 2, 3, 4]));
|
||||
test(1, 2, ...gen([3, 4]));
|
||||
test(...gen([1, 2]), ...gen([3, 4]));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(42)
|
||||
int(42)
|
||||
|
||||
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
|
||||
|
||||
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
|
||||
|
||||
Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Bug #18556 (Setting locale to 'tr_TR' lowercases class names)
|
||||
--FILE--
|
||||
<?php
|
||||
$g_lang = 'tr_TR';
|
||||
putenv("LANG=$g_lang");
|
||||
setlocale(LC_ALL, $g_lang);
|
||||
|
||||
class InfoBlob {
|
||||
var $foo;
|
||||
function InfoBlob() {
|
||||
$this->foo = "Foo";
|
||||
}
|
||||
}
|
||||
|
||||
echo "Instantiating an infoBlob with a lowercase i\n";
|
||||
$foobar = new infoBlob();
|
||||
echo $foobar->foo;
|
||||
echo "\nInstantiating an InfoBlob with an uppercase I\n";
|
||||
$foobar = new InfoBlob();
|
||||
echo $foobar->foo;
|
||||
echo "\n";
|
||||
setlocale(LC_ALL, "tr_TR.utf8");
|
||||
foreach(get_declared_classes() as $class)
|
||||
{
|
||||
if(!class_exists($class))
|
||||
echo "$class No Longer Exists!\n";
|
||||
|
||||
}
|
||||
echo "Done.\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Instantiating an infoBlob with a lowercase i
|
||||
Foo
|
||||
Instantiating an InfoBlob with an uppercase I
|
||||
Foo
|
||||
Done.
|
||||
@@ -2,7 +2,6 @@
|
||||
Bug #30820 (static member conflict with $this->member silently ignored)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
opcache.optimization_level=0
|
||||
--FILE--
|
||||
<?php
|
||||
class Blah {
|
||||
|
||||
@@ -64,8 +64,6 @@ print "\nDone\n";
|
||||
--EXPECTF--
|
||||
Notice: String offset cast occurred in %s on line %d
|
||||
|
||||
Notice: Uninitialized string offset: %s in %s on line 6
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %s on line %d
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %s on line %d
|
||||
|
||||
@@ -24,6 +24,6 @@ Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on l
|
||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: wrapper->stream_eof()
|
||||
#1 %s(%d): feof(Resource id #%d)
|
||||
#1 %s(%d): feof(Resource id #6)
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -2,8 +2,6 @@
|
||||
Bug #43450 (Memory leak on some functions with implicit object __toString() call)
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists('memory_get_usage')) die('memory_get_usage() not installed'); ?>
|
||||
--INI--
|
||||
opcache.enable_cli=0
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
|
||||
@@ -13,8 +13,10 @@ function eh()
|
||||
set_error_handler("eh");
|
||||
$a = $empty($b);
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'Exception' with message 'error!' in %sbug51394.php:%d
|
||||
Warning: Uncaught exception 'Exception' with message 'error!' in %sbug51394.php:4
|
||||
Stack trace:
|
||||
#0 %sbug51394.php(%d): eh(8, 'Undefined varia%s', '%s', %d, Array)
|
||||
#0 %sbug51394.php(9): eh(8, 'Undefined varia...', '%s', 9, Array)
|
||||
#1 {main}
|
||||
thrown in %sbug51394.php on line %d
|
||||
thrown in %sbug51394.php on line 4
|
||||
|
||||
Fatal error: Function name must be a string in %sbug51394.php on line 9
|
||||
@@ -35,30 +35,18 @@ Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 8
|
||||
|
||||
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 9
|
||||
|
||||
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 9
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 10
|
||||
|
||||
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 11
|
||||
|
||||
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
--TEST--
|
||||
Bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
|
||||
--INI--
|
||||
opcache.save_comments=1
|
||||
opcache.load_comments=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -3,18 +3,18 @@ Bug #60536 (Traits Segfault)
|
||||
--FILE--
|
||||
<?php
|
||||
trait T { private $x = 0; }
|
||||
class X {
|
||||
class X {
|
||||
use T;
|
||||
}
|
||||
class Y extends X {
|
||||
use T;
|
||||
function x() {
|
||||
return ++$this->x;
|
||||
return ++$this->x;
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
function z() {
|
||||
return ++$this->x;
|
||||
return ++$this->x;
|
||||
}
|
||||
}
|
||||
$a = new Z();
|
||||
@@ -22,6 +22,4 @@ $a->x();
|
||||
echo "DONE";
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Notice: Undefined property: Z::$x in %s on line 14
|
||||
DONE
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60738 Allow 'set_error_handler' to handle NULL
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(set_error_handler(
|
||||
function() { echo 'Intercepted error!', "\n"; }
|
||||
));
|
||||
|
||||
trigger_error('Error!');
|
||||
|
||||
var_dump(set_error_handler(null));
|
||||
|
||||
trigger_error('Error!');
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
Intercepted error!
|
||||
object(Closure)#1 (0) {
|
||||
}
|
||||
|
||||
Notice: Error! in %s on line %d
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60738 Allow 'set_error_handler' to handle NULL
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(set_exception_handler(
|
||||
function() { echo 'Intercepted exception!', "\n"; }
|
||||
));
|
||||
|
||||
var_dump(set_exception_handler(null));
|
||||
|
||||
throw new Exception('Exception!');
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
object(Closure)#1 (0) {
|
||||
}
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' with message 'Exception!' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60833 (self, parent, static behave inconsistently case-sensitive)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
static $x = "A";
|
||||
function testit() {
|
||||
$this->v1 = new sELF;
|
||||
$this->v2 = new SELF;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
static $x = "B";
|
||||
function testit() {
|
||||
PARENT::testit();
|
||||
$this->v3 = new sELF;
|
||||
$this->v4 = new PARENT;
|
||||
$this->v4 = STATIC::$x;
|
||||
}
|
||||
}
|
||||
$t = new B();
|
||||
$t->testit();
|
||||
var_dump($t);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(B)#%d (4) {
|
||||
["v1"]=>
|
||||
object(A)#%d (0) {
|
||||
}
|
||||
["v2"]=>
|
||||
object(A)#%d (0) {
|
||||
}
|
||||
["v3"]=>
|
||||
object(B)#%d (0) {
|
||||
}
|
||||
["v4"]=>
|
||||
string(1) "B"
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #61025 (__invoke() visibility not honored)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
Interface InvokeAble {
|
||||
static function __invoke();
|
||||
}
|
||||
|
||||
class Bar {
|
||||
private function __invoke() {
|
||||
return __CLASS__;
|
||||
}
|
||||
}
|
||||
|
||||
$b = new Bar;
|
||||
echo $b();
|
||||
|
||||
echo $b->__invoke();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
|
||||
|
||||
Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
|
||||
Bar
|
||||
Fatal error: Call to private method Bar::__invoke() from context '' in %sbug61025.php on line %d
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Bug #61681: Malformed grammar
|
||||
--FILE--
|
||||
<?php
|
||||
$la = "ooxx";
|
||||
|
||||
echo "${substr('laruence', 0, 2)}";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ooxx
|
||||
@@ -17,16 +17,18 @@ $undefined->foo();
|
||||
--EXPECTF--
|
||||
Error handler called (Undefined variable: undefined)
|
||||
|
||||
Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:%d
|
||||
Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:13
|
||||
Stack trace:
|
||||
#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d, Array)
|
||||
#0 %sbug61767.php(13): {closure}(8, 'Undefined varia...', '%s', 13, Array)
|
||||
#1 {main}
|
||||
thrown in %sbug61767.php on line %d
|
||||
thrown in %sbug61767.php on line 13
|
||||
|
||||
Fatal error: Call to a member function foo() on a non-object in %sbug61767.php on line 13
|
||||
Shutting down
|
||||
Array
|
||||
(
|
||||
[type] => 1
|
||||
[message] => %a
|
||||
[message] => Call to a member function foo() on a non-object
|
||||
[file] => %sbug61767.php
|
||||
[line] => %d
|
||||
[line] => 13
|
||||
)
|
||||
@@ -9,8 +9,6 @@ function add_points($player, $points) {
|
||||
add_points(NULL, 2);
|
||||
--EXPECTF--
|
||||
Warning: Creating default object from empty value in %sbug62005.php on line %d
|
||||
|
||||
Notice: Undefined property: stdClass::$energy in %sbug62005.php on line 3
|
||||
stdClass Object
|
||||
(
|
||||
[energy] => 2
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
--TEST--
|
||||
Bug #62991 (Segfault with generator and closure)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test( array $array )
|
||||
{
|
||||
$closure = function() use ( $array ) {
|
||||
print_r( $array );
|
||||
yield "hi";
|
||||
};
|
||||
return $closure();
|
||||
}
|
||||
|
||||
function test2( array $array )
|
||||
{
|
||||
$closure = function() use ( $array ) {
|
||||
print_r( $array );
|
||||
yield "hi";
|
||||
};
|
||||
return $closure; // if you return the $closure and call it outside this function it works.
|
||||
}
|
||||
|
||||
$generator = test(array( 1, 2, 3 ) );
|
||||
foreach($generator as $something) {
|
||||
}
|
||||
|
||||
$generator = test2(array( 1, 2, 3 ) );
|
||||
foreach($generator() as $something) {
|
||||
}
|
||||
|
||||
|
||||
$generator = test2(array( 1, 2, 3 ) );
|
||||
|
||||
echo "okey\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
[2] => 3
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
[2] => 3
|
||||
)
|
||||
okey
|
||||
@@ -1,50 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63741 (Crash when autoloading from spl)
|
||||
--FILE--
|
||||
<?php
|
||||
file_put_contents(dirname(__FILE__)."/bug63741.tmp.php",
|
||||
<<<'EOT'
|
||||
<?php
|
||||
if (isset($autoloading))
|
||||
{
|
||||
class ClassToLoad
|
||||
{
|
||||
static function func ()
|
||||
{
|
||||
print "OK!\n";
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
class autoloader
|
||||
{
|
||||
static function autoload($classname)
|
||||
{
|
||||
print "autoloading...\n";
|
||||
$autoloading = true;
|
||||
include __FILE__;
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register(["autoloader", "autoload"]);
|
||||
|
||||
function start()
|
||||
{
|
||||
ClassToLoad::func();
|
||||
}
|
||||
|
||||
start();
|
||||
}
|
||||
?>
|
||||
EOT
|
||||
);
|
||||
|
||||
include dirname(__FILE__)."/bug63741.tmp.php";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php unlink(dirname(__FILE__)."/bug63741.tmp.php"); ?>
|
||||
--EXPECT--
|
||||
autoloading...
|
||||
OK!
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64135 (Exceptions from set_error_handler are not always propagated)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function exception_error_handler() {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
set_error_handler("exception_error_handler");
|
||||
try {
|
||||
$undefined->undefined();
|
||||
} catch(Exception $e) {
|
||||
echo "Exception is thrown";
|
||||
}
|
||||
--EXPECT--
|
||||
Exception is thrown
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64555: Array key within interned string gets wrong hash value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
protected $unsetme = 1;
|
||||
protected $keepme = 2;
|
||||
|
||||
public function test() {
|
||||
$a = get_object_vars($this);
|
||||
|
||||
foreach ($a as $k => $v) {
|
||||
if ($k == 'unsetme') {
|
||||
echo "Unsetting: $k\n";
|
||||
unset($a[$k]);
|
||||
} else if ($k == 'keepme') {
|
||||
echo "Changing: $k\n";
|
||||
$a[$k] = 42;
|
||||
$a['keepme'] = 43;
|
||||
}
|
||||
}
|
||||
|
||||
var_dump($a, array_keys($a));
|
||||
}
|
||||
}
|
||||
|
||||
$f = new Foo;
|
||||
$f->test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Unsetting: unsetme
|
||||
Changing: keepme
|
||||
array(1) {
|
||||
["keepme"]=>
|
||||
int(43)
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(6) "keepme"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64677 (execution operator `` stealing surrounding arguments)
|
||||
--FILE--
|
||||
<?PHP
|
||||
class cat {
|
||||
public function show_output($prepend, $output = '') {
|
||||
}
|
||||
}
|
||||
$cat = new cat();
|
||||
$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec
|
||||
$cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
|
||||
$cat->show_output(`cd .`); // this causes a segmentation fault
|
||||
|
||||
function show_outputa($prepend, $output) {
|
||||
echo "Okey";
|
||||
}
|
||||
show_outputa('Files: ', `cd .`); // this works as expected
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Okey
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function new_closure_gen() {
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
}
|
||||
|
||||
$closure1 = new_closure_gen();
|
||||
$closure2 = new_closure_gen();
|
||||
|
||||
$gen1 = $closure1();
|
||||
$gen2 = $closure1();
|
||||
$gen3 = $closure2();
|
||||
|
||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||
foreach ($gen as $val) {
|
||||
var_dump($val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65051: count() off by one inside unset()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
public $array;
|
||||
|
||||
public function __destruct() {
|
||||
var_dump(count($this->array[0]));
|
||||
var_dump($this->array[0]);
|
||||
}
|
||||
}
|
||||
|
||||
$array = [[new Foo]];
|
||||
$array[0][0]->array =& $array;
|
||||
unset($array[0][0]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
array(0) {
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
--TEST--
|
||||
Fixed Bug #65784 (Segfault with finally)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo1() {
|
||||
try {
|
||||
throw new Exception("not catch");
|
||||
return true;
|
||||
} finally {
|
||||
try {
|
||||
throw new Exception("catched");
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
$foo = foo1();
|
||||
var_dump($foo);
|
||||
} catch (Exception $e) {
|
||||
do {
|
||||
var_dump($e->getMessage());
|
||||
} while ($e = $e->getPrevious());
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
try {
|
||||
try {
|
||||
throw new Exception("catched");
|
||||
return true;
|
||||
} finally {
|
||||
try {
|
||||
throw new Exception("catched");
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$foo = foo2();
|
||||
var_dump($foo);
|
||||
|
||||
function foo3() {
|
||||
try {
|
||||
throw new Exception("not catched");
|
||||
return true;
|
||||
} finally {
|
||||
try {
|
||||
throw new NotExists();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bar = foo3();
|
||||
--EXPECTF--
|
||||
string(9) "not catch"
|
||||
NULL
|
||||
|
||||
Fatal error: Class 'NotExists' not found in %sbug65784.php on line %d
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65911 (scope resolution operator - strange behavior with $this)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {}
|
||||
|
||||
class B
|
||||
{
|
||||
public function go()
|
||||
{
|
||||
$this->foo = 'bar';
|
||||
echo A::$this->foo; // should not output 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new B();
|
||||
$obj->go();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: A::$this in %s on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #65969 (Chain assignment with T_LIST failure)
|
||||
--FILE--
|
||||
<?php
|
||||
$obj = new stdClass;
|
||||
list($a,$b) = $obj->prop = [1,2];
|
||||
var_dump($a,$b);
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66218 zend_register_functions breaks reflection
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_SAPI != "cli") die("skip CLI only test");
|
||||
if (!function_exists("dl")) die("skip need dl");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tab = get_extension_funcs("standard");
|
||||
$fcts = array("dl");
|
||||
foreach ($fcts as $fct) {
|
||||
if (in_array($fct, $tab)) {
|
||||
echo "$fct Ok\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
dl Ok
|
||||
Done
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66252 (Problems in AST evaluation invalidating valid parent:: reference)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
const HW = "this is A";
|
||||
}
|
||||
class B extends A {
|
||||
const BHW = parent::HW . " extended by B";
|
||||
}
|
||||
const C = B::BHW;
|
||||
echo C, "\n";
|
||||
--EXPECT--
|
||||
this is A extended by B
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66286: Incorrect object comparison with inheritance
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
abstract class first {
|
||||
protected $someArray = array();
|
||||
}
|
||||
|
||||
class second extends first {
|
||||
protected $someArray = array();
|
||||
protected $someValue = null;
|
||||
|
||||
public function __construct($someValue) {
|
||||
$this->someValue = $someValue;
|
||||
}
|
||||
}
|
||||
|
||||
$objFirst = new second('123');
|
||||
$objSecond = new second('321');
|
||||
|
||||
var_dump ($objFirst == $objSecond);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (basic test)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo ($throw = FALSE) {
|
||||
try {
|
||||
echo "try\n";
|
||||
if ($throw) {
|
||||
throw new Exception("ex");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "catch\n";
|
||||
} finally {
|
||||
echo "finally\n";
|
||||
}
|
||||
|
||||
echo "end\n";
|
||||
}
|
||||
|
||||
foo();
|
||||
echo "\n";
|
||||
foo(true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
try
|
||||
finally
|
||||
end
|
||||
|
||||
try
|
||||
catch
|
||||
finally
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (basic test with return)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
try {
|
||||
echo "try\n";
|
||||
return 1;
|
||||
} catch (Exception $e) {
|
||||
} finally {
|
||||
echo "finally\n";
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
var_dump(foo());
|
||||
?>
|
||||
--EXPECTF--
|
||||
try
|
||||
finally
|
||||
int(1)
|
||||
@@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (with multi-returns)
|
||||
--FILE--
|
||||
<?php
|
||||
function dummy($msg) {
|
||||
var_dump($msg);
|
||||
}
|
||||
|
||||
function foo ($a) {
|
||||
try {
|
||||
dummy("try");
|
||||
return $a;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
} finally {
|
||||
dummy("finally");
|
||||
return "finally";
|
||||
}
|
||||
return "end";
|
||||
}
|
||||
|
||||
function &bar($a) {
|
||||
try {
|
||||
echo "try\n";
|
||||
throw new Exception("ex");
|
||||
} catch (Exception $e) {
|
||||
} finally {
|
||||
return $a;
|
||||
}
|
||||
return ($c = "end");
|
||||
}
|
||||
var_dump(foo("para"));
|
||||
var_dump(bar("para"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(3) "try"
|
||||
string(7) "finally"
|
||||
string(7) "finally"
|
||||
try
|
||||
string(4) "para"
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (nesting try-catch-finally)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function throw_exception($msg) {
|
||||
throw new Exception($msg);
|
||||
}
|
||||
|
||||
function foo (&$ex) {
|
||||
try {
|
||||
echo "1";
|
||||
try {
|
||||
echo "2";
|
||||
throw_exception("try");
|
||||
} catch (Exception $e) {
|
||||
echo "3";
|
||||
throw_exception("catch");
|
||||
} finally {
|
||||
echo "4";
|
||||
throw_exception("finally");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$ex = $e;
|
||||
echo "3";
|
||||
} finally {
|
||||
echo "2";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
var_dump(foo($ex));
|
||||
|
||||
do {
|
||||
var_dump($ex->getMessage());
|
||||
} while ($ex = $ex->getPrevious());
|
||||
?>
|
||||
--EXPECT--
|
||||
123432int(1)
|
||||
string(7) "finally"
|
||||
string(5) "catch"
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (with multi-returns and exception)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo ($a) {
|
||||
try {
|
||||
throw new Exception("ex");
|
||||
} catch (PdoException $e) {
|
||||
die("error");
|
||||
} catch (Exception $e) {
|
||||
return 2;
|
||||
} finally {
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
var_dump(foo("para"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Try catch finally (re-throw exception in catch block)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo ($a) {
|
||||
try {
|
||||
throw new Exception("ex");
|
||||
} catch (Exception $e) {
|
||||
var_dump($a);
|
||||
throw $e;
|
||||
} finally {
|
||||
var_dump("finally");
|
||||
return "return";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(foo("para"));
|
||||
} catch (Exception $e) {
|
||||
"caught exception" . PHP_EOL;
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "para"
|
||||
string(7) "finally"
|
||||
string(6) "return"
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
class One {
|
||||
// compile time constants
|
||||
const A = self::class;
|
||||
const B = Two::class;
|
||||
}
|
||||
class Two extends One {
|
||||
public static function run() {
|
||||
var_dump(self::class); // self compile time lookup
|
||||
var_dump(static::class); // runtime lookup
|
||||
var_dump(parent::class); // runtime lookup
|
||||
var_dump(Baz::class); // default compile time lookup
|
||||
}
|
||||
}
|
||||
class Three extends Two {
|
||||
// compile time static lookups
|
||||
public static function checkCompileTime(
|
||||
$one = self::class,
|
||||
$two = Baz::class,
|
||||
$three = One::A,
|
||||
$four = self::B
|
||||
) {
|
||||
var_dump($one, $two, $three, $four);
|
||||
}
|
||||
}
|
||||
echo "In NS\n";
|
||||
var_dump(Moo::CLASS); // resolve in namespace
|
||||
}
|
||||
|
||||
namespace {
|
||||
use Bee\Bop as Moo,
|
||||
Foo\Bar\One;
|
||||
echo "Top\n";
|
||||
var_dump(One::class); // resolve from use
|
||||
var_dump(Boo::class); // resolve in global namespace
|
||||
var_dump(Moo::CLASS); // resolve from use as
|
||||
var_dump(\Moo::Class); // resolve fully qualified
|
||||
$class = One::class; // assign class as scalar to var
|
||||
$x = new $class; // create new class from original scalar assignment
|
||||
var_dump($x);
|
||||
Foo\Bar\Two::run(); // resolve runtime lookups
|
||||
echo "Parent\n";
|
||||
Foo\Bar\Three::run(); // resolve runtime lookups with inheritance
|
||||
echo "Compile Check\n";
|
||||
Foo\Bar\Three::checkCompileTime();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
In NS
|
||||
string(11) "Foo\Bar\Moo"
|
||||
Top
|
||||
string(11) "Foo\Bar\One"
|
||||
string(3) "Boo"
|
||||
string(7) "Bee\Bop"
|
||||
string(3) "Moo"
|
||||
object(Foo\Bar\One)#1 (0) {
|
||||
}
|
||||
string(11) "Foo\Bar\Two"
|
||||
string(11) "Foo\Bar\Two"
|
||||
string(11) "Foo\Bar\One"
|
||||
string(11) "Foo\Bar\Baz"
|
||||
Parent
|
||||
string(11) "Foo\Bar\Two"
|
||||
string(13) "Foo\Bar\Three"
|
||||
string(11) "Foo\Bar\One"
|
||||
string(11) "Foo\Bar\Baz"
|
||||
Compile Check
|
||||
string(13) "Foo\Bar\Three"
|
||||
string(11) "Foo\Bar\Baz"
|
||||
string(11) "Foo\Bar\One"
|
||||
string(11) "Foo\Bar\Two"
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using static in class constant
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
class One {
|
||||
const Baz = static::class;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: static::class cannot be used for compile-time class name resolution in %s on line %d
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using parent in class constant
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
class One {
|
||||
const Baz = parent::class;
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: parent::class cannot be used for compile-time class name resolution in %s on line %d
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using static in method signature
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
class One {
|
||||
public function baz($x = static::class) {}
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: static::class cannot be used for compile-time class name resolution in %s on line %d
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using parent in method signature
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
class One {
|
||||
public function baz($x = parent::class) {}
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: parent::class cannot be used for compile-time class name resolution in %s on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using static non class context
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = static::class;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access static::class when no class scope is active in %s on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
class name as scalar from ::class keyword error using parent in non class context
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = parent::class;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access parent::class when no class scope is active in %s on line %d
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Class Property Expressions
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
const BAR = 1 << 0;
|
||||
const BAZ = 1 << 1;
|
||||
public $bar = self::BAR | self::BAZ;
|
||||
}
|
||||
echo (new Foo)->bar;
|
||||
?>
|
||||
--EXPECTF--
|
||||
3
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Static Class Property Expressions
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
public $b1 = 1 + 1;
|
||||
public $b2 = 1 << 2;
|
||||
public $b3 = "foo " . " bar " . " baz";
|
||||
}
|
||||
$f = new Foo;
|
||||
var_dump(
|
||||
$f->b1,
|
||||
$f->b2,
|
||||
$f->b3
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
int(4)
|
||||
string(13) "foo bar baz"
|
||||
@@ -21,11 +21,8 @@ var_dump($x = $test->test($y));
|
||||
var_dump($y, $x);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
|
||||
--EXPECT--
|
||||
int(4)
|
||||
|
||||
Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
|
||||
int(16)
|
||||
int(16)
|
||||
int(16)
|
||||
@@ -20,10 +20,7 @@ test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
||||
int(9)
|
||||
|
||||
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
||||
int(81)
|
||||
|
||||
Fatal error: Cannot pass parameter 1 by reference in %s on line %d
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Closure 047: Use in preg_replace_callback() using variables by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function replace_variables($text, $params) {
|
||||
|
||||
preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) {
|
||||
|
||||
$text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
|
||||
|
||||
}, $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
echo replace_variables('a=?', array('0')) . "\n";
|
||||
echo replace_variables('a=?, b=?', array('0', '1')) . "\n";
|
||||
echo replace_variables('a=?, b=?, c=?', array('0', '1', '2')) . "\n";
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
a=0
|
||||
a=0, b=1
|
||||
a=0, b=1, c=2
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Closure 048: Use in preg_replace_callback() using variables by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function replace_variables($text, $params) {
|
||||
|
||||
$c = function($matches) use (&$params, &$text) {
|
||||
$text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
|
||||
};
|
||||
|
||||
preg_replace_callback( '/(\?)/', $c, $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
echo replace_variables('a=?', array('0')) . "\n";
|
||||
echo replace_variables('a=?, b=?', array('0', '1')) . "\n";
|
||||
echo replace_variables('a=?, b=?, c=?', array('0', '1', '2')) . "\n";
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
a=0
|
||||
a=0, b=1
|
||||
a=0, b=1, c=2
|
||||
Done
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Const array deference
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
var_dump(array(1, 2, 3, 4,) [3]);
|
||||
var_dump(array(1, 2, 3, 4,) ['foo']);
|
||||
var_dump(array(array(1,2,3), array(4, 5, 6))[1][2]);
|
||||
|
||||
foreach (array(array(1, 2, 3))[0] as $var) {
|
||||
echo $var;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4)
|
||||
|
||||
Notice: Undefined index: foo in %sconst_dereference_001.php on line %d
|
||||
NULL
|
||||
int(6)
|
||||
123
|
||||
Loaded 100 of 3035 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user