summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanley Sufficool <ssufficool@php.net>2013-09-26 19:52:01 -0700
committerStanley Sufficool <ssufficool@php.net>2013-09-26 19:52:01 -0700
commit9aa904c375cd50a6e8a345f3c053e80a6617a377 (patch)
tree2ffe61739fa2e38048edbced922ab9b414e450e4
parent67c03eac620993e0c323658ab5cd6bff4616cbfb (diff)
parent30e0442c549bd20288ca8754daa0cdf24d98f055 (diff)
downloadphp-git-9aa904c375cd50a6e8a345f3c053e80a6617a377.tar.gz
Merge branch 'PHP-5.4' of https://git.php.net/push/php-src into PHP-5.4
* 'PHP-5.4' of https://git.php.net/push/php-src: (140 commits) Copy dba_*() keys before converting to string. Fix the broken sh syntax in ext/imap/config.m4. Revert "EmptyIterator now implements Countable; fixes bug 60577" RFC 6598 reserved ip range starts at 100.64.0.0 fix a very rare case of use of uninitialized value combined with a memleak NEWS for added reserved ip addresses according to RFC 6598 Add RFC 6598 IPs to reserved addresses NEWS for #60577 NEWS for bug #64441 Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names) EmptyIterator now implements Countable; fixes bug 60577 News for bugfix #64157 Bug 64157 Changed error message to make sense Tinker with the wording of the short_open_tag description. Handle CLI server request headers case insensitively. 5.4.21 now Typo.... Add a XFAIL test for #64896 Fixed Bug #65564 stack-buffer-overflow in DateTimeZone stuff caught by AddressSanitizer Fixed bug #60598 (cli/apache sapi segfault on objects manipulation) ...
-rw-r--r--Makefile.global4
-rw-r--r--NEWS127
-rw-r--r--TSRM/tsrm_win32.c8
-rw-r--r--Zend/README.ZEND_VM2
-rw-r--r--Zend/ZEND_CHANGES4
-rw-r--r--Zend/tests/bug60598.phpt30
-rw-r--r--Zend/tests/bug60771.phpt20
-rw-r--r--Zend/tests/bug64896.phpt47
-rw-r--r--Zend/tests/bug65291.phpt25
-rw-r--r--Zend/tests/bug65372.phpt40
-rw-r--r--Zend/tests/bug65579.phpt29
-rw-r--r--Zend/tests/closure_044.phpt2
-rw-r--r--Zend/tests/traits/bugs/overridding-conflicting-methods.phpt2
-rw-r--r--Zend/zend.c8
-rw-r--r--Zend/zend_API.c24
-rw-r--r--Zend/zend_builtin_functions.c25
-rw-r--r--Zend/zend_compile.c8
-rw-r--r--Zend/zend_dtrace.c24
-rw-r--r--Zend/zend_exceptions.c6
-rw-r--r--Zend/zend_execute_API.c2
-rw-r--r--Zend/zend_globals.h2
-rw-r--r--Zend/zend_language_parser.y12
-rw-r--r--Zend/zend_language_scanner.h2
-rw-r--r--Zend/zend_objects_API.c5
-rw-r--r--Zend/zend_vm_def.h11
-rw-r--r--Zend/zend_vm_execute.h38
-rw-r--r--Zend/zend_vm_gen.php2
-rw-r--r--acinclude.m449
-rw-r--r--build/libtool.m42
-rw-r--r--configure.in4
-rw-r--r--ext/curl/interface.c16
-rw-r--r--ext/curl/php_curl.h2
-rw-r--r--ext/curl/tests/bug65458.phpt25
-rw-r--r--ext/date/lib/parse_date.c203
-rw-r--r--ext/date/lib/parse_date.re7
-rw-r--r--ext/date/php_date.c24
-rw-r--r--ext/date/php_date.h2
-rw-r--r--ext/date/tests/DateInterval_days_prop1.phpt10
-rw-r--r--ext/date/tests/DateTime_fix_createFromFormat.phpt29
-rw-r--r--ext/date/tests/bug55397.phpt2
-rw-r--r--ext/date/tests/bug64157.phpt14
-rw-r--r--ext/dba/dba.c28
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dba/tests/bug65708.phpt38
-rw-r--r--ext/dba/tests/dba_gdbm.phpt2
-rw-r--r--ext/dom/php_dom.c4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error5.phpt8
-rw-r--r--ext/dom/tests/bug44648.phpt2
-rw-r--r--ext/dom/xpath.c2
-rw-r--r--ext/enchant/enchant.c2
-rw-r--r--ext/exif/exif.c2
-rw-r--r--ext/fileinfo/libmagic/softmagic.c2
-rw-r--r--ext/fileinfo/tests/magic4
-rw-r--r--ext/filter/filter.c2
-rw-r--r--ext/filter/logical_filters.c5
-rw-r--r--ext/filter/tests/018.phpt4
-rw-r--r--ext/filter/tests/bug64441.phpt11
-rw-r--r--ext/ftp/ftp.c56
-rw-r--r--ext/ftp/ftp.h12
-rw-r--r--ext/ftp/php_ftp.c16
-rw-r--r--ext/ftp/tests/filesize_large.phpt23
-rw-r--r--ext/ftp/tests/ftp_fget_basic.phpt2
-rw-r--r--ext/ftp/tests/ftp_get_basic.phpt2
-rw-r--r--ext/ftp/tests/ftp_nb_get_large.phpt36
-rw-r--r--ext/ftp/tests/server.inc23
-rw-r--r--ext/gd/gd.c2
-rw-r--r--ext/gd/libgd/webpimg.h2
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/hash/tests/hash_file_error.phpt6
-rw-r--r--ext/imap/config.m44
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c4
-rw-r--r--ext/intl/tests/transliterator_create_error.phpt6
-rw-r--r--ext/intl/tests/transliterator_transliterate_variant1.phpt8
-rw-r--r--ext/ldap/tests/ldap_get_values_len_error.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_rebind_proc_error.phpt4
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_utf8.c184
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_utf8.h1
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c185
-rw-r--r--ext/mbstring/oniguruma/HISTORY2
-rw-r--r--ext/mbstring/tests/bug65045.phpt29
-rw-r--r--ext/mbstring/tests/illformed_utf_sequences.phpt18
-rw-r--r--ext/mbstring/tests/mb_http_output.phpt2
-rw-r--r--ext/mysql/config.m42
-rw-r--r--ext/mysql/php_mysql.c4
-rw-r--r--ext/mysqli/mysqli.c2
-rw-r--r--ext/mysqli/tests/mysqli_driver.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_options.phpt2
-rw-r--r--ext/mysqlnd/mysqlnd.c8
-rw-r--r--ext/mysqlnd/mysqlnd_net.c2
-rw-r--r--ext/oci8/tests/bug43492_2.phpt2
-rw-r--r--ext/odbc/config.m437
-rw-r--r--ext/odbc/php_odbc.c2
-rw-r--r--ext/openssl/openssl.c138
-rw-r--r--ext/openssl/tests/bug64802.pem37
-rw-r--r--ext/openssl/tests/bug64802.phpt56
-rw-r--r--ext/openssl/tests/cve2013_4073.pem28
-rw-r--r--ext/openssl/tests/cve2013_4073.phpt19
-rw-r--r--ext/openssl/xp_ssl.c2
-rw-r--r--ext/pcntl/php_signal.c2
-rw-r--r--ext/pcntl/tests/pcntl_exec.phpt2
-rw-r--r--ext/pcntl/tests/pcntl_exec_2.phpt2
-rw-r--r--ext/pcre/tests/preg_grep_error1.phpt6
-rw-r--r--ext/pcre/tests/preg_match_all_error1.phpt6
-rw-r--r--ext/pcre/tests/preg_match_error1.phpt6
-rw-r--r--ext/pcre/tests/preg_replace_error1.phpt6
-rw-r--r--ext/pdo/pdo_dbh.c4
-rw-r--r--ext/pdo/pdo_sql_parser.c63
-rw-r--r--ext/pdo/pdo_sql_parser.re4
-rw-r--r--ext/pdo/pdo_stmt.c4
-rw-r--r--ext/pdo/php_pdo_driver.h8
-rw-r--r--ext/pdo_mysql/mysql_driver.c6
-rw-r--r--ext/pdo_mysql/pdo_mysql.c2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt1
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt2
-rw-r--r--ext/pdo_oci/oci_driver.c2
-rw-r--r--ext/pdo_oci/oci_statement.c6
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt2
-rw-r--r--ext/pdo_odbc/odbc_driver.c2
-rw-r--r--ext/pdo_odbc/odbc_stmt.c8
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c8
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
-rw-r--r--ext/pdo_pgsql/tests/bug64953.phpt71
-rw-r--r--ext/pdo_pgsql/tests/bug_33876.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt17
-rw-r--r--ext/pgsql/mysql_users.php2
-rw-r--r--ext/pgsql/pgsql.c246
-rw-r--r--ext/pgsql/tests/09notice.phpt2
-rw-r--r--ext/pgsql/tests/10pg_convert.phpt12
-rw-r--r--ext/pgsql/tests/10pg_convert_9.phpt12
-rw-r--r--ext/pgsql/tests/12pg_insert.phpt4
-rw-r--r--ext/pgsql/tests/12pg_insert_9.phpt4
-rw-r--r--ext/pgsql/tests/13pg_select.phpt2
-rw-r--r--ext/pgsql/tests/13pg_select_9.phpt4
-rw-r--r--ext/pgsql/tests/14pg_update.phpt4
-rw-r--r--ext/pgsql/tests/14pg_update_9.phpt4
-rw-r--r--ext/pgsql/tests/80_bug32223.phpt2
-rw-r--r--ext/pgsql/tests/80_bug32223b.phpt2
-rw-r--r--ext/pgsql/tests/bug47199.phpt4
-rw-r--r--ext/pgsql/tests/bug64609.phpt6
-rw-r--r--ext/pgsql/tests/config.inc2
-rw-r--r--ext/pgsql/tests/pg_delete_001.phpt4
-rw-r--r--ext/pgsql/tests/pg_insert_001.phpt2
-rw-r--r--ext/pgsql/tests/pg_update_001.phpt4
-rw-r--r--ext/phar/phar.c23
-rw-r--r--ext/phar/tests/bug65028.phpt156
-rw-r--r--ext/posix/tests/posix_ctermid.phpt2
-rw-r--r--ext/reflection/php_reflection.c2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt2
-rw-r--r--ext/session/session.c15
-rw-r--r--ext/session/tests/020.phpt2
-rw-r--r--ext/session/tests/bug50308.phpt30
-rw-r--r--ext/session/tests/session_status_disabled.phpt2
-rw-r--r--ext/simplexml/simplexml.c2
-rw-r--r--ext/snmp/snmp.c2
-rw-r--r--ext/soap/interop/client_round2_interop.php4
-rw-r--r--ext/soap/interop/index.php2
-rw-r--r--ext/soap/php_schema.c54
-rw-r--r--ext/soap/soap.c99
-rw-r--r--ext/soap/tests/bugs/bug28985.phpt6
-rw-r--r--ext/soap/tests/bugs/bug28985.wsdl2
-rw-r--r--ext/soap/tests/bugs/bug65018.phpt28
-rw-r--r--ext/sockets/sockets.c2
-rw-r--r--ext/spl/internal/iteratoriterator.inc2
-rw-r--r--ext/spl/internal/multipleiterator.inc4
-rw-r--r--ext/spl/internal/splobjectstorage.inc2
-rwxr-xr-xext/spl/spl.php4
-rw-r--r--ext/spl/spl_array.c4
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt2
-rw-r--r--ext/spl/tests/bug63680.phpt2
-rw-r--r--ext/spl/tests/bug65328.phpt348
-rw-r--r--ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt2
-rw-r--r--ext/sqlite3/libsqlite/sqlite3.c42
-rw-r--r--ext/sqlite3/php_sqlite3_structs.h2
-rw-r--r--ext/standard/array.c27
-rw-r--r--ext/standard/filters.c4
-rw-r--r--ext/standard/html.c6
-rw-r--r--ext/standard/image.c2
-rw-r--r--ext/standard/info.c2
-rw-r--r--ext/standard/mail.c2
-rw-r--r--ext/standard/pack.c4
-rw-r--r--ext/standard/php_var.h1
-rw-r--r--ext/standard/string.c6
-rw-r--r--ext/standard/tests/array/array_count_values_variation.phpt4
-rw-r--r--ext/standard/tests/array/array_key_exists_variation2.phpt2
-rw-r--r--ext/standard/tests/array/array_search_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_values_variation7.phpt2
-rw-r--r--ext/standard/tests/array/bug34066.phpt4
-rw-r--r--ext/standard/tests/array/bug34066_1.phpt4
-rw-r--r--ext/standard/tests/array/bug65304.phpt10
-rw-r--r--ext/standard/tests/array/in_array_variation4.phpt2
-rw-r--r--ext/standard/tests/array/uasort_object2.phpt2
-rw-r--r--ext/standard/tests/array/uasort_variation10.phpt2
-rw-r--r--ext/standard/tests/array/uasort_variation4.phpt2
-rw-r--r--ext/standard/tests/file/bug41874.phpt4
-rw-r--r--ext/standard/tests/file/bug41874_2.phpt2
-rw-r--r--ext/standard/tests/file/bug41874_3.phpt2
-rw-r--r--ext/standard/tests/file/chmod_basic-win32.phpt2
-rw-r--r--ext/standard/tests/file/chmod_basic.phpt2
-rw-r--r--ext/standard/tests/file/file.inc4
-rw-r--r--ext/standard/tests/file/file_get_contents_error001.phpt1
-rw-r--r--ext/standard/tests/file/glob_variation3.phpt19
-rw-r--r--ext/standard/tests/file/lchown_error.phpt2
-rw-r--r--ext/standard/tests/file/symlink_to_symlink.phpt6
-rw-r--r--ext/standard/tests/file/userstreams.phpt2
-rw-r--r--ext/standard/tests/general_functions/dl-cve-2007-4887.phpt7
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_variation1.phpt10
-rw-r--r--ext/standard/tests/serialize/bug65481.phpt40
-rw-r--r--ext/standard/tests/streams/bug65483.phpt19
-rw-r--r--ext/standard/tests/strings/bug38322.phpt2
-rw-r--r--ext/standard/tests/strings/bug47322.phpt2
-rw-r--r--ext/standard/tests/strings/explode_error.phpt4
-rw-r--r--ext/standard/tests/strings/explode_variation1.phpt10
-rw-r--r--ext/standard/tests/strings/explode_variation2.phpt4
-rw-r--r--ext/standard/tests/strings/explode_variation3.phpt6
-rw-r--r--ext/standard/tests/strings/implode1.phptbin5876 -> 5875 bytes
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin6877 -> 6878 bytes
-rw-r--r--ext/standard/tests/strings/str_replace.phpt2
-rw-r--r--ext/standard/tests/strings/str_replace_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/strcasecmp.phptbin22268 -> 22269 bytes
-rw-r--r--ext/standard/tests/strings/strcmp.phptbin20034 -> 20035 bytes
-rw-r--r--ext/standard/tests/strings/strlen.phptbin7090 -> 7091 bytes
-rw-r--r--ext/standard/tests/strings/strpos.phptbin9981 -> 9982 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_basic.phpt2
-rw-r--r--ext/standard/tests/strings/strstr.phptbin10530 -> 10531 bytes
-rw-r--r--ext/standard/tests/strings/substr_replace_error.phpt4
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin6105 -> 6106 bytes
-rw-r--r--ext/standard/url.c2
-rw-r--r--ext/standard/url_scanner_ex.c159
-rw-r--r--ext/standard/url_scanner_ex.re6
-rw-r--r--ext/standard/var_unserializer.c117
-rw-r--r--ext/standard/var_unserializer.re53
-rw-r--r--ext/sybase_ct/php_sybase_ct.c8
-rw-r--r--ext/sybase_ct/tests/bug26407.phpt2
-rw-r--r--ext/sybase_ct/tests/bug43578.phpt2
-rw-r--r--ext/sybase_ct/tests/test_fetch_object.phpt2
-rw-r--r--ext/sybase_ct/tests/test_msghandler.phpt4
-rw-r--r--ext/tidy/tidy.c2
-rw-r--r--ext/xml/compat.c206
-rw-r--r--ext/xml/xml.c8
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_soap.c2
-rw-r--r--ext/xmlrpc/tests/003.phpt109
-rw-r--r--ext/xmlrpc/tests/004.phpt19
-rw-r--r--ext/xmlrpc/tests/005.phpt47
-rw-r--r--ext/xmlrpc/tests/006.phpt29
-rw-r--r--ext/xmlrpc/tests/007.phpt29
-rw-r--r--ext/xmlwriter/tests/bug41287.phpt2
-rw-r--r--ext/xsl/xsltprocessor.c2
-rw-r--r--ext/zip/php_zip.c2
-rw-r--r--ext/zlib/tests/bug65391.phpt28
-rw-r--r--ext/zlib/zlib.c6
-rw-r--r--main/fopen_wrappers.c7
-rw-r--r--main/main.c11
-rw-r--r--main/php_ini.c5
-rw-r--r--main/php_variables.c2
-rw-r--r--main/php_version.h6
-rw-r--r--main/rfc1867.c2
-rw-r--r--main/snprintf.h6
-rw-r--r--main/spprintf.h2
-rw-r--r--main/streams/cast.c2
-rw-r--r--php.ini-development21
-rw-r--r--php.ini-production21
-rwxr-xr-xrun-tests.php11
-rw-r--r--sapi/apache/config.m42
-rw-r--r--sapi/apache2filter/config.m42
-rw-r--r--sapi/apache2handler/config.m42
-rw-r--r--sapi/apache_hooks/config.m42
-rw-r--r--sapi/cgi/Makefile.frag1
-rw-r--r--sapi/cli/php.1.in22
-rw-r--r--sapi/cli/php_cli.c3
-rw-r--r--sapi/cli/php_cli_server.c19
-rw-r--r--sapi/cli/tests/bug65633.phpt48
-rw-r--r--sapi/fpm/php-fpm.conf.in4
-rw-r--r--sapi/litespeed/README2
-rw-r--r--scripts/Makefile.frag2
-rw-r--r--scripts/dev/generate-phpt.pharbin52354 -> 52356 bytes
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtTestCase.php2
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php2
-rw-r--r--scripts/phpize.in2
-rw-r--r--tests/basic/bug45986.phpt2
-rw-r--r--tests/classes/static_properties_004.phpt4
-rw-r--r--win32/build/libs_version.txt2
-rw-r--r--win32/sendmail.c2
292 files changed, 3466 insertions, 1278 deletions
diff --git a/Makefile.global b/Makefile.global
index b30c318fc4..6b79ad7aa4 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -10,7 +10,7 @@ all: $(all_targets)
@echo "Build complete."
@echo "Don't forget to run 'make test'."
@echo
-
+
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
build-binaries: $(PHP_BINARIES)
@@ -116,7 +116,7 @@ clean:
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 stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
+ 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
diff --git a/NEWS b/NEWS
index 763e08d3dd..e17632543c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,119 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-?? ??? 2013, PHP 5.4.18
+?? ??? 2013, PHP 5.4.21
+
+- CLI server:
+ . Fixed bug #65633 (built-in server treat some http headers as
+ case-sensitive). (Adam)
+
+- Datetime:
+ . Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
+ message). (Boro Sitnikovski)
+
+- DBA extension:
+ . Fixed bug #65708 (dba functions cast $key param to string in-place,
+ bypassing copy on write). (Adam)
+
+- Filter:
+ . Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
+ . Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
+ (Syra)
+
+- IMAP:
+ . Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
+ imap). (ryotakatsuki at gmail dot com)
+
+?? ??? 2013, PHP 5.4.20
+
+- Core:
+ . Fixed bug #60598 (cli/apache sapi segfault on objects manipulation).
+ (Laruence)
+ . Fixed bug #65579 (Using traits with get_class_methods causes segfault).
+ (Adam)
+ . Fixed bug #65490 (Duplicate calls to get lineno & filename for
+ DTRACE_FUNCTION_*). (Chris Jones)
+ . Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
+ spaces). (Michael M Slusarz)
+ . Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
+ . Fixed bug #65470 (Segmentation fault in zend_error() with
+ --enable-dtrace). (Chris Jones, Kris Van Hees)
+ . Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
+ fails). (Laruence)
+ . Fixed bug #65304 (Use of max int in array_sum). (Laruence)
+ . Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
+ limited case). (Arpad)
+ . Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
+ . Improved fix for bug #63186 (compile failure on netbsd). (Matteo)
+ . Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
+ . Fixed bug #61759 (class_alias() should accept classes with leading
+ backslashes). (Julien)
+ . Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
+ . Cherry-picked some DTrace build commits (allowing builds on Linux,
+ bug #62691, and bug #63706) from PHP 5.5 branch
+ . Fixed bug #61268 (--enable-dtrace leads make to clobber
+ Zend/zend_dtrace.d) (Chris Jones)
+
+- cURL:
+ . Fixed bug #65458 (curl memory leak). (Adam)
+
+- Datetime:
+ . Fixed bug #65554 (createFromFormat broken when weekday name is followed
+ by some delimiters). (Valentin Logvinskiy, Stas).
+ . Fixed bug #65564 (stack-buffer-overflow in DateTimeZone stuff caught
+ by AddressSanitizer). (Remi).
+
+- Openssl:
+ . Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
+ some cases). (Mark Jones)
+
+- Session:
+ . Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
+ gmail dot com)
+ . Fixed bug #50308 (session id not appended properly for empty anchor tags).
+ (Arpad)
+ . Fixed possible buffer overflow under Windows. Note: Not a security fix.
+ (Yasuo)
+ . Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
+
+- SOAP:
+ . Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
+
+- SPL:
+ . Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
+
+- PDO:
+ . Fixed bug #64953 (Postgres prepared statement positional parameter
+ casting). (Mike)
+
+- Phar:
+ . Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
+ some specific contents). (Stas)
+
+- Pgsql:
+ . Fixed bug #65336 (pg_escape_literal/identifier() silently returns false).
+ (Yasuo)
+ . Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
+ /pg_delete()/pg_insert()). (Yasuo)
+
+- Zlib:
+ . Fixed bug #65391 (Unable to send vary header user-agent when
+ ob_start('ob_gzhandler') is called) (Mike)
+
+22 Aug 2013, PHP 5.4.19
- Core:
+ . Fixed bug #64503 (Compilation fails with error: conflicting types for
+ 'zendparse'). (Laruence)
+
+- Openssl:
+ . Fixed UMR in fix for CVE-2013-4248.
+
+15 Aug 2013, PHP 5.4.18
+
+- Core:
+ . Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
+ erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
+ avp200681 gmail com).
. Fixed bug #65254 (Exception not catchable when exception thrown in autoload
with a namespace). (Laruence)
. Fixed bug #65108 (is_callable() triggers Fatal Error).
@@ -24,6 +135,9 @@ PHP NEWS
. Fixed bug #65066 (Cli server not responsive when responding with 422 http
status code). (Adam)
+- CURL:
+ . Fixed bug #62665 (curl.cainfo doesn't appear in php.ini). (Lior Kaplan)
+
- FPM:
. Fixed bug #63983 (enabling FPM borks compile on FreeBSD).
(chibisuke at web dot de, Felipe)
@@ -51,10 +165,18 @@ PHP NEWS
. Fixed bug #61387 (NULL valued anonymous column causes segfault in
odbc_fetch_array). (Brandon Kirsch)
+- Openssl:
+ . Fixed handling null bytes in subjectAltName (CVE-2013-4248).
+ (Christian Heimes)
+
- PDO:
. Allowed PDO_OCI to compile with Oracle Database 12c client libraries.
(Chris Jones)
+- PDO_dblib:
+ . Fixed bug #65219 (PDO/dblib not working anymore ("use dbName" not sent)).
+ (Stanley Sufficool)
+
- PDO_pgsql:
. Fixed meta data retrieve when OID is larger than 2^31. (Yasuo)
@@ -80,6 +202,9 @@ PHP NEWS
. Fixed bug #60560 (SplFixedArray un-/serialize, getSize(), count() return 0,
keys are strings). (Adam)
+- XML:
+ . Fixed bug #65236 (heap corruption in xml parser, CVE-2013-4113). (Rob)
+
04 Jul 2013, PHP 5.4.17
- Core:
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index 0ced6db451..2ec97be011 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -625,7 +625,7 @@ TSRM_API int shmget(int key, int size, int flags)
shm->info = info_handle;
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
- if (created) {
+ if (NULL != shm->descriptor && created) {
shm->descriptor->shm_perm.key = key;
shm->descriptor->shm_segsz = size;
shm->descriptor->shm_ctime = time(NULL);
@@ -639,8 +639,10 @@ TSRM_API int shmget(int key, int size, int flags)
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
}
- if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
- CloseHandle(shm->segment);
+ if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) {
+ if (NULL != shm->segment) {
+ CloseHandle(shm->segment);
+ }
UnmapViewOfFile(shm->descriptor);
CloseHandle(shm->info);
return -1;
diff --git a/Zend/README.ZEND_VM b/Zend/README.ZEND_VM
index 15ff6fd86f..de66110d64 100644
--- a/Zend/README.ZEND_VM
+++ b/Zend/README.ZEND_VM
@@ -6,7 +6,7 @@ fields and using different execution methods (call threading, switch threading
and direct threading). As a result ZE2 got more than 20% speedup on raw PHP
code execution (with specialized executor and direct threading execution
method). As in most PHP applications raw execution speed isn't the limiting
-factor but system calls and database callls are, your mileage with this patch
+factor but system calls and database calls are, your mileage with this patch
will vary.
Most parts of the old zend_execute.c go into zend_vm_def.h. Here you can
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
index 4a6dc6cdcf..afb3595595 100644
--- a/Zend/ZEND_CHANGES
+++ b/Zend/ZEND_CHANGES
@@ -1136,7 +1136,7 @@ Changes in the Zend Engine 1.0
(supports breakpoints, expression evaluation, step-in/over,
function call backtrace, and more).
- The Zend Engine claims 100% compatability with the engine of PHP
+ The Zend Engine claims 100% compatibility with the engine of PHP
3.0, and is shamelessly lying about it. Here's why:
* Static variable initializers only accept scalar values
@@ -1161,6 +1161,6 @@ Changes in the Zend Engine 1.0
printed the letter { and the contents of the variable $somevar in
PHP 3.0), it will result in a parse error with the Zend Engine.
In this case, you would have to change the code to print
- "\{$somevar"; This incompatability is due to the full variable
+ "\{$somevar"; This incompatibility is due to the full variable
reference within quoted strings feature added in the Zend
Engine.
diff --git a/Zend/tests/bug60598.phpt b/Zend/tests/bug60598.phpt
new file mode 100644
index 0000000000..eeee75a19d
--- /dev/null
+++ b/Zend/tests/bug60598.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #60598 (cli/apache sapi segfault on objects manipulation)
+--FILE--
+<?php
+define('OBJECT_COUNT', 10000);
+
+$containers = array();
+
+class Object {
+ protected $_guid = 0;
+ public function __construct() {
+ global $containers;
+ $this->guid = 1;
+ $containers[spl_object_hash($this)] = $this;
+ }
+ public function __destruct() {
+ global $containers;
+ $containers[spl_object_hash($this)] = NULL;
+ }
+}
+
+for ($i = 0; $i < OBJECT_COUNT; ++$i) {
+ new Object();
+}
+
+// You probably won't see this because of the "zend_mm_heap corrupted"
+?>
+If you see this, try to increase OBJECT_COUNT to 100,000
+--EXPECT--
+If you see this, try to increase OBJECT_COUNT to 100,000
diff --git a/Zend/tests/bug60771.phpt b/Zend/tests/bug60771.phpt
index c20bbc462a..119ae50ad4 100644
--- a/Zend/tests/bug60771.phpt
+++ b/Zend/tests/bug60771.phpt
@@ -1,10 +1,10 @@
---TEST--
-test of larger than 8kb text file being parsed by require statement
---FILE--
-<?php
- file_put_contents('test.php',str_repeat('passed, ',1024));
- require('test.php');
- unlink('test.php');
-?>
---EXPECT--
-passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,
+--TEST--
+test of larger than 8kb text file being parsed by require statement
+--FILE--
+<?php
+ file_put_contents('test.php',str_repeat('passed, ',1024));
+ require('./test.php');
+ unlink('test.php');
+?>
+--EXPECT--
+passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,
diff --git a/Zend/tests/bug64896.phpt b/Zend/tests/bug64896.phpt
new file mode 100644
index 0000000000..3e955bbece
--- /dev/null
+++ b/Zend/tests/bug64896.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
+--XFAIL--
+We can not fix this bug without a significant (performace slow down) change to gc
+--FILE--
+<?php
+$bar = NULL;
+class bad
+{
+ private $_private = array();
+
+ public function __construct()
+ {
+ $this->_private[] = 'php';
+ }
+
+ public function __destruct()
+ {
+ global $bar;
+ $bar = $this;
+ }
+}
+
+$foo = new stdclass;
+$foo->foo = $foo;
+$foo->bad = new bad;
+
+gc_disable();
+
+unserialize(serialize($foo));
+gc_collect_cycles();
+var_dump($bar);
+/* will output:
+object(bad)#4 (1) {
+ ["_private":"bad":private]=>
+ &UNKNOWN:0
+}
+*/
+?>
+--EXPECTF--
+bject(bad)#%d (1) {
+ ["_private":"bad":private]=>
+ array(1) {
+ [0]=>
+ string(3) "php"
+ }
+}
diff --git a/Zend/tests/bug65291.phpt b/Zend/tests/bug65291.phpt
new file mode 100644
index 0000000000..7bc76331c0
--- /dev/null
+++ b/Zend/tests/bug65291.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
+--FILE--
+<?php
+
+trait TestTrait
+{
+ public static function testStaticFunction()
+ {
+ return __CLASS__;
+ }
+}
+class Tester
+{
+ use TestTrait;
+}
+
+$foo = Tester::testStaticFunction();
+get_defined_constants();
+get_defined_constants(true);
+
+echo $foo;
+?>
+--EXPECT--
+Tester
diff --git a/Zend/tests/bug65372.phpt b/Zend/tests/bug65372.phpt
new file mode 100644
index 0000000000..50fc2dbb1b
--- /dev/null
+++ b/Zend/tests/bug65372.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #65372 (Segfault in gc_zval_possible_root when return reference fails)
+--FILE--
+<?php
+
+class ParentClass
+{
+ private static $_OBJECTS;
+
+ public static function Get()
+ {
+ self::$_OBJECTS[1] = new ChildClass();
+ return self::$_OBJECTS[1];
+ }
+}
+
+class ChildClass extends ParentClass
+{
+ public $Manager;
+
+ function __construct()
+ {
+ $this->Manager = $this;
+ }
+
+ public static function &GetCurrent()
+ {
+ return ChildClass::Get();
+ }
+
+ public static function &Get()
+ {
+ return parent::Get();
+ }
+}
+
+$staff = ChildClass::GetCurrent();
+?>
+--EXPECTF--
+Notice: Only variable references should be returned by reference in %sbug65372.php on line 30
diff --git a/Zend/tests/bug65579.phpt b/Zend/tests/bug65579.phpt
new file mode 100644
index 0000000000..25d74ed4f5
--- /dev/null
+++ b/Zend/tests/bug65579.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #65579 (Using traits with get_class_methods causes segfault)
+--FILE--
+<?php
+trait ParentTrait {
+ public function testMethod() { }
+}
+
+trait ChildTrait {
+ use ParentTrait {
+ testMethod as testMethodFromParentTrait;
+ }
+ public function testMethod() { }
+}
+
+class TestClass {
+ use ChildTrait;
+}
+
+$obj = new TestClass();
+var_dump(get_class_methods($obj));
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(10) "testMethod"
+ [1]=>
+ string(25) "testmethodfromparenttrait"
+}
diff --git a/Zend/tests/closure_044.phpt b/Zend/tests/closure_044.phpt
index d2644c0401..8fdef135dc 100644
--- a/Zend/tests/closure_044.phpt
+++ b/Zend/tests/closure_044.phpt
@@ -3,7 +3,7 @@ Closure 044: Scope/bounding combination invariants; non static closures
--FILE--
<?php
/* A non-static closure has a bound instance if it has a scope
- * and does't have an instance if it has no scope */
+ * and doesn't have an instance if it has no scope */
$nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };
diff --git a/Zend/tests/traits/bugs/overridding-conflicting-methods.phpt b/Zend/tests/traits/bugs/overridding-conflicting-methods.phpt
index fc09a367bd..0bbea11005 100644
--- a/Zend/tests/traits/bugs/overridding-conflicting-methods.phpt
+++ b/Zend/tests/traits/bugs/overridding-conflicting-methods.phpt
@@ -1,5 +1,5 @@
--TEST--
-Overridding Conflicting Methods should not result in a notice/warning about collisions
+Overriding Conflicting Methods should not result in a notice/warning about collisions
--FILE--
<?php
error_reporting(E_ALL);
diff --git a/Zend/zend.c b/Zend/zend.c
index fc443d95b9..162922866b 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1091,17 +1091,19 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
error_filename = "Unknown";
}
- va_start(args, format);
-
#ifdef HAVE_DTRACE
if(DTRACE_ERROR_ENABLED()) {
char *dtrace_error_buffer;
+ va_start(args, format);
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
- DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
+ DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
efree(dtrace_error_buffer);
+ va_end(args);
}
#endif /* HAVE_DTRACE */
+ va_start(args, format);
+
/* if we don't have a user defined error handler */
if (!EG(user_error_handler)
|| !(EG(user_error_handler_error_reporting) & type)
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 90d27b7987..125a1a2564 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2514,7 +2514,12 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
char *lcname = zend_str_tolower_dup(name, name_len);
int ret;
- ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
+ if (lcname[0] == '\\') {
+ ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL);
+ } else {
+ ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
+ }
+
efree(lcname);
if (ret == SUCCESS) {
ce->refcount++;
@@ -3917,15 +3922,16 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
{
zend_trait_alias *alias, **alias_ptr;
- alias_ptr = ce->trait_aliases;
- alias = *alias_ptr;
- while (alias) {
- if (alias->alias_len == len &&
- !strncasecmp(name, alias->alias, alias->alias_len)) {
- return alias->alias;
- }
- alias_ptr++;
+ if ((alias_ptr = ce->trait_aliases)) {
alias = *alias_ptr;
+ while (alias) {
+ if (alias->alias_len == len &&
+ !strncasecmp(name, alias->alias, alias->alias_len)) {
+ return alias->alias;
+ }
+ alias_ptr++;
+ alias = *alias_ptr;
+ }
}
return name;
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f29676bac0..04f4ebec26 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1399,15 +1399,8 @@ ZEND_FUNCTION(class_alias)
return;
}
- if (!autoload) {
- lc_name = do_alloca(class_name_len + 1, use_heap);
- zend_str_tolower_copy(lc_name, class_name, class_name_len);
+ found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC);
- found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
- free_alloca(lc_name, use_heap);
- } else {
- found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC);
- }
if (found == SUCCESS) {
if ((*ce)->type == ZEND_USER_CLASS) {
if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) {
@@ -1926,6 +1919,11 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
zval *name_array = (zval *)arg;
zval *const_val;
+ if (!constant->name) {
+ /* skip special constants */
+ return 0;
+ }
+
MAKE_STD_ZVAL(const_val);
*const_val = constant->value;
zval_copy_ctor(const_val);
@@ -1993,11 +1991,16 @@ ZEND_FUNCTION(get_defined_constants)
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
zval *const_val;
+ if (!val->name) {
+ /* skip special constants */
+ goto next_constant;
+ }
+
if (val->module_number == PHP_USER_CONSTANT) {
module_number = i;
} else if (val->module_number > i || val->module_number < 0) {
/* should not happen */
- goto bad_module_id;
+ goto next_constant;
} else {
module_number = val->module_number;
}
@@ -2014,7 +2017,7 @@ ZEND_FUNCTION(get_defined_constants)
INIT_PZVAL(const_val);
add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
-bad_module_id:
+next_constant:
zend_hash_move_forward_ex(EG(zend_constants), &pos);
}
efree(module_names);
@@ -2386,7 +2389,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
MAKE_STD_ZVAL(arg_array);
array_init(arg_array);
- /* include_filename always points to the last filename of the last last called-fuction.
+ /* include_filename always points to the last filename of the last last called-function.
if we have called include in the frame above - this is the file we have included.
*/
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 433a1902eb..326d4ef976 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1723,7 +1723,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
}
{
- /* Push a seperator to the switch and foreach stacks */
+ /* Push a separator to the switch and foreach stacks */
zend_switch_entry switch_entry;
switch_entry.cond.op_type = IS_UNUSED;
@@ -1817,7 +1817,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
CG(active_op_array) = function_token->u.op_array;
- /* Pop the switch and foreach seperators */
+ /* Pop the switch and foreach separators */
zend_stack_del_top(&CG(switch_cond_stack));
zend_stack_del_top(&CG(foreach_copy_stack));
}
@@ -2584,7 +2584,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
{
zend_op *opline;
- /* If we reach the seperator then stop applying the stack */
+ /* If we reach the separator then stop applying the stack */
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
return 1;
}
@@ -3911,7 +3911,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/** With the other traits, we are more permissive.
We do not give errors for those. This allows to be more
defensive in such definitions.
- However, we want to make sure that the insteadof declartion
+ However, we want to make sure that the insteadof declaration
is consistent in itself.
*/
j = 0;
diff --git a/Zend/zend_dtrace.c b/Zend/zend_dtrace.c
index 5b2d0d2dfe..65c0193850 100644
--- a/Zend/zend_dtrace.c
+++ b/Zend/zend_dtrace.c
@@ -24,7 +24,7 @@
#ifdef HAVE_DTRACE
/* PHP DTrace probes {{{ */
-static inline char *dtrace_get_executed_filename(TSRMLS_D)
+static inline const char *dtrace_get_executed_filename(TSRMLS_D)
{
if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
return EG(current_execute_data)->op_array->filename;
@@ -36,9 +36,9 @@ static inline char *dtrace_get_executed_filename(TSRMLS_D)
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
zend_op_array *res;
- DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
+ DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
res = compile_file(file_handle, type TSRMLS_CC);
- DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
+ DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
return res;
}
@@ -47,7 +47,7 @@ ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int t
ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
{
int lineno;
- char *scope, *filename, *funcname, *classname;
+ const char *scope, *filename, *funcname, *classname;
scope = filename = funcname = classname = NULL;
/* we need filename and lineno for both execute and function probes */
@@ -58,48 +58,46 @@ ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
}
if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
- filename = dtrace_get_executed_filename(TSRMLS_C);
classname = get_active_class_name(&scope TSRMLS_CC);
funcname = get_active_function_name(TSRMLS_C);
- lineno = zend_get_executed_lineno(TSRMLS_C);
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
- DTRACE_EXECUTE_ENTRY(filename, lineno);
+ DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
}
if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
- DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
+ DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
}
execute(op_array TSRMLS_CC);
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
- DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
+ DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
}
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
- DTRACE_EXECUTE_RETURN(filename, lineno);
+ DTRACE_EXECUTE_RETURN((char *)filename, lineno);
}
}
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
{
int lineno;
- char *filename;
+ const char *filename;
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
- DTRACE_EXECUTE_ENTRY(filename, lineno);
+ DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
}
execute_internal(execute_data_ptr, return_value_used TSRMLS_CC);
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
- DTRACE_EXECUTE_RETURN(filename, lineno);
+ DTRACE_EXECUTE_RETURN((char *)filename, lineno);
}
}
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index f07c1135f0..14ae75e38d 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -85,12 +85,12 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
- char *classname;
- int name_len;
+ const char *classname;
+ zend_uint name_len;
if (exception != NULL) {
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
- DTRACE_EXCEPTION_THROWN(classname);
+ DTRACE_EXCEPTION_THROWN((char *)classname);
} else {
DTRACE_EXCEPTION_THROWN(NULL);
}
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 9bffe9eff8..6fa7e9bafb 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1072,7 +1072,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
}
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
- * (doesn't impact fuctionality of __autoload()
+ * (doesn't impact functionality of __autoload()
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!key) {
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 58392c199b..646e9c9a60 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -306,7 +306,7 @@ struct _zend_php_scanner_globals {
unsigned char *script_filtered;
size_t script_filtered_size;
- /* input/ouput filters */
+ /* input/output filters */
zend_encoding_filter input_filter;
zend_encoding_filter output_filter;
const zend_encoding *script_encoding;
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 1f5d73296f..bf48bb73d9 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -41,17 +41,19 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
#define YYERROR_VERBOSE
#define YYSTYPE znode
-#ifdef ZTS
-# define YYPARSE_PARAM tsrm_ls
-# define YYLEX_PARAM tsrm_ls
-#endif
-
%}
%pure_parser
%expect 3
+%code requires {
+#ifdef ZTS
+# define YYPARSE_PARAM tsrm_ls
+# define YYLEX_PARAM tsrm_ls
+#endif
+}
+
%token END 0 "end of file"
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
%token T_INCLUDE "include (T_INCLUDE)"
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index 826ad7aba6..704547825a 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -44,7 +44,7 @@ typedef struct _zend_lex_state {
unsigned char *script_filtered;
size_t script_filtered_size;
- /* input/ouput filters */
+ /* input/output filters */
zend_encoding_filter input_filter;
zend_encoding_filter output_filter;
const zend_encoding *script_encoding;
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index 1fe5d0c199..b5dd48f798 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -57,6 +57,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
obj->dtor(obj->object, i TSRMLS_CC);
obj = &objects->object_buckets[i].bucket.obj;
obj->refcount--;
+
+ if (obj->refcount == 0) {
+ /* in case gc_collect_cycle is triggered before free_storage */
+ GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
+ }
}
}
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 7346078fb3..f6c6e6ac58 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2910,9 +2910,12 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
- retval_ptr = *retval_ptr_ptr;
- *EG(return_value_ptr_ptr) = retval_ptr;
- Z_ADDREF_P(retval_ptr);
+ zval *ret;
+
+ ALLOC_ZVAL(ret);
+ INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
+ zval_copy_ctor(ret);
+ *EG(return_value_ptr_ptr) = ret;
}
break;
}
@@ -2981,7 +2984,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
- DTRACE_EXCEPTION_CAUGHT(ce->name);
+ DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
}
#endif /* HAVE_DTRACE */
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 6e466e40b1..64d4320f9a 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2324,9 +2324,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
- retval_ptr = *retval_ptr_ptr;
- *EG(return_value_ptr_ptr) = retval_ptr;
- Z_ADDREF_P(retval_ptr);
+ zval *ret;
+
+ ALLOC_ZVAL(ret);
+ INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
+ zval_copy_ctor(ret);
+ *EG(return_value_ptr_ptr) = ret;
}
break;
}
@@ -6276,7 +6279,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
- DTRACE_EXCEPTION_CAUGHT(ce->name);
+ DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
}
#endif /* HAVE_DTRACE */
@@ -6743,9 +6746,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
- retval_ptr = *retval_ptr_ptr;
- *EG(return_value_ptr_ptr) = retval_ptr;
- Z_ADDREF_P(retval_ptr);
+ zval *ret;
+
+ ALLOC_ZVAL(ret);
+ INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
+ zval_copy_ctor(ret);
+ *EG(return_value_ptr_ptr) = ret;
}
break;
}
@@ -11055,9 +11061,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
- retval_ptr = *retval_ptr_ptr;
- *EG(return_value_ptr_ptr) = retval_ptr;
- Z_ADDREF_P(retval_ptr);
+ zval *ret;
+
+ ALLOC_ZVAL(ret);
+ INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
+ zval_copy_ctor(ret);
+ *EG(return_value_ptr_ptr) = ret;
}
break;
}
@@ -27030,9 +27039,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
- retval_ptr = *retval_ptr_ptr;
- *EG(return_value_ptr_ptr) = retval_ptr;
- Z_ADDREF_P(retval_ptr);
+ zval *ret;
+
+ ALLOC_ZVAL(ret);
+ INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
+ zval_copy_ctor(ret);
+ *EG(return_value_ptr_ptr) = ret;
}
break;
}
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 97dc0e8bed..d2f51925dc 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -1417,7 +1417,7 @@ for ($i = 1; $i < $argc; $i++) {
// Disabling code for old-style executor
define("ZEND_VM_OLD_EXECUTOR", 1);
} else if ($argv[$i] == "--with-lines") {
- // Enabling debuging using original zend_vm_def.h
+ // Enabling debugging using original zend_vm_def.h
define("ZEND_VM_LINES", 1);
} else if ($argv[$i] == "--help") {
usage();
diff --git a/acinclude.m4 b/acinclude.m4
index d5912ad101..448659f920 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2925,14 +2925,17 @@ dnl providerdesc
dnl header-file
ac_hdrobj=$2
-dnl Add providerdesc.o into global objects when needed
+dnl Add providerdesc.o or .lo into global objects when needed
case $host_alias in
*freebsd*)
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
;;
*solaris*)
- PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
+ PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
+ ;;
+ *linux*)
+ PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
;;
esac
@@ -2959,15 +2962,53 @@ dnl DTrace objects
esac
dnl Generate Makefile.objects entries
+dnl The empty $ac_provsrc command stops an implicit circular dependency
+dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
cat>>Makefile.objects<<EOF
+$abs_srcdir/$ac_provsrc:;
+
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
- dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && \$(SED) -ibak 's,PHP_,DTRACE_,g' \$[]@
+ CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
+EOF
+
+ case $host_alias in
+ *solaris*|*linux*)
+ dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
+ dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
+ dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
+ dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
+ for ac_lo in $PHP_DTRACE_OBJS; do
+ dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
+ done;
+dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
+ cat>>Makefile.objects<<EOF
+$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
+ echo "[#] Generated by Makefile for libtool" > \$[]@
+ @test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
+ if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
+ echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
+ else [\\]
+ echo "pic_object='none'" >> \$[]@ [;\\]
+ fi
+ if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
+ echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
+ else [\\]
+ echo "non_pic_object='none'" >> \$[]@ [;\\]
+ fi
+
+EOF
+
+ ;;
+ *)
+cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
- dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
+ CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
EOF
+ ;;
+ esac
])
diff --git a/build/libtool.m4 b/build/libtool.m4
index 268cad9d3e..77735d36b3 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -1230,7 +1230,7 @@ if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
- # We can hardcode non-existant directories.
+ # We can hardcode non-existent directories.
if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
diff --git a/configure.in b/configure.in
index ed02926b55..30de2c3aaa 100644
--- a/configure.in
+++ b/configure.in
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
-PHP_RELEASE_VERSION=18
+PHP_RELEASE_VERSION=21
PHP_EXTRA_VERSION="-dev"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
@@ -1582,7 +1582,7 @@ cat <<X
| see the file debug.log for error messages. |
| |
| If you are unable to fix this, send the file debug.log to the |
-| php-install@lists.php.net mailing list and include appropiate |
+| php-install@lists.php.net mailing list and include appropriate |
| information about your setup. |
X
fi
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 531f15ba15..d122051ade 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1068,7 +1068,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
{
php_curl *ch = (php_curl *) clientp;
php_curl_progress *t = ch->handlers->progress;
- int length = -1;
size_t rval = 0;
#if PHP_CURL_DEBUG
@@ -1118,7 +1117,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
ch->in_callback = 0;
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
- length = -1;
} else if (retval_ptr) {
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
@@ -1373,9 +1371,9 @@ static void curl_free_post(void **post)
/* {{{ curl_free_slist
*/
-static void curl_free_slist(void **slist)
+static void curl_free_slist(void *slist)
{
- curl_slist_free_all((struct curl_slist *) *slist);
+ curl_slist_free_all(*((struct curl_slist **) slist));
}
/* }}} */
@@ -1443,8 +1441,10 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->read->stream = NULL;
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
+
+ (*ch)->to_free->slist = emalloc(sizeof(HashTable));
+ zend_hash_init((*ch)->to_free->slist, 4, NULL, curl_free_slist, 0);
}
/* }}} */
@@ -1675,6 +1675,7 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
curl_easy_setopt(dupch->cp, CURLOPT_PROGRESSDATA, (void *) dupch);
+ efree(dupch->to_free->slist);
efree(dupch->to_free);
dupch->to_free = ch->to_free;
@@ -2184,7 +2185,7 @@ string_copy:
return 1;
}
}
- zend_llist_add_element(&ch->to_free->slist, &slist);
+ zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
error = curl_easy_setopt(ch->cp, option, slist);
@@ -2680,8 +2681,9 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
/* cURL destructors should be invoked only by last curl handle */
if (Z_REFCOUNT_P(ch->clone) <= 1) {
zend_llist_clean(&ch->to_free->str);
- zend_llist_clean(&ch->to_free->slist);
zend_llist_clean(&ch->to_free->post);
+ zend_hash_destroy(ch->to_free->slist);
+ efree(ch->to_free->slist);
efree(ch->to_free);
FREE_ZVAL(ch->clone);
} else {
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 945f0a4307..911d87a6b4 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -126,7 +126,7 @@ struct _php_curl_send_headers {
struct _php_curl_free {
zend_llist str;
zend_llist post;
- zend_llist slist;
+ HashTable *slist;
};
typedef struct {
diff --git a/ext/curl/tests/bug65458.phpt b/ext/curl/tests/bug65458.phpt
new file mode 100644
index 0000000000..99288f24be
--- /dev/null
+++ b/ext/curl/tests/bug65458.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #65458 (curl memory leak)
+--SKIPIF--
+<?php
+if (!extension_loaded('curl')) exit("skip curl extension not loaded");
+?>
+--FILE--
+<?php
+$ch = curl_init();
+$init = memory_get_usage();
+for ($i = 0; $i < 10000; $i++) {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
+}
+
+$preclose = memory_get_usage();
+curl_close($ch);
+
+// This is a slightly tricky heuristic, but basically, we want to ensure
+// $preclose - $init has a delta in the order of bytes, not megabytes. Given
+// the number of iterations in the loop, if we're wasting memory here, we
+// should have megs and megs of extra allocations.
+var_dump(($preclose - $init) < 10000);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 5d43efe1e3..f510a665e8 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */
+/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -651,7 +651,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
- while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
+ while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
+ **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
++*ptr;
}
end = *ptr;
@@ -871,11 +872,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
-#line 997 "ext/date/lib/parse_date.re"
+#line 998 "ext/date/lib/parse_date.re"
-#line 879 "ext/date/lib/parse_date.c"
+#line 880 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -995,7 +996,7 @@ std:
}
yy2:
YYDEBUG(2, *YYCURSOR);
-#line 1083 "ext/date/lib/parse_date.re"
+#line 1084 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -1011,7 +1012,7 @@ yy2:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 1015 "ext/date/lib/parse_date.c"
+#line 1016 "ext/date/lib/parse_date.c"
yy3:
YYDEBUG(3, *YYCURSOR);
++YYCURSOR;
@@ -1034,7 +1035,7 @@ yy3:
}
yy4:
YYDEBUG(4, *YYCURSOR);
-#line 1677 "ext/date/lib/parse_date.re"
+#line 1678 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1047,7 +1048,7 @@ yy4:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 1051 "ext/date/lib/parse_date.c"
+#line 1052 "ext/date/lib/parse_date.c"
yy5:
YYDEBUG(5, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1358,12 +1359,12 @@ yy12:
if (yych <= '9') goto yy1385;
yy13:
YYDEBUG(13, *YYCURSOR);
-#line 1772 "ext/date/lib/parse_date.re"
+#line 1773 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
-#line 1367 "ext/date/lib/parse_date.c"
+#line 1368 "ext/date/lib/parse_date.c"
yy14:
YYDEBUG(14, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2420,11 +2421,11 @@ yy49:
if (yych <= '9') goto yy55;
yy50:
YYDEBUG(50, *YYCURSOR);
-#line 1761 "ext/date/lib/parse_date.re"
+#line 1762 "ext/date/lib/parse_date.re"
{
goto std;
}
-#line 2428 "ext/date/lib/parse_date.c"
+#line 2429 "ext/date/lib/parse_date.c"
yy51:
YYDEBUG(51, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2433,12 +2434,12 @@ yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
YYDEBUG(53, *YYCURSOR);
-#line 1766 "ext/date/lib/parse_date.re"
+#line 1767 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 2442 "ext/date/lib/parse_date.c"
+#line 2443 "ext/date/lib/parse_date.c"
yy54:
YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2825,7 +2826,7 @@ yy72:
if (yych == 's') goto yy74;
yy73:
YYDEBUG(73, *YYCURSOR);
-#line 1745 "ext/date/lib/parse_date.re"
+#line 1746 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2840,7 +2841,7 @@ yy73:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2844 "ext/date/lib/parse_date.c"
+#line 2845 "ext/date/lib/parse_date.c"
yy74:
YYDEBUG(74, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3602,7 +3603,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
-#line 1608 "ext/date/lib/parse_date.re"
+#line 1609 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3619,7 +3620,7 @@ yy167:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
-#line 3623 "ext/date/lib/parse_date.c"
+#line 3624 "ext/date/lib/parse_date.c"
yy168:
YYDEBUG(168, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4139,7 +4140,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
-#line 1667 "ext/date/lib/parse_date.re"
+#line 1668 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4148,7 +4149,7 @@ yy194:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4152 "ext/date/lib/parse_date.c"
+#line 4153 "ext/date/lib/parse_date.c"
yy195:
YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
@@ -4199,7 +4200,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
-#line 1413 "ext/date/lib/parse_date.re"
+#line 1414 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4212,7 +4213,7 @@ yy199:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4216 "ext/date/lib/parse_date.c"
+#line 4217 "ext/date/lib/parse_date.c"
yy200:
YYDEBUG(200, *YYCURSOR);
yyaccept = 6;
@@ -4481,7 +4482,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
-#line 1715 "ext/date/lib/parse_date.re"
+#line 1716 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4510,7 +4511,7 @@ yy223:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 4514 "ext/date/lib/parse_date.c"
+#line 4515 "ext/date/lib/parse_date.c"
yy224:
YYDEBUG(224, *YYCURSOR);
yyaccept = 7;
@@ -5208,7 +5209,7 @@ yy278:
YYDEBUG(278, *YYCURSOR);
++YYCURSOR;
YYDEBUG(279, *YYCURSOR);
-#line 1691 "ext/date/lib/parse_date.re"
+#line 1692 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5231,7 +5232,7 @@ yy278:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 5235 "ext/date/lib/parse_date.c"
+#line 5236 "ext/date/lib/parse_date.c"
yy280:
YYDEBUG(280, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5409,7 +5410,7 @@ yy294:
++YYCURSOR;
yy295:
YYDEBUG(295, *YYCURSOR);
-#line 1385 "ext/date/lib/parse_date.re"
+#line 1386 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5422,7 +5423,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 5426 "ext/date/lib/parse_date.c"
+#line 5427 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6642,7 +6643,7 @@ yy362:
if (yych <= '9') goto yy365;
yy364:
YYDEBUG(364, *YYCURSOR);
-#line 1529 "ext/date/lib/parse_date.re"
+#line 1530 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6655,7 +6656,7 @@ yy364:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 6659 "ext/date/lib/parse_date.c"
+#line 6660 "ext/date/lib/parse_date.c"
yy365:
YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7293,7 +7294,7 @@ yy392:
}
yy393:
YYDEBUG(393, *YYCURSOR);
-#line 1587 "ext/date/lib/parse_date.re"
+#line 1588 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7313,7 +7314,7 @@ yy393:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 7317 "ext/date/lib/parse_date.c"
+#line 7318 "ext/date/lib/parse_date.c"
yy394:
YYDEBUG(394, *YYCURSOR);
yyaccept = 5;
@@ -9063,7 +9064,7 @@ yy454:
++YYCURSOR;
yy455:
YYDEBUG(455, *YYCURSOR);
-#line 1290 "ext/date/lib/parse_date.re"
+#line 1291 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -9074,7 +9075,7 @@ yy455:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 9078 "ext/date/lib/parse_date.c"
+#line 9079 "ext/date/lib/parse_date.c"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 0;
@@ -9634,7 +9635,7 @@ yy475:
}
yy476:
YYDEBUG(476, *YYCURSOR);
-#line 1427 "ext/date/lib/parse_date.re"
+#line 1428 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9645,7 +9646,7 @@ yy476:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 9649 "ext/date/lib/parse_date.c"
+#line 9650 "ext/date/lib/parse_date.c"
yy477:
YYDEBUG(477, *YYCURSOR);
yyaccept = 10;
@@ -9786,7 +9787,7 @@ yy488:
YYDEBUG(488, *YYCURSOR);
++YYCURSOR;
YYDEBUG(489, *YYCURSOR);
-#line 1145 "ext/date/lib/parse_date.re"
+#line 1146 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9802,7 +9803,7 @@ yy488:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 9806 "ext/date/lib/parse_date.c"
+#line 9807 "ext/date/lib/parse_date.c"
yy490:
YYDEBUG(490, *YYCURSOR);
yyaccept = 11;
@@ -9815,7 +9816,7 @@ yy490:
}
yy491:
YYDEBUG(491, *YYCURSOR);
-#line 1182 "ext/date/lib/parse_date.re"
+#line 1183 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9840,7 +9841,7 @@ yy491:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 9844 "ext/date/lib/parse_date.c"
+#line 9845 "ext/date/lib/parse_date.c"
yy492:
YYDEBUG(492, *YYCURSOR);
yyaccept = 11;
@@ -10150,7 +10151,7 @@ yy523:
YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
YYDEBUG(524, *YYCURSOR);
-#line 1162 "ext/date/lib/parse_date.re"
+#line 1163 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10169,7 +10170,7 @@ yy523:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 10173 "ext/date/lib/parse_date.c"
+#line 10174 "ext/date/lib/parse_date.c"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 11;
@@ -10275,7 +10276,7 @@ yy534:
if (yych <= '9') goto yy541;
yy535:
YYDEBUG(535, *YYCURSOR);
-#line 1344 "ext/date/lib/parse_date.re"
+#line 1345 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10289,7 +10290,7 @@ yy535:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 10293 "ext/date/lib/parse_date.c"
+#line 10294 "ext/date/lib/parse_date.c"
yy536:
YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11026,7 +11027,7 @@ yy605:
YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
YYDEBUG(607, *YYCURSOR);
-#line 1359 "ext/date/lib/parse_date.re"
+#line 1360 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11037,7 +11038,7 @@ yy605:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 11041 "ext/date/lib/parse_date.c"
+#line 11042 "ext/date/lib/parse_date.c"
yy608:
YYDEBUG(608, *YYCURSOR);
yyaccept = 11;
@@ -11073,7 +11074,7 @@ yy611:
if (yych <= '9') goto yy605;
yy612:
YYDEBUG(612, *YYCURSOR);
-#line 1371 "ext/date/lib/parse_date.re"
+#line 1372 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11086,7 +11087,7 @@ yy612:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 11090 "ext/date/lib/parse_date.c"
+#line 11091 "ext/date/lib/parse_date.c"
yy613:
YYDEBUG(613, *YYCURSOR);
yyaccept = 11;
@@ -11727,7 +11728,7 @@ yy656:
}
yy657:
YYDEBUG(657, *YYCURSOR);
-#line 1330 "ext/date/lib/parse_date.re"
+#line 1331 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11740,7 +11741,7 @@ yy657:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 11744 "ext/date/lib/parse_date.c"
+#line 11745 "ext/date/lib/parse_date.c"
yy658:
YYDEBUG(658, *YYCURSOR);
yyaccept = 13;
@@ -11846,7 +11847,7 @@ yy666:
}
yy667:
YYDEBUG(667, *YYCURSOR);
-#line 1274 "ext/date/lib/parse_date.re"
+#line 1275 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11861,7 +11862,7 @@ yy667:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 11865 "ext/date/lib/parse_date.c"
+#line 11866 "ext/date/lib/parse_date.c"
yy668:
YYDEBUG(668, *YYCURSOR);
yyaccept = 14;
@@ -12094,7 +12095,7 @@ yy700:
if (yych <= ':') goto yy704;
yy701:
YYDEBUG(701, *YYCURSOR);
-#line 1557 "ext/date/lib/parse_date.re"
+#line 1558 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12114,7 +12115,7 @@ yy701:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 12118 "ext/date/lib/parse_date.c"
+#line 12119 "ext/date/lib/parse_date.c"
yy702:
YYDEBUG(702, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12666,7 +12667,7 @@ yy763:
}
yy764:
YYDEBUG(764, *YYCURSOR);
-#line 1302 "ext/date/lib/parse_date.re"
+#line 1303 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12679,7 +12680,7 @@ yy764:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 12683 "ext/date/lib/parse_date.c"
+#line 12684 "ext/date/lib/parse_date.c"
yy765:
YYDEBUG(765, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12718,7 +12719,7 @@ yy771:
YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
YYDEBUG(772, *YYCURSOR);
-#line 1543 "ext/date/lib/parse_date.re"
+#line 1544 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12731,7 +12732,7 @@ yy771:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 12735 "ext/date/lib/parse_date.c"
+#line 12736 "ext/date/lib/parse_date.c"
yy773:
YYDEBUG(773, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12869,7 +12870,7 @@ yy783:
}
yy784:
YYDEBUG(784, *YYCURSOR);
-#line 1578 "ext/date/lib/parse_date.re"
+#line 1579 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12877,7 +12878,7 @@ yy784:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 12881 "ext/date/lib/parse_date.c"
+#line 12882 "ext/date/lib/parse_date.c"
yy785:
YYDEBUG(785, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13028,7 +13029,7 @@ yy793:
}
yy794:
YYDEBUG(794, *YYCURSOR);
-#line 1399 "ext/date/lib/parse_date.re"
+#line 1400 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13041,7 +13042,7 @@ yy794:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 13045 "ext/date/lib/parse_date.c"
+#line 13046 "ext/date/lib/parse_date.c"
yy795:
YYDEBUG(795, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13256,7 +13257,7 @@ yy814:
if (yych <= '7') goto yy817;
yy815:
YYDEBUG(815, *YYCURSOR);
-#line 1510 "ext/date/lib/parse_date.re"
+#line 1511 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13274,7 +13275,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 13278 "ext/date/lib/parse_date.c"
+#line 13279 "ext/date/lib/parse_date.c"
yy816:
YYDEBUG(816, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13284,7 +13285,7 @@ yy817:
YYDEBUG(817, *YYCURSOR);
++YYCURSOR;
YYDEBUG(818, *YYCURSOR);
-#line 1491 "ext/date/lib/parse_date.re"
+#line 1492 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13302,7 +13303,7 @@ yy817:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 13306 "ext/date/lib/parse_date.c"
+#line 13307 "ext/date/lib/parse_date.c"
yy819:
YYDEBUG(819, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13366,7 +13367,7 @@ yy821:
}
yy822:
YYDEBUG(822, *YYCURSOR);
-#line 1477 "ext/date/lib/parse_date.re"
+#line 1478 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13379,7 +13380,7 @@ yy822:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 13383 "ext/date/lib/parse_date.c"
+#line 13384 "ext/date/lib/parse_date.c"
yy823:
YYDEBUG(823, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13482,7 +13483,7 @@ yy842:
++YYCURSOR;
yy843:
YYDEBUG(843, *YYCURSOR);
-#line 1451 "ext/date/lib/parse_date.re"
+#line 1452 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13507,7 +13508,7 @@ yy843:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 13511 "ext/date/lib/parse_date.c"
+#line 13512 "ext/date/lib/parse_date.c"
yy844:
YYDEBUG(844, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13769,7 +13770,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
-#line 1439 "ext/date/lib/parse_date.re"
+#line 1440 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13780,7 +13781,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 13784 "ext/date/lib/parse_date.c"
+#line 13785 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14700,7 +14701,7 @@ yy973:
if (yych <= '9') goto yy996;
yy974:
YYDEBUG(974, *YYCURSOR);
-#line 1316 "ext/date/lib/parse_date.re"
+#line 1317 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14713,7 +14714,7 @@ yy974:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 14717 "ext/date/lib/parse_date.c"
+#line 14718 "ext/date/lib/parse_date.c"
yy975:
YYDEBUG(975, *YYCURSOR);
yyaccept = 22;
@@ -15722,7 +15723,7 @@ yy1066:
}
yy1068:
YYDEBUG(1068, *YYCURSOR);
-#line 1208 "ext/date/lib/parse_date.re"
+#line 1209 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15744,7 +15745,7 @@ yy1068:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 15748 "ext/date/lib/parse_date.c"
+#line 15749 "ext/date/lib/parse_date.c"
yy1069:
YYDEBUG(1069, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15836,7 +15837,7 @@ yy1075:
}
yy1076:
YYDEBUG(1076, *YYCURSOR);
-#line 1254 "ext/date/lib/parse_date.re"
+#line 1255 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15855,7 +15856,7 @@ yy1076:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 15859 "ext/date/lib/parse_date.c"
+#line 15860 "ext/date/lib/parse_date.c"
yy1077:
YYDEBUG(1077, *YYCURSOR);
yyaccept = 25;
@@ -16753,7 +16754,7 @@ yy1117:
}
yy1118:
YYDEBUG(1118, *YYCURSOR);
-#line 1650 "ext/date/lib/parse_date.re"
+#line 1651 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16769,7 +16770,7 @@ yy1118:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16773 "ext/date/lib/parse_date.c"
+#line 16774 "ext/date/lib/parse_date.c"
yy1119:
YYDEBUG(1119, *YYCURSOR);
++YYCURSOR;
@@ -16820,7 +16821,7 @@ yy1126:
YYDEBUG(1126, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1127, *YYCURSOR);
-#line 1123 "ext/date/lib/parse_date.re"
+#line 1124 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16841,7 +16842,7 @@ yy1126:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
-#line 16845 "ext/date/lib/parse_date.c"
+#line 16846 "ext/date/lib/parse_date.c"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yyaccept = 26;
@@ -16949,7 +16950,7 @@ yy1141:
}
yy1142:
YYDEBUG(1142, *YYCURSOR);
-#line 1626 "ext/date/lib/parse_date.re"
+#line 1627 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16972,7 +16973,7 @@ yy1142:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16976 "ext/date/lib/parse_date.c"
+#line 16977 "ext/date/lib/parse_date.c"
yy1143:
YYDEBUG(1143, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19649,7 +19650,7 @@ yy1294:
goto yy1298;
yy1295:
YYDEBUG(1295, *YYCURSOR);
-#line 1100 "ext/date/lib/parse_date.re"
+#line 1101 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19671,7 +19672,7 @@ yy1295:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 19675 "ext/date/lib/parse_date.c"
+#line 19676 "ext/date/lib/parse_date.c"
yy1296:
YYDEBUG(1296, *YYCURSOR);
yyaccept = 28;
@@ -21362,7 +21363,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
-#line 1057 "ext/date/lib/parse_date.re"
+#line 1058 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -21387,7 +21388,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21391 "ext/date/lib/parse_date.c"
+#line 21392 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21823,7 +21824,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
-#line 1045 "ext/date/lib/parse_date.re"
+#line 1046 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21834,7 +21835,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21838 "ext/date/lib/parse_date.c"
+#line 21839 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21869,7 +21870,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
-#line 1035 "ext/date/lib/parse_date.re"
+#line 1036 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21878,7 +21879,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21882 "ext/date/lib/parse_date.c"
+#line 21883 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23890,7 +23891,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
-#line 1014 "ext/date/lib/parse_date.re"
+#line 1015 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23898,7 +23899,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 23902 "ext/date/lib/parse_date.c"
+#line 23903 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24037,7 +24038,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
-#line 1023 "ext/date/lib/parse_date.re"
+#line 1024 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -24048,7 +24049,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24052 "ext/date/lib/parse_date.c"
+#line 24053 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24581,7 +24582,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
-#line 1002 "ext/date/lib/parse_date.re"
+#line 1003 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24592,7 +24593,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24596 "ext/date/lib/parse_date.c"
+#line 24597 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24765,7 +24766,7 @@ yy1537:
goto yy1531;
}
}
-#line 1776 "ext/date/lib/parse_date.re"
+#line 1777 "ext/date/lib/parse_date.re"
}
@@ -25035,7 +25036,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
- add_pbf_error(s, "A two second minute could not be found", string, begin);
+ add_pbf_error(s, "A two digit second could not be found", string, begin);
} else {
s->time->s = sec;
}
@@ -25123,7 +25124,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
- *fptr++;
+ fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 8e1972d99f..df33508f50 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -649,7 +649,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
- while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
+ while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
+ **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
++*ptr;
}
end = *ptr;
@@ -2042,7 +2043,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
- add_pbf_error(s, "A two second minute could not be found", string, begin);
+ add_pbf_error(s, "A two digit second could not be found", string, begin);
} else {
s->time->s = sec;
}
@@ -2130,7 +2131,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
- *fptr++;
+ fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index d1f9a7f8e3..70960b161f 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -997,7 +997,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
{
smart_str string = {0};
- int i, length;
+ int i, length = 0;
char buffer[97];
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
@@ -1352,7 +1352,7 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
}
/* }}} */
-/* {{{ php_parse_date: Backwards compability function */
+/* {{{ php_parse_date: Backwards compatibility function */
PHPAPI signed long php_parse_date(char *string, signed long *now)
{
timelib_time *parsed_time;
@@ -2113,13 +2113,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
/* first we add the date and time in ISO format */
MAKE_STD_ZVAL(zv);
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
- zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, dateobj->time->zone_type);
- zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
MAKE_STD_ZVAL(zv);
switch (dateobj->time->zone_type) {
@@ -2142,7 +2142,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
break;
}
- zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
}
return props;
@@ -2265,7 +2265,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
MAKE_STD_ZVAL(zv); \
ZVAL_LONG(zv, (long)intervalobj->diff->f); \
- zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
@@ -2282,7 +2282,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
} else {
MAKE_STD_ZVAL(zv);
ZVAL_FALSE(zv);
- zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
}
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
@@ -2409,8 +2409,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
timelib_time *now;
timelib_tzinfo *tzi = NULL;
timelib_error_container *err = NULL;
- int type = TIMELIB_ZONETYPE_ID, new_dst;
- char *new_abbr;
+ int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
+ char *new_abbr = NULL;
timelib_sll new_offset;
if (dateobj->time) {
@@ -3568,7 +3568,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
ALLOC_INIT_ZVAL(retval);
Z_SET_REFCOUNT_P(retval, 0);
- ZVAL_LONG(retval, value);
+ if (value != -99999) {
+ ZVAL_LONG(retval, value);
+ } else {
+ ZVAL_FALSE(retval);
+ }
if (member == &tmp_member) {
zval_dtor(member);
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index 806c27ac5b..be0df38b69 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -165,7 +165,7 @@ ZEND_END_MODULE_GLOBALS(date)
#define DATEG(v) (date_globals.v)
#endif
-/* Backwards compability wrapper */
+/* Backwards compatibility wrapper */
PHPAPI signed long php_parse_date(char *string, signed long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
diff --git a/ext/date/tests/DateInterval_days_prop1.phpt b/ext/date/tests/DateInterval_days_prop1.phpt
new file mode 100644
index 0000000000..627b8f0b27
--- /dev/null
+++ b/ext/date/tests/DateInterval_days_prop1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Wrong var_dump(DateInterval->days) value
+--FILE--
+<?php
+
+$interval = new DateInterval('P2Y4DT6H8M');
+
+var_dump($interval->days);
+--EXPECT--
+bool(false)
diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt
new file mode 100644
index 0000000000..abde292775
--- /dev/null
+++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test fix for DateTime when date have textual day with dot or other special char at end
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+// Create a DateTime object..
+$orig = new DateTime('2012-11-29 17:00:00');
+
+// String to parse
+$string = "Thu., Nov. 29, 2012 5:00PM";
+
+// Create a DateTime object from format
+$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
+
+echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
+echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+Format method: Thu., Nov. 29, 2012 5:00PM
+createFromFormat method: Thu., Nov. 29, 2012 5:00PM
+===DONE===
diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt
index 13778a00b2..7c9bbb01c1 100644
--- a/ext/date/tests/bug55397.phpt
+++ b/ext/date/tests/bug55397.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV)
+Bug #55397 (comparison of incomplete DateTime causes SIGSEGV)
--INI--
--FILE--
<?php
diff --git a/ext/date/tests/bug64157.phpt b/ext/date/tests/bug64157.phpt
new file mode 100644
index 0000000000..fb71495430
--- /dev/null
+++ b/ext/date/tests/bug64157.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test for bug #64157: DateTime::createFromFormat() reports confusing error message
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+DateTime::createFromFormat('s', '0');
+$lastErrors = DateTime::getLastErrors();
+print_r($lastErrors['errors'][0]);
+?>
+--EXPECT--
+A two digit second could not be found
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 303d65c33b..50a94dd2ad 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -226,12 +226,17 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
*key_free = *key_str;
return len;
} else {
- *key_free = NULL;
+ zval tmp = *key;
+ int len;
- convert_to_string(key);
- *key_str = Z_STRVAL_P(key);
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
- return Z_STRLEN_P(key);
+ *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
+ len = Z_STRLEN(tmp);
+
+ zval_dtor(&tmp);
+ return len;
}
}
/* }}} */
@@ -297,6 +302,14 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
RETURN_FALSE; \
}
+/* the same check, but with a call to DBA_ID_DONE before returning */
+#define DBA_WRITE_CHECK_WITH_ID \
+ if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \
+ DBA_ID_DONE; \
+ RETURN_FALSE; \
+ }
+
/* }}} */
/* {{{ globals */
@@ -538,7 +551,6 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
- char *v;
int val_len;
zval *id;
dba_info *info = NULL;
@@ -558,7 +570,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
DBA_FETCH_RESOURCE(info, &id);
- DBA_WRITE_CHECK;
+ DBA_WRITE_CHECK_WITH_ID;
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
DBA_ID_DONE;
@@ -889,7 +901,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETURN_FALSE;
}
if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) {
- /* Needed becasue some systems do not allow to write to the original
+ /* Needed because some systems do not allow to write to the original
* file contents with O_APPEND being set.
*/
if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) {
@@ -1111,7 +1123,7 @@ PHP_FUNCTION(dba_delete)
{
DBA_ID_GET2;
- DBA_WRITE_CHECK;
+ DBA_WRITE_CHECK_WITH_ID;
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
{
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index 89373b1e33..3cd97702b3 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -460,7 +460,7 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
*/
static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
{
- size_t pos_grp_start, pos_grp_next;
+ size_t pos_grp_start = 0, pos_grp_next;
inifile *ini_tmp = NULL;
php_stream *fp_tmp = NULL;
int ret;
diff --git a/ext/dba/tests/bug65708.phpt b/ext/dba/tests/bug65708.phpt
new file mode 100644
index 0000000000..b77138f6ed
--- /dev/null
+++ b/ext/dba/tests/bug65708.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on write)
+--SKIPIF--
+<?php
+ require_once(dirname(__FILE__) .'/skipif.inc');
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+require_once(dirname(__FILE__) .'/test.inc');
+
+$db = dba_popen($db_filename, 'c');
+
+$key = 1;
+$copy = $key;
+
+echo gettype($key)."\n";
+echo gettype($copy)."\n";
+
+dba_exists($key, $db);
+
+echo gettype($key)."\n";
+echo gettype($copy)."\n";
+
+dba_close($db);
+
+?>
+--CLEAN--
+<?php
+ require(dirname(__FILE__) .'/clean.inc');
+?>
+--EXPECT--
+integer
+integer
+integer
+integer
diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt
index 33d7d20615..8ac3f6474d 100644
--- a/ext/dba/tests/dba_gdbm.phpt
+++ b/ext/dba/tests/dba_gdbm.phpt
@@ -12,7 +12,7 @@ DBA GDBM handler test
$lock_flag = ''; // lock in library
require_once dirname(__FILE__) .'/dba_handler.inc';
- // Read during write is system dependant. Important is that there is no deadlock
+ // Read during write is system dependent. Important is that there is no deadlock
?>
===DONE===
--EXPECTF--
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index c3b0ee0371..bd9c98756b 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1089,7 +1089,11 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
void dom_objects_free_storage(void *object TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
+#if defined(__GNUC__) && __GNUC__ >= 3
+ int retcount __attribute__((unused)); /* keep compiler quiet */
+#else
int retcount;
+#endif
zend_object_std_dtor(&intern->std TSRMLS_CC);
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
index d3f0658c1f..d5743bc6cf 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
@@ -1,5 +1,5 @@
--TEST--
-DomDocument::schemaValidate() - non-existant schema file
+DomDocument::schemaValidate() - non-existent schema file
--CREDITS--
Daniel Convissor <danielc@php.net>
# TestFest 2009 NYPHP
@@ -12,14 +12,14 @@ $doc = new DOMDocument;
$doc->load(dirname(__FILE__)."/book.xml");
-$result = $doc->schemaValidate(dirname(__FILE__)."/non-existant-file");
+$result = $doc->schemaValidate(dirname(__FILE__)."/non-existent-file");
var_dump($result);
?>
--EXPECTF--
-Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existant-file" in %s.php on line %d
+Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existent-file" in %s.php on line %d
-Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existant-file'. in %s.php on line %d
+Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existent-file'. in %s.php on line %d
Warning: DOMDocument::schemaValidate(): Invalid Schema in %s.php on line %d
bool(false)
diff --git a/ext/dom/tests/bug44648.phpt b/ext/dom/tests/bug44648.phpt
index d04f590aca..4ff7ac389c 100644
--- a/ext/dom/tests/bug44648.phpt
+++ b/ext/dom/tests/bug44648.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #44648 (Attribute names not checked for wellformedness)
+Bug #44648 (Attribute names not checked for well formedness)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index cf556a3505..d12ef30323 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
{
- zval **args;
+ zval **args = NULL;
zval *retval;
int result, i, ret;
int error = 0;
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 141192c67f..98b5c9fd87 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -674,7 +674,7 @@ PHP_FUNCTION(enchant_broker_dict_exists)
described/referred to by 'tag'. The ordering is a comma delimited
list of provider names. As a special exception, the "*" tag can
be used as a language tag to declare a default ordering for any
- language that does not explictly declare an ordering. */
+ language that does not explicitly declare an ordering. */
PHP_FUNCTION(enchant_broker_set_ordering)
{
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index c691075898..bd646d9adf 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -2595,7 +2595,7 @@ static int exif_process_string_raw(char **result, char *value, size_t byte_count
/* {{{ exif_process_string
* Copy a string in Exif header to a character string and return length of allocated buffer if any.
- * In contrast to exif_process_string this function does allways return a string buffer */
+ * In contrast to exif_process_string this function does always return a string buffer */
static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) {
/* we cannot use strlcpy - here the problem is that we cannot use strlen to
* determin length of string and we cannot use strlcpy with len=byte_count+1
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index 1e7dbf7449..0671fa99f9 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -1630,7 +1630,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
/* Verify we have enough data to match magic type */
switch (m->type) {
case FILE_BYTE:
- if (nbytes < (offset + 1)) /* should alway be true */
+ if (nbytes < (offset + 1)) /* should always be true */
return 0;
break;
diff --git a/ext/fileinfo/tests/magic b/ext/fileinfo/tests/magic
index 27bde927e6..aa75fb65bc 100644
--- a/ext/fileinfo/tests/magic
+++ b/ext/fileinfo/tests/magic
@@ -3303,7 +3303,7 @@
>>>0x44 string =GLOB \b.
>>>>0x60 beshort x \b%.4d
-# Scripts that run in the embeded Python interpreter
+# Scripts that run in the embedded Python interpreter
0 string #!BPY Blender3D BPython script
#------------------------------------------------------------------------------
@@ -11969,7 +11969,7 @@
#>65 string ZSYS (Pre-System 7 system file)
#>65 string acf3 (Aldus FreeHand)
#>65 string cdev (control panel)
-#>65 string dfil (Desk Acessory suitcase)
+#>65 string dfil (Desk Accessory suitcase)
#>65 string libr (library)
#>65 string nX^d (WriteNow word processor)
#>65 string nX^w (WriteNow dictionary)
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index 2aa8dd57d9..6496ccdb6a 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -241,7 +241,7 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 58d5870c11..14964883c1 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
s++;
}
-
- if (*(e - 1) == '.') {
- goto bad_url;
- }
}
if (
@@ -718,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
+ (ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
(ip[0] == 128 && ip[1] == 0) ||
(ip[0] == 191 && ip[1] == 255) ||
(ip[0] == 169 && ip[1] == 254) ||
diff --git a/ext/filter/tests/018.phpt b/ext/filter/tests/018.phpt
index af52b2e60d..9c73fc3cfc 100644
--- a/ext/filter/tests/018.phpt
+++ b/ext/filter/tests/018.phpt
@@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
@@ -40,6 +42,8 @@ bool(false)
string(12) "192.0.34.166"
bool(false)
string(9) "192.0.0.1"
+bool(false)
+bool(false)
string(12) "192.0.34.166"
bool(false)
string(15) "255.255.255.255"
diff --git a/ext/filter/tests/bug64441.phpt b/ext/filter/tests/bug64441.phpt
new file mode 100644
index 0000000000..149079ec05
--- /dev/null
+++ b/ext/filter/tests/bug64441.phpt
@@ -0,0 +1,11 @@
+--TEST--
+bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
+var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
+--EXPECT--
+string(20) "http://example.com./"
+string(19) "http://example.com/"
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index bde4792a14..0d6704f9d2 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -39,7 +39,7 @@
#ifdef PHP_WIN32
#include <winsock2.h>
#elif defined(NETWARE)
-#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
+#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), at least for now */
#include <novsock2.h>
#else
#include <sys/socket.h>
@@ -612,7 +612,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
/* {{{ ftp_alloc
*/
int
-ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
+ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
{
char buffer[64];
@@ -620,8 +620,8 @@ ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
return 0;
}
- snprintf(buffer, sizeof(buffer) - 1, "%d", size);
-
+ snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
+
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
return 0;
}
@@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
/* {{{ ftp_get
*/
int
-ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
+ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
int lastch;
@@ -808,11 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
ftp->data = data;
if (resumepos > 0) {
- if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
- goto bail;
- }
- snprintf(arg, sizeof(arg), "%u", resumepos);
+ snprintf(arg, sizeof(arg), "%ld", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -885,10 +881,10 @@ bail:
/* {{{ ftp_put
*/
int
-ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
+ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
{
databuf_t *data = NULL;
- int size;
+ long size;
char *ptr;
int ch;
char arg[11];
@@ -905,11 +901,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
ftp->data = data;
if (startpos > 0) {
- if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
- goto bail;
- }
- snprintf(arg, sizeof(arg), "%u", startpos);
+ snprintf(arg, sizeof(arg), "%ld", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -966,7 +958,7 @@ bail:
/* {{{ ftp_size
*/
-int
+long
ftp_size(ftpbuf_t *ftp, const char *path)
{
if (ftp == NULL) {
@@ -981,7 +973,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
if (!ftp_getresp(ftp) || ftp->resp != 213) {
return -1;
}
- return atoi(ftp->inbuf);
+ return atol(ftp->inbuf);
}
/* }}} */
@@ -1143,7 +1135,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
int
ftp_readline(ftpbuf_t *ftp)
{
- int size, rcvd;
+ long size, rcvd;
char *data, *eol;
/* shift the extra to the front */
@@ -1236,7 +1228,8 @@ ftp_getresp(ftpbuf_t *ftp)
int
my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
{
- int n, size, sent;
+ long size, sent;
+ int n;
size = len;
while (size) {
@@ -1719,7 +1712,7 @@ bail:
/* {{{ ftp_nb_get
*/
int
-ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
+ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1737,14 +1730,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
}
if (resumepos>0) {
- /* We are working on an architecture that supports 64-bit integers
- * since php is 32 bit by design, we bail out with warning
- */
- if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
- goto bail;
- }
- snprintf(arg, sizeof(arg), "%u", resumepos);
+ snprintf(arg, sizeof(arg), "%ld", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -1843,7 +1829,7 @@ bail:
/* {{{ ftp_nb_put
*/
int
-ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
+ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1858,11 +1844,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
goto bail;
}
if (startpos > 0) {
- if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
- goto bail;
- }
- snprintf(arg, sizeof(arg), "%u", startpos);
+ snprintf(arg, sizeof(arg), "%ld", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -1899,7 +1881,7 @@ bail:
int
ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
{
- int size;
+ long size;
char *ptr;
int ch;
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index c7db45789a..69de7dbb78 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi
* however some servers will not accept STOR or APPE until ALLO is confirmed.
* If response is passed, it is estrdup()ed from ftp->inbuf and must be freed
* or assigned to a zval returned to the user */
-int ftp_alloc(ftpbuf_t *ftp, const int size, char **response);
+int ftp_alloc(ftpbuf_t *ftp, const long size, char **response);
/* returns a NULL-terminated array of filenames in the given path
* or NULL on error. the return array must be freed (but don't
@@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
/* retrieves a file and saves its contents to outfp
* returns true on success, false on error
*/
-int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
+int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
-int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
+int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
/* returns the size of the given file, or -1 on error */
-int ftp_size(ftpbuf_t *ftp, const char *path);
+long ftp_size(ftpbuf_t *ftp, const char *path);
/* returns the last modified time of the given file, or -1 on error */
time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
@@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
/* retrieves part of a file and saves its contents to outfp
* returns true on success, false on error
*/
-int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
+int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
-int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
+int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
/* continues a previous nb_(f)get command
*/
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 73071936e0..da22e0b63e 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -784,8 +784,8 @@ PHP_FUNCTION(ftp_nb_fget)
ftptype_t xtype;
php_stream *stream;
char *file;
- int file_len, ret;
- long mode, resumepos=0;
+ int file_len;
+ long mode, resumepos=0, ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
@@ -968,9 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
RETURN_LONG(PHP_FTP_FAILED);
}
- if (ret == PHP_FTP_FINISHED) {
- php_stream_close(outstream);
- }
+ php_stream_close(outstream);
RETURN_LONG(ret);
}
@@ -982,7 +980,7 @@ PHP_FUNCTION(ftp_nb_continue)
{
zval *z_ftp;
ftpbuf_t *ftp;
- int ret;
+ long ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
return;
@@ -1120,7 +1118,7 @@ PHP_FUNCTION(ftp_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
- int remote_len, local_len;
+ long remote_len, local_len;
long mode, startpos=0;
php_stream *instream;
@@ -1173,8 +1171,8 @@ PHP_FUNCTION(ftp_nb_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
- int remote_len, local_len, ret;
- long mode, startpos=0;
+ int remote_len, local_len;
+ long mode, startpos=0, ret;
php_stream *instream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
diff --git a/ext/ftp/tests/filesize_large.phpt b/ext/ftp/tests/filesize_large.phpt
new file mode 100644
index 0000000000..05f12a3e5b
--- /dev/null
+++ b/ext/ftp/tests/filesize_large.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Verify php can handle filesizes >32bit
+--SKIPIF--
+<?php
+require 'skipif.inc';
+if (2147483647 == PHP_INT_MAX) {
+ die('skip 64-bit only');
+}
+?>
+--FILE--
+<?php
+require 'server.inc';
+
+$ftp = ftp_connect('127.0.0.1', $port);
+if (!$ftp) die("Couldn't connect to the server");
+
+ftp_login($ftp, 'user', 'pass');
+var_dump(ftp_size($ftp, 'largefile'));
+
+ftp_close($ftp);
+?>
+--EXPECT--
+int(5368709120)
diff --git a/ext/ftp/tests/ftp_fget_basic.phpt b/ext/ftp/tests/ftp_fget_basic.phpt
index d736f8c45e..355b8b8469 100644
--- a/ext/ftp/tests/ftp_fget_basic.phpt
+++ b/ext/ftp/tests/ftp_fget_basic.phpt
@@ -27,7 +27,7 @@ var_dump(ftp_fget($ftp, $fp, 'binary data.bin', FTP_BINARY));
fseek($fp, $postition);
var_dump(urlencode(fgets($fp)));
-//test non-existant file request
+//test non-existent file request
ftp_fget($ftp, $fp ,'a warning.txt', FTP_ASCII);
//remove file
diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt
index 23fd8d07f3..2fd8c79149 100644
--- a/ext/ftp/tests/ftp_get_basic.phpt
+++ b/ext/ftp/tests/ftp_get_basic.phpt
@@ -27,7 +27,7 @@ var_dump(ftp_get($ftp, $tmpfname, 'binary data.bin', FTP_BINARY));
var_dump(urlencode(file_get_contents($tmpfname)));
unlink($tmpfname);
-//test non-existant file request
+//test non-existent file request
ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII);
?>
--EXPECTF--
diff --git a/ext/ftp/tests/ftp_nb_get_large.phpt b/ext/ftp/tests/ftp_nb_get_large.phpt
new file mode 100644
index 0000000000..3fbf2a4831
--- /dev/null
+++ b/ext/ftp/tests/ftp_nb_get_large.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Testing ftp_nb_fget can handle large files incl. resume
+--SKIPIF--
+<?php
+require 'skipif.inc';
+if (2147483647 == PHP_INT_MAX) {
+ die('skip ot supported on this system');
+}
+if (disk_free_space(__DIR__) < 10*1024*1024*1024) {
+ die('not enough disk space');
+}
+?>
+--FILE--
+<?php
+require 'server.inc';
+
+$ftp = ftp_connect('127.0.0.1', $port);
+ftp_login($ftp, 'user', 'pass');
+if (!$ftp) die("Couldn't connect to the server");
+
+$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
+touch($local_file);
+ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
+$fp = fopen($local_file, 'r');
+fseek($fp, 5368709119);
+var_dump(fread($fp, 1));
+var_dump(filesize($local_file));
+fclose($fp);
+?>
+--CLEAN--
+<?php
+@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
+?>
+--EXPECT--
+string(1) "X"
+int(5368709120)
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index 8617880623..7dc8fa08d9 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -357,7 +357,17 @@ if ($pid) {
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
fputs($fs, "Bar\r\n");
fputs($s, "226 Closing data Connection.\r\n");
- break;
+ break;
+ case "fget_large":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
+ if ($GLOBALS['rest_pos'] == '5368709119') {
+ fputs($fs, "X");
+ } else {
+ fputs($fs, "Y");
+ }
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
default:
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
break;
@@ -393,11 +403,12 @@ if ($pid) {
}elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
fputs($s, "425 Error establishing connection\r\n");
- }elseif (preg_match('/^REST \d+/', $buf, $matches)) {
+ }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
+ $GLOBALS['rest_pos'] = $matches[1];
fputs($s, "350 OK\r\n");
- }
-
- else {
+ }elseif (preg_match('/^SIZE largefile/', $buf)) {
+ fputs($s, "213 5368709120\r\n");
+ }else {
fputs($s, "500 Syntax error, command unrecognized.\r\n");
dump_and_exit($buf);
}
@@ -407,4 +418,4 @@ if ($pid) {
}
fclose($socket);
-?> \ No newline at end of file
+?>
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 87e889345c..3279463b7e 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -129,7 +129,7 @@ int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
/* IMPORTANT NOTE FOR NEW FILTER
* Do not forget to update:
* IMAGE_FILTER_MAX: define the last filter index
- * IMAGE_FILTER_MAX_ARGS: define the biggest amout of arguments
+ * IMAGE_FILTER_MAX_ARGS: define the biggest amount of arguments
* image_filter array in PHP_FUNCTION(imagefilter)
* */
#define IMAGE_FILTER_NEGATE 0
diff --git a/ext/gd/libgd/webpimg.h b/ext/gd/libgd/webpimg.h
index 8a05429a73..db23de5bb2 100644
--- a/ext/gd/libgd/webpimg.h
+++ b/ext/gd/libgd/webpimg.h
@@ -84,7 +84,7 @@ WebPResult WebPDecode(const uint8* data,
* height.
* 6. y_stride: The width (in bytes) of one row of Y data. This may not
* match width if there is end of row padding (e.g., for 32
- * bit row aligment).
+ * bit row alignment).
* 7. QP: the quantization parameter. This parameter controls the
* compression vs quality tradeoff. Use smaller numbers for better
* quality (compression will be lesser) and vice versa. 20 is a
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index f8c3a0773b..e3a3563aac 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1069,7 +1069,7 @@ ZEND_FUNCTION(gmp_powm)
zval **base_arg, **exp_arg, **mod_arg;
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
int use_ui = 0;
- int temp_base, temp_exp, temp_mod;
+ int temp_base = 0, temp_exp = 0, temp_mod;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
return;
diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt
index 326fbd51a5..de7ce55b10 100644
--- a/ext/hash/tests/hash_file_error.phpt
+++ b/ext/hash/tests/hash_file_error.phpt
@@ -23,8 +23,8 @@ file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' );
echo "\n-- Testing hash_file() function with an unknown algorithm --\n";
var_dump( hash_file( 'foobar', $filename ) );
-echo "\n-- Testing hash_file() function with a non-existant file --\n";
-var_dump( hash_file( 'md5', 'nonexistant.txt' ) );
+echo "\n-- Testing hash_file() function with a non-existent file --\n";
+var_dump( hash_file( 'md5', 'nonexistent.txt' ) );
echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n";
var_dump( hash_file( 'md5' ) );
@@ -50,7 +50,7 @@ unlink( $filename );
Warning: hash_file(): Unknown hashing algorithm: %s in %s on line %d
bool(false)
--- Testing hash_file() function with a non-existant file --
+-- Testing hash_file() function with a non-existent file --
Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d
bool(false)
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4
index 3ad7c107dd..3fcf6742da 100644
--- a/ext/imap/config.m4
+++ b/ext/imap/config.m4
@@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
fi
- if test -r "$IMAP_DIR/c-client/c-client.a"; then
+ if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
- elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
+ elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
fi
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 883fa0391a..c752b02372 100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -130,7 +130,7 @@ void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC)
{
- UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL;
+ UChar *uhaystack = NULL, *uneedle = NULL;
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
UBreakIterator* bi = NULL;
diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c
index 6d39dfb7e0..f5475faf1c 100644
--- a/ext/intl/resourcebundle/resourcebundle.c
+++ b/ext/intl/resourcebundle/resourcebundle.c
@@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
case URES_STRING:
ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
- INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0);
+ INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
break;
case URES_BINARY:
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index a6a73f5f04..7c1a5c28b8 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -162,8 +162,8 @@ PHP_FUNCTION( resourcebundle_create )
/* {{{ resourcebundle_array_fetch */
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
{
- int32_t meindex;
- char * mekey;
+ int32_t meindex = 0;
+ char * mekey = NULL;
long mekeylen;
zend_bool is_numeric = 0;
char *pbuf;
diff --git a/ext/intl/tests/transliterator_create_error.phpt b/ext/intl/tests/transliterator_create_error.phpt
index 31aef68feb..4f2d04ae78 100644
--- a/ext/intl/tests/transliterator_create_error.phpt
+++ b/ext/intl/tests/transliterator_create_error.phpt
@@ -6,15 +6,15 @@ Transliterator::create (error)
<?php
ini_set("intl.error_level", E_WARNING);
-Transliterator::create("inexistant id");
+Transliterator::create("inexistent id");
echo intl_get_error_message(), "\n";
Transliterator::create("bad UTF-8 \x8F");
echo intl_get_error_message(), "\n";
echo "Done.\n";
--EXPECTF--
-Warning: Transliterator::create(): transliterator_create: unable to open ICU transliterator with id "inexistant id" in %s on line %d
-transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID
+Warning: Transliterator::create(): transliterator_create: unable to open ICU transliterator with id "inexistent id" in %s on line %d
+transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID
Warning: Transliterator::create(): String conversion of id to UTF-16 failed in %s on line %d
String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND
diff --git a/ext/intl/tests/transliterator_transliterate_variant1.phpt b/ext/intl/tests/transliterator_transliterate_variant1.phpt
index fc77a4e3ac..dcd01efd40 100644
--- a/ext/intl/tests/transliterator_transliterate_variant1.phpt
+++ b/ext/intl/tests/transliterator_transliterate_variant1.phpt
@@ -13,7 +13,7 @@ echo transliterator_transliterate("\x8F", $str), "\n";
echo intl_get_error_message(), "\n";
class A {
-function __toString() { return "inexistant id"; }
+function __toString() { return "inexistent id"; }
}
echo transliterator_transliterate(new A(), $str), "\n";
@@ -29,9 +29,9 @@ Warning: transliterator_transliterate(): Could not create transliterator with ID
String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND
-Warning: transliterator_transliterate(): transliterator_create: unable to open ICU transliterator with id "inexistant id" in %s on line %d
+Warning: transliterator_transliterate(): transliterator_create: unable to open ICU transliterator with id "inexistent id" in %s on line %d
-Warning: transliterator_transliterate(): Could not create transliterator with ID "inexistant id" (transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID) in %s on line %d
+Warning: transliterator_transliterate(): Could not create transliterator with ID "inexistent id" (transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID) in %s on line %d
-transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID
+transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID
Done.
diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt
index 8caea1479a..45f9031df4 100644
--- a/ext/ldap/tests/ldap_get_values_len_error.phpt
+++ b/ext/ldap/tests/ldap_get_values_len_error.phpt
@@ -20,7 +20,7 @@ var_dump(ldap_get_values_len($link));
var_dump(ldap_get_values_len($link, $entry));
var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data"));
-var_dump(ldap_get_values_len($link, $entry, "inexistantAttribute"));
+var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute"));
?>
===DONE===
--CLEAN--
diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
index 966612f652..c8c7985826 100644
--- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
+++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
@@ -35,7 +35,7 @@ function rebind_proc ($ds, $ldap_url) {
$link = ldap_connect($host, $port);
var_dump(ldap_set_rebind_proc($link));
var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data"));
-var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistant"));
+var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent"));
?>
===DONE===
--EXPECTF--
@@ -45,6 +45,6 @@ bool(false)
Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)
-Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistant' to be a valid callback in %s on line %d
+Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d
bool(false)
===DONE===
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
index fcee610533..5539700343 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
@@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_wchar,
- mbfl_filt_conv_common_flush
+ mbfl_filt_conv_utf8_wchar_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
@@ -93,6 +93,17 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
+int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
+{
+ int w;
+ w = c & MBFL_WCSGROUP_MASK;
+ w |= MBFL_WCSGROUP_THROUGH;
+ filter->status = 0;
+ filter->cache = 0;
+ CK((*filter->output_function)(w, filter->data));
+}
+
+
/*
* UTF-8 => wchar
*/
@@ -100,111 +111,104 @@ int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
{
int s, c1, w = 0, flag = 0;
- if (c < 0x80) {
- if (filter->status != 0) {
- w = (filter->cache & MBFL_WCSGROUP_MASK) | MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- filter->status = 0;
- filter->cache = 0;
- }
- if (c >= 0) {
+retry:
+ switch (filter->status & 0xff) {
+ case 0x00:
+ if (c < 0x80) {
CK((*filter->output_function)(c, filter->data));
+ } else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
+ filter->status = 0x10;
+ filter->cache = c & 0x1f;
+ } else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
+ filter->status = 0x20;
+ filter->cache = c & 0xf;
+ } else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
+ filter->status = 0x30;
+ filter->cache = c & 0x7;
+ } else {
+ mbfl_filt_put_invalid_char(c, filter);
}
- } else if (c < 0xc0) {
- int status = filter->status & 0xff;
- switch (status) {
- case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
- case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
- case 0x32: /* 4byte code 4th char: 0x80-0xbf */
- filter->status = 0;
- s = filter->cache | (c & 0x3f);
+ break;
+ case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
+ case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
+ case 0x32: /* 4byte code 4th char: 0x80-0xbf */
+ filter->status = 0;
+ if (c >= 0x80 && c <= 0xbf) {
+ s = (filter->cache<<6) | (c & 0x3f);
filter->cache = 0;
- if ((status == 0x10 && s >= 0x80) ||
- (status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
- (status == 0x32 && s >= 0x10000 && s < 0x110000)) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
- break;
- case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
- s = filter->cache | ((c & 0x3f) << 6);
- c1 = (s >> 12) & 0xf;
- if ((c1 == 0x0 && c >= 0xa0) ||
- (c1 == 0xd && c < 0xa0) ||
- (c1 > 0x0 && c1 != 0xd)) {
- filter->cache = s;
- filter->status++;
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
- break;
- case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
- filter->cache |= ((c & 0x3f) << 6);
- filter->status++;
- break;
- case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
- s = filter->cache | ((c & 0x3f) << 12);
- c1 = (s >> 18) & 0x7;
- if ((c1 == 0x0 && c >= 0x90) ||
- (c1 > 0x0 && c1 < 0x4) ||
- (c1 == 0x4 && c < 0x90)) {
- filter->cache = s;
- filter->status++;
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
- break;
- default:
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- break;
+ CK((*filter->output_function)(s, filter->data));
+ } else {
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- } else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
- if (filter->status == 0x0) {
- filter->status = 0x10;
- filter->cache = (c & 0x1f) << 6;
+ break;
+ case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
+ s = (filter->cache<<6) | (c & 0x3f);
+ c1 = filter->cache & 0xf;
+
+ if ((c >= 0x80 && c <= 0xbf) &&
+ ((c1 == 0x0 && c >= 0xa0) ||
+ (c1 == 0xd && c < 0xa0) ||
+ (c1 > 0x0 && c1 != 0xd))) {
+ filter->cache = s;
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
- if (filter->status == 0x0) {
- filter->status = 0x20;
- filter->cache = (c & 0xf) << 12;
+ break;
+ case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
+ s = (filter->cache<<6) | (c & 0x3f);
+ c1 = filter->cache & 0x7;
+
+ if ((c >= 0x80 && c <= 0xbf) &&
+ ((c1 == 0x0 && c >= 0x90) ||
+ (c1 == 0x4 && c < 0x90) ||
+ (c1 > 0x0 && c1 != 0x4))) {
+ filter->cache = s;
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
- if (filter->status == 0x0) {
- filter->status = 0x30;
- filter->cache = (c & 0x7) << 18;
+ break;
+ case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
+ if (c >= 0x80 && c <= 0xbf) {
+ filter->cache = (filter->cache<<6) | (c & 0x3f);
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
-
- if (flag) {
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
+ break;
+ default:
filter->status = 0;
- filter->cache = 0;
+ break;
}
return c;
}
+int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter)
+{
+ int status, cache;
+
+ status = filter->status;
+ cache = filter->cache;
+
+ filter->status = 0;
+ filter->cache = 0;
+
+ if (status != 0) {
+ mbfl_filt_put_invalid_char(cache, filter);
+ }
+
+ if (filter->flush_function != NULL) {
+ (*filter->flush_function)(filter->data);
+ }
+ return 0;
+}
+
/*
* wchar => UTF-8
*/
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.h b/ext/mbstring/libmbfl/filters/mbfilter_utf8.h
index 07bf655022..970ace6462 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.h
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.h
@@ -37,5 +37,6 @@ extern const struct mbfl_convert_vtbl vtbl_wchar_utf8;
int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter);
int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter);
+int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
#endif /* MBFL_MBFILTER_UTF8_H */
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
index 62feca40b6..f9b643c17d 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
@@ -37,6 +37,7 @@
#include "mbfilter_sjis_mobile.h"
extern int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter);
+extern int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
extern const unsigned char mblen_table_utf8[];
@@ -115,7 +116,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_docomo_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
- mbfl_filt_conv_common_flush
+ mbfl_filt_conv_utf8_wchar_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_docomo = {
@@ -133,7 +134,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_a_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
- mbfl_filt_conv_common_flush
+ mbfl_filt_conv_utf8_wchar_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_a = {
@@ -151,7 +152,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_b_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
- mbfl_filt_conv_common_flush
+ mbfl_filt_conv_utf8_wchar_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_b = {
@@ -169,7 +170,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_sb_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
- mbfl_filt_conv_common_flush
+ mbfl_filt_conv_utf8_wchar_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_sb = {
@@ -191,119 +192,97 @@ int mbfl_filt_conv_utf8_mobile_wchar(int c, mbfl_convert_filter *filter)
int s, w = 0, flag = 0;
int s1 = 0, c1 = 0, snd = 0;
- if (c < 0x80) {
- if (c >= 0) {
+retry:
+ switch (filter->status & 0xff) {
+ case 0x00:
+ if (c < 0x80) {
CK((*filter->output_function)(c, filter->data));
+ } else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
+ filter->status = 0x10;
+ filter->cache = c & 0x1f;
+ } else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
+ filter->status = 0x20;
+ filter->cache = c & 0xf;
+ } else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
+ filter->status = 0x30;
+ filter->cache = c & 0x7;
+ } else {
+ mbfl_filt_put_invalid_char(c, filter);
}
+ break;
+ case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
+ case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
+ case 0x32: /* 4byte code 4th char: 0x80-0xbf */
filter->status = 0;
- } else if (c < 0xc0) {
- int status = filter->status & 0xff;
- switch (status) {
- case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
- case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
- case 0x32: /* 4byte code 4th char: 0x80-0xbf */
- filter->status = 0;
- s = filter->cache | (c & 0x3f);
+ if (c >= 0x80 && c <= 0xbf) {
+ s = (filter->cache<<6) | (c & 0x3f);
filter->cache = 0;
- if ((status == 0x10 && s >= 0x80) ||
- (status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
- (status == 0x32 && s >= 0x10000 && s < 0x110000)) {
-
- if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
- mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
- s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
- } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
- mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
- s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
- } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
- mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
- s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
- } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
- mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
- s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
- }
-
- if (snd > 0) {
- CK((*filter->output_function)(snd, filter->data));
- }
- CK((*filter->output_function)(s, filter->data));
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
- break;
- case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
- s = filter->cache | ((c & 0x3f) << 6);
- c1 = (s >> 12) & 0xf;
- if ((c1 == 0x0 && c >= 0xa0) ||
- (c1 == 0xd && c < 0xa0) ||
- (c1 > 0x0 && c1 != 0xd)) {
- filter->cache = s;
- filter->status++;
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
+
+ if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
+ mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
+ s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
+ } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
+ mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
+ s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
+ } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
+ mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
+ s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
+ } else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
+ mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
+ s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
}
- break;
- case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
- filter->cache |= ((c & 0x3f) << 6);
- filter->status++;
- break;
- case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
- s = filter->cache | ((c & 0x3f) << 12);
- c1 = (s >> 18) & 0x7;
- if ((c1 == 0x0 && c >= 0x90) ||
- (c1 > 0x0 && c1 < 0x4) ||
- (c1 == 0x4 && c < 0x90)) {
- filter->cache = s;
- filter->status++;
- } else {
- w = s & MBFL_WCSGROUP_MASK;
- flag = 1;
+
+ if (snd > 0) {
+ CK((*filter->output_function)(snd, filter->data));
}
- break;
- default:
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- break;
+ CK((*filter->output_function)(s, filter->data));
+ } else {
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- } else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
- if (filter->status == 0x0) {
- filter->status = 0x10;
- filter->cache = (c & 0x1f) << 6;
+ break;
+ case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
+ s = (filter->cache<<6) | (c & 0x3f);
+ c1 = filter->cache & 0xf;
+
+ if ((c >= 0x80 && c <= 0xbf) &&
+ ((c1 == 0x0 && c >= 0xa0) ||
+ (c1 == 0xd && c < 0xa0) ||
+ (c1 > 0x0 && c1 != 0xd))) {
+ filter->cache = s;
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
- if (filter->status == 0x0) {
- filter->status = 0x20;
- filter->cache = (c & 0xf) << 12;
+ break;
+ case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
+ s = (filter->cache<<6) | (c & 0x3f);
+ c1 = filter->cache & 0x7;
+
+ if ((c >= 0x80 && c <= 0xbf) &&
+ ((c1 == 0x0 && c >= 0x90) ||
+ (c1 == 0x4 && c < 0x90) ||
+ (c1 > 0x0 && c1 != 0x4))) {
+ filter->cache = s;
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
- if (filter->status == 0x0) {
- filter->status = 0x30;
- filter->cache = (c & 0x7) << 18;
+ break;
+ case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
+ if (c >= 0x80 && c <= 0xbf) {
+ filter->cache = (filter->cache<<6) | (c & 0x3f);
+ filter->status++;
} else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
+ mbfl_filt_put_invalid_char(filter->cache, filter);
+ goto retry;
}
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- flag = 1;
- }
-
- if (flag) {
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
+ break;
+ default:
filter->status = 0;
- filter->cache = 0;
+ break;
}
return c;
diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY
index 55c5572fa0..647a460906 100644
--- a/ext/mbstring/oniguruma/HISTORY
+++ b/ext/mbstring/oniguruma/HISTORY
@@ -673,7 +673,7 @@ History
2004/10/18: [impl] (thanks Imai Yasumasa)
enclose #include <sys/types.h> by #ifndef __BORLANDC__.
2004/10/18: [bug] (thanks Imai Yasumasa)
- memory acess violation in select_opt_exact_info().
+ memory access violation in select_opt_exact_info().
2004/09/25: [dist] fix doc/API and doc/API.ja.
2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for
the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
diff --git a/ext/mbstring/tests/bug65045.phpt b/ext/mbstring/tests/bug65045.phpt
new file mode 100644
index 0000000000..03a090ded2
--- /dev/null
+++ b/ext/mbstring/tests/bug65045.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #65045: mb_convert_encoding breaks well-formed character
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+
+//declare(encoding = 'UTF-8');
+mb_internal_encoding('UTF-8');
+
+$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
+$expected = "\xEF\xBF\xBD"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
+
+$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
+$expected2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xEF\xBF\xBD";
+
+mb_substitute_character(0xFFFD);
+var_dump(
+ $expected === htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8')),
+ $expected2 === htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8')),
+ $expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
+ $expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
+);
+
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true) \ No newline at end of file
diff --git a/ext/mbstring/tests/illformed_utf_sequences.phpt b/ext/mbstring/tests/illformed_utf_sequences.phpt
index b5b9d94db8..378b956d68 100644
--- a/ext/mbstring/tests/illformed_utf_sequences.phpt
+++ b/ext/mbstring/tests/illformed_utf_sequences.phpt
@@ -25,28 +25,28 @@ var_dump(chk_enc("\x31\x32\x33", 0));
var_dump(chk_enc("\x41\x42\x43", 0));
var_dump(chk_enc("\xc0\xb1\xc0\xb2\xc0\xb3", 6));
var_dump(chk_enc("\xc1\x81\xc1\x82\xc1\x83", 6));
-var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 6));
-var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 6));
-var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 9));
-var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 8));
+var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 9));
+var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 9));
+var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 12));
+var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 11));
var_dump(chk_enc("\xf8\x80\x80\x80\xb1\xf8\x80\x80\x80\xb2\xf8\x80\x80\x80\xb3", 15));
var_dump(chk_enc("\xf8\x80\x80\x81\x81\xf8\x80\x80\x81\x82\xf8\x80\x80\x81\x83", 15));
var_dump(chk_enc("\xfc\x80\x80\x80\x80\xb1\xfc\x80\x80\x80\x80\xb2\xfc\x80\x80\x80\x80\xb3", 18));
var_dump(chk_enc("\xfc\x80\x80\x80\x81\x81\xfc\x80\x80\x80\x81\x82\xfc\x80\x80\x80\x81\x83", 18));
var_dump(chk_enc("\xc2\xa2\xc2\xa3\xc2\xa5", 0));
-var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 6));
-var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 9));
+var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 9));
+var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 12));
var_dump(chk_enc("\xf8\x80\x80\x82\xa2\xf8\x80\x80\x82\xa3\xf8\x80\x80\x82\xa5", 15));
var_dump(chk_enc("\xfc\x80\x80\x80\x82\xa2\xfc\x80\x80\x80\x82\xa3\xfc\x80\x80\x80\x82\xa5", 18));
var_dump(chk_enc("\xc1\xbf", 2));
var_dump(chk_enc("\xc2\x80", 0));
var_dump(chk_enc("\xdf\xbf", 0));
-var_dump(chk_enc("\xe0\x9f\xff", 2));
+var_dump(chk_enc("\xe0\x9f\xff", 3));
var_dump(chk_enc("\xe0\xa0\x80", 2));
var_dump(chk_enc("\xef\xbf\xbf", 0));
-var_dump(chk_enc("\xf0\x8f\xbf\xbf", 3));
+var_dump(chk_enc("\xf0\x8f\xbf\xbf", 4));
var_dump(chk_enc("\xf0\x90\x80\x80", 0));
var_dump(chk_enc("\xf7\xbf\xbf\xbf", 4));
var_dump(chk_enc("\xf8\x87\xbf\xbf\xbf", 5));
@@ -61,7 +61,7 @@ echo "UTF-8 and surrogates area\n";
$out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
- $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 2);
+ $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
if ($s === false) {
$cnt++;
} else {
diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt
index 7fb3335fe2..6f149bfc9f 100644
--- a/ext/mbstring/tests/mb_http_output.phpt
+++ b/ext/mbstring/tests/mb_http_output.phpt
@@ -4,7 +4,7 @@ mb_http_output()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
-//TODO: Add more encoding. Wrong paramter type test.
+//TODO: Add more encoding. Wrong parameter type test.
//$debug = true;
ini_set('include_path', dirname(__FILE__));
include_once('common.inc');
diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4
index 5968c43346..998323d7c4 100644
--- a/ext/mysql/config.m4
+++ b/ext/mysql/config.m4
@@ -45,7 +45,7 @@ PHP_ARG_WITH(mysql, for MySQL support,
mysqlnd the MySQL native driver will be used])
PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
-[ --with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
+[ --with-mysql-sock[=SOCKPATH] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched], no, no)
if test -z "$PHP_ZLIB_DIR"; then
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index db0e5a1fc5..078b402ff4 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -296,7 +296,7 @@ static const zend_function_entry mysql_functions[] = {
#ifdef MYSQL_HAS_SET_CHARSET
PHP_FE(mysql_set_charset, arginfo_mysql_set_charset)
#endif
- /* for downwards compatability */
+ /* for downwards compatibility */
PHP_FALIAS(mysql, mysql_db_query, arginfo_mysql_db_query)
PHP_FALIAS(mysql_fieldname, mysql_field_name, arginfo_mysql_field_name)
PHP_FALIAS(mysql_fieldtable, mysql_field_table, arginfo_mysql_field_seek)
@@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_result)
/*
johannes TODO:
-Do 2 zend_parse_paramters calls instead of type "z" and switch below
+Do 2 zend_parse_parameters calls instead of type "z" and switch below
Q: String or long first?
*/
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 45e39d0b45..2710b9de23 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -531,7 +531,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
#include "ext/mysqlnd/mysqlnd_reverse_api.h"
static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC)
{
- if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == mysqli_link_class_entry) {
+ if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), mysqli_link_class_entry TSRMLS_CC)) {
MY_MYSQL * mysql;
MYSQLI_RESOURCE * my_res;
mysqli_object * intern = (mysqli_object *)zend_object_store_get_object(zv TSRMLS_CC);
diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt
index 4e266a0533..023e4d2299 100644
--- a/ext/mysqli/tests/mysqli_driver.phpt
+++ b/ext/mysqli/tests/mysqli_driver.phpt
@@ -53,7 +53,7 @@ require_once('skipifconnectfailure.inc');
} catch (mysqli_sql_exception $e) {
$ok = true;
if ('' == $e->getMessage())
- printf("[008] getMessage() has returned an emptry string.\n");
+ printf("[008] getMessage() has returned an empty string.\n");
if ('' == $e->getCode())
printf("[009] getCode() has returned an empty string.\n");
if ('' == $e->getFile())
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
index fa00ecda15..ac2e7c0001 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
@@ -17,7 +17,7 @@ mysqli_fetch_assoc() - utf8
die("skip Looks like UTF8 is not available on the server");
if (strtolower($tmp['Charset']) !== 'utf8')
- die("skip Not sure if UTF8 is available, cancelling the test");
+ die("skip Not sure if UTF8 is available, canceling the test");
mysqli_free_result($res);
@@ -28,7 +28,7 @@ mysqli_fetch_assoc() - utf8
die("skip Looks like UCS2 is not available on the server");
if (strtolower($tmp['Charset']) !== 'ucs2')
- die("skip Not sure if UCS2 is available, cancelling the test");
+ die("skip Not sure if UCS2 is available, canceling the test");
mysqli_free_result($res);
mysqli_close($link);
diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt
index ef5ef6ee69..a22fc58f53 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt
@@ -166,7 +166,7 @@ mysqlnd.collect_memory_statistics=1
mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
- // real_data_* get incremeneted after mysqli_*fetch*()
+ // real_data_* get incremented after mysqli_*fetch*()
mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt
index 2f7986d3fe..5daaa597fa 100644
--- a/ext/mysqli/tests/mysqli_options.phpt
+++ b/ext/mysqli/tests/mysqli_options.phpt
@@ -12,7 +12,7 @@ require_once('skipifconnectfailure.inc');
$valid_options = array(
MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP",
- MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAUTL_FILE",
+ MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE",
MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT",
MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE",
MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND",
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 8ed810d9d6..843e52d389 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -1142,6 +1142,7 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC)
{
php_socket_t this_fd;
+ php_stream *stream = NULL;
int cnt = 0;
MYSQLND **p = conn_array;
@@ -1151,7 +1152,8 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
* when casting. It is only used here so that the buffered data warning
* is not displayed.
* */
- if (SUCCESS == php_stream_cast((*p)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
+ stream = (*p)->data->net->stream;
+ if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) && this_fd >= 0) {
PHP_SAFE_FD_SET(this_fd, fds);
@@ -1169,6 +1171,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC)
{
php_socket_t this_fd;
+ php_stream *stream = NULL;
int ret = 0;
zend_bool disproportion = FALSE;
@@ -1176,7 +1179,8 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
MYSQLND **fwd = conn_array, **bckwd = conn_array;
while (*fwd) {
- if (SUCCESS == php_stream_cast((*fwd)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
+ stream = (*fwd)->data->net->stream;
+ if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) && this_fd >= 0) {
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
if (disproportion) {
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index 21241b3ef5..77e1196413 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -758,7 +758,7 @@ MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum
/*
Switch to non-blocking mode and try to consume something from
the line, if possible, then continue. This saves us from looking for
- the actuall place where out-of-order packets have been sent.
+ the actual place where out-of-order packets have been sent.
If someone is completely sure that everything is fine, he can switch it
off.
*/
diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt
index 61511cf6d2..d735f64299 100644
--- a/ext/oci8/tests/bug43492_2.phpt
+++ b/ext/oci8/tests/bug43492_2.phpt
@@ -8,7 +8,7 @@ require(dirname(__FILE__).'/skipif.inc');
--FILE--
<?php
-// This test is similar to bug43492.phpt without the explict free.
+// This test is similar to bug43492.phpt without the explicit free.
// Now that bug 44206 is fixed an automatic clean up will occur -
// though it is still recommended in practice.
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
index 5be3288f30..a1201db57c 100644
--- a/ext/odbc/config.m4
+++ b/ext/odbc/config.m4
@@ -370,18 +370,33 @@ PHP_ARG_WITH(iodbc,,
if test "$PHP_IODBC" != "no"; then
AC_MSG_CHECKING(for iODBC support)
- if test "$PHP_IODBC" = "yes"; then
- PHP_IODBC=/usr/local
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
+ PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+ ODBC_TYPE=iodbc
+ ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
+ ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
+ ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
+ PHP_EVAL_INCLINE($ODBC_INCLUDE)
+ AC_DEFINE(HAVE_IODBC,1,[ ])
+ AC_DEFINE(HAVE_ODBC2,1,[ ])
+ AC_MSG_RESULT([$ext_output])
+ else
+ if test "$PHP_IODBC" = "yes"; then
+ PHP_IODBC=/usr/local
+ fi
+ PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+ PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
+ ODBC_TYPE=iodbc
+ ODBC_INCLUDE=-I$PHP_IODBC/include
+ ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
+ ODBC_LIBS=-liodbc
+ AC_DEFINE(HAVE_IODBC,1,[ ])
+ AC_DEFINE(HAVE_ODBC2,1,[ ])
+ AC_MSG_RESULT([$ext_output])
fi
- PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
- PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
- ODBC_TYPE=iodbc
- ODBC_INCLUDE=-I$PHP_IODBC/include
- ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
- ODBC_LIBS=-liodbc
- AC_DEFINE(HAVE_IODBC,1,[ ])
- AC_DEFINE(HAVE_ODBC2,1,[ ])
- AC_MSG_RESULT([$ext_output])
fi
fi
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 1e7166a5ec..c84a4ecc60 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -2704,7 +2704,7 @@ PHP_FUNCTION(odbc_num_rows)
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
/* {{{ proto bool odbc_next_result(resource result_id)
- Checks if multiple results are avaiable */
+ Checks if multiple results are available */
PHP_FUNCTION(odbc_next_result)
{
odbc_result *result;
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index d7ac117e51..f1dfa5024a 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -561,6 +561,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */
{
+ zval **data;
zval *subitem, *subentries;
int i, j = -1, last = -1, obj_cnt = 0;
char *sname;
@@ -578,7 +579,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
for (i = 0; i < X509_NAME_entry_count(name); i++) {
unsigned char *to_add;
- int to_add_len;
+ int to_add_len = 0;
ne = X509_NAME_get_entry(name, i);
@@ -592,39 +593,27 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
sname = (char *) OBJ_nid2ln(nid);
}
- MAKE_STD_ZVAL(subentries);
- array_init(subentries);
+ str = X509_NAME_ENTRY_get_data(ne);
+ if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
+ to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
+ } else {
+ to_add = ASN1_STRING_data(str);
+ to_add_len = ASN1_STRING_length(str);
+ }
- last = -1;
- for (;;) {
- j = X509_NAME_get_index_by_OBJ(name, obj, last);
- if (j < 0) {
- if (last != -1) break;
- } else {
- obj_cnt++;
- ne = X509_NAME_get_entry(name, j);
- str = X509_NAME_ENTRY_get_data(ne);
- if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
- to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
- if (to_add_len != -1) {
- add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
- }
- } else {
- to_add = ASN1_STRING_data(str);
- to_add_len = ASN1_STRING_length(str);
+ if (to_add_len != -1) {
+ if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
+ if (Z_TYPE_PP(data) == IS_ARRAY) {
+ subentries = *data;
+ add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
+ } else if (Z_TYPE_PP(data) == IS_STRING) {
+ MAKE_STD_ZVAL(subentries);
+ array_init(subentries);
+ add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
+ zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
}
- }
- last = j;
- }
- i = last;
-
- if (obj_cnt > 1) {
- add_assoc_zval_ex(subitem, sname, strlen(sname) + 1, subentries);
- } else {
- zval_dtor(subentries);
- FREE_ZVAL(subentries);
- if (obj_cnt && str && to_add_len > -1) {
+ } else {
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
}
}
@@ -1398,6 +1387,74 @@ PHP_FUNCTION(openssl_x509_check_private_key)
}
/* }}} */
+/* Special handling of subjectAltName, see CVE-2013-4073
+ * Christian Heimes
+ */
+
+static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension)
+{
+ GENERAL_NAMES *names;
+ const X509V3_EXT_METHOD *method = NULL;
+ long i, length, num;
+ const unsigned char *p;
+
+ method = X509V3_EXT_get(extension);
+ if (method == NULL) {
+ return -1;
+ }
+
+ p = extension->value->data;
+ length = extension->value->length;
+ if (method->it) {
+ names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length,
+ ASN1_ITEM_ptr(method->it)));
+ } else {
+ names = (GENERAL_NAMES*)(method->d2i(NULL, &p, length));
+ }
+ if (names == NULL) {
+ return -1;
+ }
+
+ num = sk_GENERAL_NAME_num(names);
+ for (i = 0; i < num; i++) {
+ GENERAL_NAME *name;
+ ASN1_STRING *as;
+ name = sk_GENERAL_NAME_value(names, i);
+ switch (name->type) {
+ case GEN_EMAIL:
+ BIO_puts(bio, "email:");
+ as = name->d.rfc822Name;
+ BIO_write(bio, ASN1_STRING_data(as),
+ ASN1_STRING_length(as));
+ break;
+ case GEN_DNS:
+ BIO_puts(bio, "DNS:");
+ as = name->d.dNSName;
+ BIO_write(bio, ASN1_STRING_data(as),
+ ASN1_STRING_length(as));
+ break;
+ case GEN_URI:
+ BIO_puts(bio, "URI:");
+ as = name->d.uniformResourceIdentifier;
+ BIO_write(bio, ASN1_STRING_data(as),
+ ASN1_STRING_length(as));
+ break;
+ default:
+ /* use builtin print for GEN_OTHERNAME, GEN_X400,
+ * GEN_EDIPARTY, GEN_DIRNAME, GEN_IPADD and GEN_RID
+ */
+ GENERAL_NAME_print(bio, name);
+ }
+ /* trailing ', ' except for last element */
+ if (i < (num - 1)) {
+ BIO_puts(bio, ", ");
+ }
+ }
+ sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
+
+ return 0;
+}
+
/* {{{ proto array openssl_x509_parse(mixed x509 [, bool shortnames=true])
Returns an array of the fields/values of the CERT */
PHP_FUNCTION(openssl_x509_parse)
@@ -1494,15 +1551,30 @@ PHP_FUNCTION(openssl_x509_parse)
for (i = 0; i < X509_get_ext_count(cert); i++) {
+ int nid;
extension = X509_get_ext(cert, i);
- if (OBJ_obj2nid(X509_EXTENSION_get_object(extension)) != NID_undef) {
+ nid = OBJ_obj2nid(X509_EXTENSION_get_object(extension));
+ if (nid != NID_undef) {
extname = (char *)OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(extension)));
} else {
OBJ_obj2txt(buf, sizeof(buf)-1, X509_EXTENSION_get_object(extension), 1);
extname = buf;
}
bio_out = BIO_new(BIO_s_mem());
- if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
+ if (nid == NID_subject_alt_name) {
+ if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) {
+ BIO_get_mem_ptr(bio_out, &bio_buf);
+ add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
+ } else {
+ zval_dtor(return_value);
+ if (certresource == -1 && cert) {
+ X509_free(cert);
+ }
+ BIO_free(bio_out);
+ RETURN_FALSE;
+ }
+ }
+ else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
BIO_get_mem_ptr(bio_out, &bio_buf);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
} else {
diff --git a/ext/openssl/tests/bug64802.pem b/ext/openssl/tests/bug64802.pem
new file mode 100644
index 0000000000..187cda31d7
--- /dev/null
+++ b/ext/openssl/tests/bug64802.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIGfzCCBWegAwIBAgIQSVCinGH6MkvjJZjRyjK9nTANBgkqhkiG9w0BAQUFADCB
+jjELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
+A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNDAyBgNV
+BAMTK0NPTU9ETyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0Ew
+HhcNMTIwMjI5MDAwMDAwWhcNMTQwMjI4MjM1OTU5WjCCAW8xEjAQBgNVBAMTCXd3
+dy5yZC5pbzERMA8GA1UEAxMIcmRpby5jb20xDjAMBgNVBAMTBXJkLmlvMRUwEwYD
+VQQDEwxhcGkucmRpby5jb20xEjAQBgNVBAMTCWFwaS5yZC5pbzEQMA4GA1UEBRMH
+NDU4NjAwNzETMBEGCysGAQQBgjc8AgEDEwJVUzEZMBcGCysGAQQBgjc8AgECEwhE
+ZWxhd2FyZTEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24xCzAJBgNVBAYT
+AlVTMQ4wDAYDVQQREwU5NDEwMzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBG
+cmFuY2lzY28xFzAVBgNVBAkTDjE1NTAgQnJ5YW50IHN0MRMwEQYDVQQKEwpSZGlv
+LCBJbmMuMSMwIQYDVQQLExpDT01PRE8gRVYgTXVsdGktRG9tYWluIFNTTDEVMBMG
+A1UEAxMMd3d3LnJkaW8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
+AQEAt0AgYOe8EBJNVBAuSJFLKHRKZn0/ObCLBFG4xVH/5fb1rfYHBT1XSjjOqR3t
+iGC/A3esF8YC7TuHQcTLVephx0DtJv1ASxRg3zPM8ebBRsuul18N0W+sY1aNXpkd
+36quxvjg5UdBrAweuekJ7OTSZcCe2Ry/SKBeZSWWtkWsI4krCLv7JaKUwxw2h+Hn
+TAZSBLVxz/mixF0WYdepYwnq2Hm7XvvVEIQ7wxOQ9bA7iCevLojZOnb39BT2QII7
+cy8AB47RZdfYg7UwaO3bST2rauA4MKar7/Ozqc0aemNFpLatJfgv07cydiuj9fsd
+5aE/c8is8C9M9+7MmSMkcNEgGwIDAQABo4IB8zCCAe8wHwYDVR0jBBgwFoAUiERR
+/1AqaV4tiPQhutkM8s7L6nwwHQYDVR0OBBYEFCrYw8bfrYJ61NS2yYx6/CnhjzT4
+MA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUF
+BwMBBggrBgEFBQcDAjBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEFATArMCkGCCsG
+AQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8uY29tL0NQUzBTBgNVHR8ETDBK
+MEigRqBEhkJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9FeHRlbmRlZFZh
+bGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcmwwgYQGCCsGAQUFBwEBBHgwdjBOBggr
+BgEFBQcwAoZCaHR0cDovL2NydC5jb21vZG9jYS5jb20vQ09NT0RPRXh0ZW5kZWRW
+YWxpZGF0aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8v
+b2NzcC5jb21vZG9jYS5jb20wTAYDVR0RBEUwQ4IMd3d3LnJkaW8uY29tgglhcGku
+cmQuaW+CDGFwaS5yZGlvLmNvbYIFcmQuaW+CCHJkaW8uY29tggl3d3cucmQuaW8w
+DQYJKoZIhvcNAQEFBQADggEBAKFd4bPVFRyrlqIKPtrtMuqGqid6685ohxf0cv52
+sjdRYwLVTjnZOrmkDdNaF3R2A1ZlVMRN+67rK+qfY5sTeijFcudV3/i0PDtOFRwP
+6yYVD2uZmYkxfPiW309HPmDF+EzhxpVjWlTQEOwkfFLTmJmwl3Qu2Kffp8F1ENXW
+OTVNvj5VtMghvzu68PpzKl1VjlOR4Ej9NCwh1dUjNKEoTPzvpehXsIZ7jHSpX/T1
+wSSt9ckiechDdpgZXTzHgbxHNibK0Uhh+QhkBgYMj5F8qj5BlBhWAWqQa/VnEdmr
+Pfo7U+QmadoqQd7qt06hE2hG1nfZ0vPJDbWV3oVSwG2Yt7I=
+-----END CERTIFICATE-----
diff --git a/ext/openssl/tests/bug64802.phpt b/ext/openssl/tests/bug64802.phpt
new file mode 100644
index 0000000000..9a59701494
--- /dev/null
+++ b/ext/openssl/tests/bug64802.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+$cert = file_get_contents(__DIR__.'/bug64802.pem');
+$r = openssl_x509_parse($cert,$use_short_names=true);
+sort($r['subject']);
+var_dump( $r['subject'] );
+?>
+--EXPECTF--
+array(11) {
+ [0]=>
+ string(14) "1550 Bryant st"
+ [1]=>
+ string(5) "94103"
+ [2]=>
+ string(7) "4586007"
+ [3]=>
+ string(2) "CA"
+ [4]=>
+ string(26) "COMODO EV Multi-Domain SSL"
+ [5]=>
+ string(20) "Private Organization"
+ [6]=>
+ string(10) "Rdio, Inc."
+ [7]=>
+ string(13) "San Francisco"
+ [8]=>
+ string(2) "US"
+ [9]=>
+ array(2) {
+ [0]=>
+ string(2) "US"
+ [1]=>
+ string(8) "Delaware"
+ }
+ [10]=>
+ array(6) {
+ [0]=>
+ string(9) "www.rd.io"
+ [1]=>
+ string(8) "rdio.com"
+ [2]=>
+ string(5) "rd.io"
+ [3]=>
+ string(12) "api.rdio.com"
+ [4]=>
+ string(9) "api.rd.io"
+ [5]=>
+ string(12) "www.rdio.com"
+ }
+}
diff --git a/ext/openssl/tests/cve2013_4073.pem b/ext/openssl/tests/cve2013_4073.pem
new file mode 100644
index 0000000000..7ebb994920
--- /dev/null
+++ b/ext/openssl/tests/cve2013_4073.pem
@@ -0,0 +1,28 @@
+-----BEGIN CERTIFICATE-----
+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
+-----END CERTIFICATE-----
diff --git a/ext/openssl/tests/cve2013_4073.phpt b/ext/openssl/tests/cve2013_4073.phpt
new file mode 100644
index 0000000000..e676ddfb99
--- /dev/null
+++ b/ext/openssl/tests/cve2013_4073.phpt
@@ -0,0 +1,19 @@
+--TEST--
+CVE 2013-4073: Null-byte certificate handling
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+--FILE--
+<?php
+$cert = file_get_contents(__DIR__ . '/cve2013_4073.pem');
+$info = openssl_x509_parse($cert);
+var_export($info['extensions']);
+
+--EXPECTF--
+array (
+ 'basicConstraints' => 'CA:FALSE',
+ 'subjectKeyIdentifier' => '88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C',
+ 'keyUsage' => 'Digital Signature, Non Repudiation, Key Encipherment',
+ 'subjectAltName' => 'DNS:altnull.python.org' . "\0" . 'example.com, email:null@python.org' . "\0" . 'user@example.org, URI:http://null.python.org' . "\0" . 'http://example.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
+',
+)
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index e19e8f098d..6e74d8024f 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -472,7 +472,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
do {
struct timeval cur_time,
- elapsed_time;
+ elapsed_time = {0};
if (sslsock->is_client) {
n = SSL_connect(sslsock->ssl_handle);
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 7e123a1ac6..b3cccac44f 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -23,7 +23,7 @@
#include "Zend/zend.h"
#include "Zend/zend_signal.h"
-/* php_signal using sigaction is derrived from Advanced Programing
+/* php_signal using sigaction is derived from Advanced Programing
* in the Unix Environment by W. Richard Stevens p 298. */
Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
diff --git a/ext/pcntl/tests/pcntl_exec.phpt b/ext/pcntl/tests/pcntl_exec.phpt
index 9d2ec1dcf5..9a2c96ea38 100644
--- a/ext/pcntl/tests/pcntl_exec.phpt
+++ b/ext/pcntl/tests/pcntl_exec.phpt
@@ -8,7 +8,7 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE
--FILE--
<?php
echo "ok\n";
-pcntl_exec(getenv("TEST_PHP_EXECUTABLE"));
+pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), ['-n']);
echo "nok\n";
?>
--EXPECT--
diff --git a/ext/pcntl/tests/pcntl_exec_2.phpt b/ext/pcntl/tests/pcntl_exec_2.phpt
index 02b5e22aa4..e18527dba0 100644
--- a/ext/pcntl/tests/pcntl_exec_2.phpt
+++ b/ext/pcntl/tests/pcntl_exec_2.phpt
@@ -14,7 +14,7 @@ if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) {
exit;
}
echo "ok\n";
-pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array(__FILE__), array(
+pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array('-n', __FILE__), array(
b"PCNTL_EXEC_TEST_IS_CHILD" => b"1",
b"FOO" => b"BAR",
1 => b"long")
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
index 29dfc5af1e..ae2eb128ba 100644
--- a/ext/pcre/tests/preg_grep_error1.phpt
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_grep reacts to being passed bad regexes
*/
echo "*** Testing preg_grep() : error conditions ***\n";
-$values = array('abcdef', //Regex without delimeter
-'/[a-zA-Z]', //Regex without closing delimeter
-'[a-zA-Z]/', //Regex without opening delimeter
+$values = array('abcdef', //Regex without delimiter
+'/[a-zA-Z]', //Regex without closing delimiter
+'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt
index a3cb684044..95ab905d7d 100644
--- a/ext/pcre/tests/preg_match_all_error1.phpt
+++ b/ext/pcre/tests/preg_match_all_error1.phpt
@@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_match_all reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
-$regex_array = array('abcdef', //Regex without delimeter
-'/[a-zA-Z]', //Regex without closing delimeter
-'[a-zA-Z]/', //Regex without opening delimeter
+$regex_array = array('abcdef', //Regex without delimiter
+'/[a-zA-Z]', //Regex without closing delimiter
+'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt
index 7630481517..ec9cf8cec8 100644
--- a/ext/pcre/tests/preg_match_error1.phpt
+++ b/ext/pcre/tests/preg_match_error1.phpt
@@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_match reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match() : error conditions ***\n";
-$regex_array = array('abcdef', //Regex without delimeter
-'/[a-zA-Z]', //Regex without closing delimeter
-'[a-zA-Z]/', //Regex without opening delimeter
+$regex_array = array('abcdef', //Regex without delimiter
+'/[a-zA-Z]', //Regex without closing delimiter
+'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
index 7ddfcfdef8..ec573c77bf 100644
--- a/ext/pcre/tests/preg_replace_error1.phpt
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_replace reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_replace() : error conditions***\n";
-$regex_array = array('abcdef', //Regex without delimeter
-'/[a-zA-Z]', //Regex without closing delimeter
-'[a-zA-Z]/', //Regex without opening delimeter
+$regex_array = array('abcdef', //Regex without delimiter
+'/[a-zA-Z]', //Regex without closing delimiter
+'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 25db6842f6..d5860b1a1e 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -899,7 +899,7 @@ static PHP_METHOD(PDO, getAttribute)
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
- /* handle generic PDO-level atributes */
+ /* handle generic PDO-level attributes */
switch (attr) {
case PDO_ATTR_PERSISTENT:
RETURN_BOOL(dbh->is_persistent);
@@ -997,7 +997,7 @@ static PHP_METHOD(PDO, lastInsertId)
pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()" TSRMLS_CC);
RETURN_FALSE;
} else {
- Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, &Z_STRLEN_P(return_value) TSRMLS_CC);
+ Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, (unsigned int *)&Z_STRLEN_P(return_value) TSRMLS_CC);
if (!Z_STRVAL_P(return_value)) {
PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index 4c523506c4..1ed78c1cc5 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Apr 19 12:42:11 2012 */
+/* Generated by re2c 0.13.5 on Tue Aug 20 18:02:48 2013 */
#line 1 "ext/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
@@ -77,7 +77,7 @@ yy2:
yy3:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych >= 0x01) goto yy41;
+ if (yych >= 0x01) goto yy43;
yy4:
#line 63 "ext/pdo/pdo_sql_parser.re"
{ SKIP_ONE(PDO_PARSER_TEXT); }
@@ -86,7 +86,7 @@ yy5:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 0x00) goto yy4;
- goto yy36;
+ goto yy38;
yy6:
yych = *++YYCURSOR;
switch (yych) {
@@ -153,21 +153,19 @@ yy6:
case 'x':
case 'y':
case 'z': goto yy32;
- case ':':
- case '?': goto yy29;
+ case ':': goto yy35;
default: goto yy4;
}
yy7:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
- case ':':
case '?': goto yy29;
default: goto yy8;
}
yy8:
#line 62 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND_POS); }
-#line 171 "ext/pdo/pdo_sql_parser.c"
+#line 169 "ext/pdo/pdo_sql_parser.c"
yy9:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
@@ -177,7 +175,7 @@ yy9:
yy10:
#line 65 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 181 "ext/pdo/pdo_sql_parser.c"
+#line 179 "ext/pdo/pdo_sql_parser.c"
yy11:
yych = *++YYCURSOR;
switch (yych) {
@@ -214,7 +212,7 @@ yy14:
yy16:
#line 64 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 218 "ext/pdo/pdo_sql_parser.c"
+#line 216 "ext/pdo/pdo_sql_parser.c"
yy17:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -288,14 +286,13 @@ yy29:
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
- case ':':
case '?': goto yy29;
default: goto yy31;
}
yy31:
#line 60 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 299 "ext/pdo/pdo_sql_parser.c"
+#line 296 "ext/pdo/pdo_sql_parser.c"
yy32:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -369,51 +366,59 @@ yy32:
yy34:
#line 61 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND); }
-#line 373 "ext/pdo/pdo_sql_parser.c"
+#line 370 "ext/pdo/pdo_sql_parser.c"
yy35:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy36:
switch (yych) {
- case 0x00: goto yy2;
- case '\'': goto yy38;
- case '\\': goto yy37;
- default: goto yy35;
+ case ':': goto yy35;
+ default: goto yy31;
}
yy37:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if (yych <= 0x00) goto yy2;
- goto yy35;
yy38:
+ switch (yych) {
+ case 0x00: goto yy2;
+ case '\'': goto yy40;
+ case '\\': goto yy39;
+ default: goto yy37;
+ }
+yy39:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= 0x00) goto yy2;
+ goto yy37;
+yy40:
++YYCURSOR;
#line 59 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 395 "ext/pdo/pdo_sql_parser.c"
-yy40:
+#line 400 "ext/pdo/pdo_sql_parser.c"
+yy42:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy41:
+yy43:
switch (yych) {
case 0x00: goto yy2;
- case '"': goto yy43;
- case '\\': goto yy42;
- default: goto yy40;
+ case '"': goto yy45;
+ case '\\': goto yy44;
+ default: goto yy42;
}
-yy42:
+yy44:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 0x00) goto yy2;
- goto yy40;
-yy43:
+ goto yy42;
+yy45:
++YYCURSOR;
#line 58 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 417 "ext/pdo/pdo_sql_parser.c"
+#line 422 "ext/pdo/pdo_sql_parser.c"
}
#line 66 "ext/pdo/pdo_sql_parser.re"
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 80e3b4f95f..1936a37340 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -50,14 +50,14 @@ static int scan(Scanner *s)
QUESTION = [?];
COMMENTS = ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|"--"[^\r\n]*);
SPECIALS = [:?"'];
- MULTICHAR = [:?];
+ MULTICHAR = ([:]{2,}|[?]{2,});
ANYNOEOF = [\001-\377];
*/
/*!re2c
(["](([\\]ANYNOEOF)|ANYNOEOF\["\\])*["]) { RET(PDO_PARSER_TEXT); }
(['](([\\]ANYNOEOF)|ANYNOEOF\['\\])*[']) { RET(PDO_PARSER_TEXT); }
- MULTICHAR{2,} { RET(PDO_PARSER_TEXT); }
+ MULTICHAR { RET(PDO_PARSER_TEXT); }
BINDCHR { RET(PDO_PARSER_BIND); }
QUESTION { RET(PDO_PARSER_BIND_POS); }
SPECIALS { SKIP_ONE(PDO_PARSER_TEXT); }
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index a469d09fc2..9622cb3cc2 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1146,7 +1146,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
zval_ptr_dtor(&val);
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC);
return 0;
- } else if (ce->unserialize(&return_value, ce, Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : "", Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL TSRMLS_CC) == FAILURE) {
+ } else if (ce->unserialize(&return_value, ce, (unsigned char *)(Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : ""), Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL TSRMLS_CC) == FAILURE) {
zval_ptr_dtor(&val);
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC);
zval_dtor(return_value);
@@ -1876,7 +1876,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip)
{
long mode = PDO_FETCH_BOTH;
- int flags, argc = ZEND_NUM_ARGS() - skip;
+ int flags = 0, argc = ZEND_NUM_ARGS() - skip;
zval ***args;
zend_class_entry **cep;
int retval;
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index c757dbf1e5..ede2d6fb76 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -72,11 +72,11 @@ enum pdo_param_type {
/* get_col ptr should point to a zval*
and the driver is responsible for adding correct type information to get_column_meta()
*/
- PDO_PARAM_ZVAL
-};
+ PDO_PARAM_ZVAL,
-/* magic flag to denote a parameter as being input/output */
-#define PDO_PARAM_INPUT_OUTPUT 0x80000000
+ /* magic flag to denote a parameter as being input/output */
+ PDO_PARAM_INPUT_OUTPUT = 0x80000000
+};
#define PDO_PARAM_FLAGS 0xFFFF0000
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index a703f93e7c..32d13bafaf 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -527,9 +527,9 @@ static struct pdo_dbh_methods mysql_methods = {
/* }}} */
#ifdef PHP_WIN32
-# define MYSQL_UNIX_ADDR NULL
+# define PDO_DEFAULT_MYSQL_UNIX_ADDR NULL
#else
-# define MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
+# define PDO_DEFAULT_MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket)
#endif
/* {{{ pdo_mysql_handle_factory */
@@ -545,7 +545,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
{ "dbname", "", 0 },
{ "host", "localhost", 0 },
{ "port", "3306", 0 },
- { "unix_socket", MYSQL_UNIX_ADDR, 0 },
+ { "unix_socket", PDO_DEFAULT_MYSQL_UNIX_ADDR, 0 },
};
int connect_opts = 0
#ifdef CLIENT_MULTI_RESULTS
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index 1dbb30f278..0d4e525cd1 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -61,7 +61,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql)
#include "ext/mysqlnd/mysqlnd_reverse_api.h"
static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC)
{
- if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == php_pdo_get_dbh_ce()) {
+ if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce() TSRMLS_CC)) {
pdo_dbh_t * dbh = zend_object_store_get_object(zv TSRMLS_CC);
if (!dbh || dbh->driver != &pdo_mysql_driver) {
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
index b550cb8da3..ebf22ef61b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
@@ -48,6 +48,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
}
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true]));
$db = MySQLPDOTest::factory();
MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
index 9674e85f5e..74b4a73584 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
@@ -18,7 +18,7 @@ $db = MySQLPDOTest::factory();
ob_end_clean();
/* PDO Driver for MySQL, client library version => 6.0.3-alpha */
- $reg = 'Client API version.*' . pcre_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
+ $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
if (!preg_match("/$reg/", $tmp)) {
printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n");
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 5497bebc64..fcdefa94b3 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -537,7 +537,9 @@ static int pdo_oci_check_liveness(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
{
pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
sb4 error_code = 0;
+#if (!((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))))
char version[256];
+#endif
/* TODO move attached check to PDO level */
if (H->attached == 0) {
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index dcb9557803..6a74efa7ba 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -270,6 +270,12 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
P = (pdo_oci_bound_param*)param->driver_data;
switch (event_type) {
+ case PDO_PARAM_EVT_FETCH_PRE:
+ case PDO_PARAM_EVT_FETCH_POST:
+ case PDO_PARAM_EVT_NORMALIZE:
+ /* Do nothing */
+ break;
+
case PDO_PARAM_EVT_FREE:
P = param->driver_data;
if (P) {
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
index 81e9b74ff9..ab9b99fc6c 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO_OCI: Atrribute: closing a connection in non-autocommit mode commits data
+PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 33163688eb..f7f3ef34ed 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -263,7 +263,7 @@ out:
static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type param_type TSRMLS_DC)
{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
+ /* pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; */
/* TODO: figure it out */
return 0;
}
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 6ee2fcd6be..0e3fd3cbb9 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -286,6 +286,12 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
if (param->is_param) {
switch (event_type) {
+ case PDO_PARAM_EVT_FETCH_PRE:
+ case PDO_PARAM_EVT_FETCH_POST:
+ case PDO_PARAM_EVT_NORMALIZE:
+ /* Do nothing */
+ break;
+
case PDO_PARAM_EVT_FREE:
P = param->driver_data;
if (P) {
@@ -543,7 +549,6 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
{
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
struct pdo_column_data *col = &stmt->columns[colno];
- zend_bool dyn = FALSE;
RETCODE rc;
SWORD colnamelen;
SDWORD colsize, displaysize;
@@ -614,7 +619,6 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l
/* if it is a column containing "long" data, perform late binding now */
if (C->is_long) {
- unsigned long alloced = 4096;
unsigned long used = 0;
char *buf;
RETCODE rc;
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 252bfff25b..50136430a0 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -315,9 +315,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for trailing 0 */
#ifdef HAVE_PQESCAPE_BYTEA_CONN
- escaped = PQescapeByteaConn(H->server, unquoted, unquotedlen, &tmp_len);
+ escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len);
#else
- escaped = PQescapeBytea(unquoted, unquotedlen, &tmp_len);
+ escaped = PQescapeBytea((unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len);
#endif
*quotedlen = (int)tmp_len + 1;
*quoted = emalloc(*quotedlen + 1);
@@ -331,9 +331,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
*quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
#ifndef HAVE_PQESCAPE_CONN
- *quotedlen = PQescapeString(*quoted + 1, unquoted, unquotedlen);
+ *quotedlen = PQescapeString(*quoted + 1, unquoted, (size_t)unquotedlen);
#else
- *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, unquotedlen, NULL);
+ *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, (size_t)unquotedlen, NULL);
#endif
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index 3ef89196de..792ad27078 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -536,7 +536,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned
*len = 0;
return 0;
} else {
- char *tmp_ptr = PQunescapeBytea(*ptr, &tmp_len);
+ char *tmp_ptr = (char *)PQunescapeBytea((unsigned char *)*ptr, &tmp_len);
if (!tmp_ptr) {
/* PQunescapeBytea returned an error */
*len = 0;
diff --git a/ext/pdo_pgsql/tests/bug64953.phpt b/ext/pdo_pgsql/tests/bug64953.phpt
new file mode 100644
index 0000000000..6e72bcab68
--- /dev/null
+++ b/ext/pdo_pgsql/tests/bug64953.phpt
@@ -0,0 +1,71 @@
+--TEST--
+PDO PgSQL Bug #64953 (Postgres prepared statement positional parameter casting)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
+
+echo "Taken from the bug report:\n";
+
+$st = $pdo->prepare('SELECT ?::char as i');
+$st->bindValue(1, '1');
+$st->execute();
+var_dump($st->fetch()); // return false
+
+
+$st = $pdo->prepare('SELECT (?)::char as i');
+$st->bindValue(1, '1');
+$st->execute();
+var_dump($st->fetch()); // return array(1) { ["i"]=> string(1) "1" }
+
+echo "Something more nasty:\n";
+
+$st = $pdo->prepare("SELECT :int::int as i");
+$st->execute(array(":int" => 123));
+var_dump($st->fetch());
+
+$st = $pdo->prepare("SELECT '''?'''::text as \":text\"");
+$st->execute();
+var_dump($st->fetch());
+
+?>
+Done
+--EXPECT--
+Test
+Taken from the bug report:
+array(2) {
+ ["i"]=>
+ string(1) "1"
+ [0]=>
+ string(1) "1"
+}
+array(2) {
+ ["i"]=>
+ string(1) "1"
+ [0]=>
+ string(1) "1"
+}
+Something more nasty:
+array(2) {
+ ["i"]=>
+ string(3) "123"
+ [0]=>
+ string(3) "123"
+}
+array(2) {
+ [":text"]=>
+ string(3) "'?'"
+ [0]=>
+ string(3) "'?'"
+}
+Done
diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt
index 48618e13db..6a93905b43 100644
--- a/ext/pdo_pgsql/tests/bug_33876.phpt
+++ b/ext/pdo_pgsql/tests/bug_33876.phpt
@@ -82,7 +82,7 @@ else
# false -> "" as string, which pgsql doesn't like
if (!$res->execute(array(false))) {
$err = $res->errorInfo();
- // Strip additional lines ouputted by recent PgSQL versions
+ // Strip additional lines outputted by recent PgSQL versions
$err[2] = trim(current(explode("\n", $err[2])));
print_r($err);
} else {
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
new file mode 100644
index 0000000000..a1d890ac1b
--- /dev/null
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
@@ -0,0 +1,17 @@
+--TEST--
+PDO_sqlite: Testing sqliteCreateFunction() produces warning when
+un-callable function passed
+--CREDITS--
+Chris MacPherson chris@kombine.co.uk
+--SKIPIF--
+<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
+--FILE--
+<?php
+
+$db = new PDO( 'sqlite::memory:');
+
+$db->sqliteCreateFunction('bar-alias', 'bar');
+
+?>
+--EXPECTF--
+Warning: PDO::sqliteCreateFunction(): function 'bar' is not callable in %s on line %d
diff --git a/ext/pgsql/mysql_users.php b/ext/pgsql/mysql_users.php
index 65a2c33967..edfaa1cddc 100644
--- a/ext/pgsql/mysql_users.php
+++ b/ext/pgsql/mysql_users.php
@@ -56,7 +56,7 @@ ORDER BY 1;
/*
* mysql_list_fields()
*
- * See also pg_meta_data(). It returns field defintion as array.
+ * See also pg_meta_data(). It returns field definition as array.
*/
function pg_list_fields($db, $table)
{
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 1b302668af..f4c4cb37e7 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -63,6 +63,7 @@
#define PGSQL_MAX_LENGTH_OF_LONG 30
#define PGSQL_MAX_LENGTH_OF_DOUBLE 60
+#if LONG_MAX < UINT_MAX
#define PGSQL_RETURN_OID(oid) do { \
if (oid > LONG_MAX) { \
smart_str s = {0}; \
@@ -72,7 +73,9 @@
} \
RETURN_LONG((long)oid); \
} while(0)
-
+#else
+#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid))
+#endif
#if HAVE_PQSETNONBLOCKING
#define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag)
@@ -914,6 +917,82 @@ static void _free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
+
+static int _php_pgsql_detect_identifier_escape(const char *identifier, size_t len)
+{
+ size_t i;
+
+ /* Handle edge case. Cannot be a escaped string */
+ if (len <= 2) {
+ return FAILURE;
+ }
+ /* Detect double qoutes */
+ if (identifier[0] == '"' && identifier[len-1] == '"') {
+ /* Detect wrong format of " inside of escaped string */
+ for (i = 1; i < len-1; i++) {
+ if (identifier[i] == '"' && (identifier[++i] != '"' || i == len-1)) {
+ return FAILURE;
+ }
+ }
+ } else {
+ return FAILURE;
+ }
+ /* Escaped properly */
+ return SUCCESS;
+}
+
+#if !HAVE_PQESCAPELITERAL
+/* {{{ _php_pgsql_escape_identifier
+ * Since PQescapeIdentifier() is unavailable (PostgreSQL 9.0 <), idenfifers
+ * should be escaped by pgsql module.
+ * Note: this function does not care for encoding. Therefore users should not
+ * use this with SJIS/BIG5 etc. (i.e. Encoding base injection may possible with
+ * before PostgreSQL 9.0)
+ */
+static char *_php_pgsql_escape_identifier(const char *field, size_t field_len)
+{
+ ulong field_escaped_len = field_len*2 + 3;
+ ulong i, j = 0;
+ char *field_escaped;
+
+ field_escaped = (char *)malloc(field_escaped_len);
+ field_escaped[j++] = '"';
+ for (i = 0; i < field_len; i++) {
+ if (field[i] == '"') {
+ field_escaped[j++] = '"';
+ field_escaped[j++] = '"';
+ } else {
+ field_escaped[j++] = field[i];
+ }
+ }
+ field_escaped[j++] = '"';
+ field_escaped[j] = '\0';
+ return field_escaped;
+}
+/* }}} */
+#endif
+
+/* {{{ _php_pgsql_strndup, no strndup should be used */
+static char *_php_pgsql_strndup(const char *s, size_t len)
+{
+ char *new;
+
+ if (NULL == s) {
+ return (char *)NULL;
+ }
+
+ new = (char *) malloc(len + 1);
+
+ if (NULL == new) {
+ return (char *)NULL;
+ }
+
+ new[len] = '\0';
+
+ return memmove(new, s, len);
+}
+/* }}} */
+
/* {{{ PHP_INI
*/
PHP_INI_BEGIN()
@@ -4076,7 +4155,7 @@ PHP_FUNCTION(pg_escape_bytea)
#ifdef HAVE_PQESCAPE_BYTEA_CONN
if (pgsql_link != NULL || id != -1) {
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- to = (char *)PQescapeByteaConn(pgsql, from, (size_t)from_len, &to_len);
+ to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, (size_t)from_len, &to_len);
} else
#endif
to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len);
@@ -4270,10 +4349,9 @@ static char* php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le
#endif
static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_literal) {
- char *from = NULL, *to = NULL, *tmp = NULL;
+ char *from = NULL, *to = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
- int to_len;
int from_len;
int id = -1;
@@ -4294,26 +4372,32 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
}
if (pgsql_link == NULL && id == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get default pgsql link");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (pgsql == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get default pgsql link");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get pgsql link");
RETURN_FALSE;
}
#ifdef HAVE_PQESCAPELITERAL
- if (escape_literal) {
- tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
- } else {
- tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
- }
- if (!tmp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape");
- RETURN_FALSE;
+ /* Use a block with a local var to avoid unused variable warnings */
+ {
+ char *tmp;
+
+ if (escape_literal) {
+ tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
+ } else {
+ tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
+ }
+ if (!tmp) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape");
+ RETURN_FALSE;
+ }
+ to = estrdup(tmp);
+ PQfreemem(tmp);
}
- to = estrdup(tmp);
- PQfreemem(tmp);
#else
to = php_pgsql_PQescapeInternal(pgsql, from, (size_t)from_len, escape_literal);
if (!to) {
@@ -5014,8 +5098,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
{
PGresult *pg_result;
char *src, *tmp_name, *tmp_name2 = NULL;
+ char *escaped;
smart_str querystr = {0};
- int new_len;
+ size_t new_len;
int i, num_rows;
zval *elem;
@@ -5037,20 +5122,33 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
"SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' "
"FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n "
"WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '");
- tmp_name2 = php_addslashes(tmp_name2, strlen(tmp_name2), &new_len, 0 TSRMLS_CC);
- smart_str_appendl(&querystr, tmp_name2, new_len);
-
+ escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1);
+#if HAVE_PQESCAPE_CONN
+ new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL);
+#else
+ new_len = PQescapeString(escaped, tmp_name2, strlen(tmp_name2));
+#endif
+ if (new_len) {
+ smart_str_appends(&querystr, escaped);
+ }
+ efree(escaped);
+
smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '");
- tmp_name = php_addslashes(tmp_name, strlen(tmp_name), &new_len, 0 TSRMLS_CC);
- smart_str_appendl(&querystr, tmp_name, new_len);
+ escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1);
+#if HAVE_PQESCAPE_CONN
+ new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL);
+#else
+ new_len = PQescapeString(escaped, tmp_name, strlen(tmp_name));
+#endif
+ if (new_len) {
+ smart_str_appends(&querystr, escaped);
+ }
+ efree(escaped);
smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;");
smart_str_0(&querystr);
-
- efree(tmp_name2);
- efree(tmp_name);
- efree(src);
-
+ efree(src);
+
pg_result = PQexec(pg_link, querystr.c);
if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name);
@@ -5273,6 +5371,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
assert(Z_TYPE_P(src) == IS_STRING);
assert(should_free == 1 || should_free == 0);
+ smart_str_appendc(&str, 'E');
smart_str_appendc(&str, '\'');
smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
smart_str_appendc(&str, '\'');
@@ -5313,7 +5412,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
uint field_len = -1;
ulong num_idx = -1;
zval *meta, **def, **type, **not_null, **has_default, **is_enum, **val, *new_val;
- int new_len, key_type, err = 0, skip_field;
+ int key_type, err = 0, skip_field;
php_pgsql_data_type data_type;
assert(pg_link != NULL);
@@ -5326,6 +5425,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
MAKE_STD_ZVAL(meta);
array_init(meta);
+
+/* table_name is escaped by php_pgsql_meta_data */
if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
zval_dtor(meta);
FREE_ZVAL(meta);
@@ -5538,15 +5639,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
Z_TYPE_P(new_val) = IS_STRING;
-#if HAVE_PQESCAPE
+#if HAVE_PQESCAPE_CONN
{
char *tmp;
- tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1);
- Z_STRLEN_P(new_val) = (int)PQescapeString(tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
+ tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1);
+ Z_STRLEN_P(new_val) = (int)PQescapeStringConn(pg_link, tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val), NULL);
Z_STRVAL_P(new_val) = tmp;
}
#else
- Z_STRVAL_P(new_val) = php_addslashes(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
+ Z_STRVAL_P(new_val) = (int)PQescapeString(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
#endif
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
}
@@ -5832,10 +5933,11 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
else {
unsigned char *tmp;
size_t to_len;
+ smart_str s = {0};
#ifdef HAVE_PQESCAPE_BYTEA_CONN
- tmp = PQescapeByteaConn(pg_link, Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
+ tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
#else
- tmp = PQescapeBytea(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
+ tmp = PQescapeBytea(Z_STRVAL_PP(val), (unsigned char *)Z_STRLEN_PP(val), &to_len);
#endif
Z_TYPE_P(new_val) = IS_STRING;
Z_STRLEN_P(new_val) = to_len-1; /* PQescapeBytea's to_len includes additional '\0' */
@@ -5843,7 +5945,11 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
memcpy(Z_STRVAL_P(new_val), tmp, to_len);
PQfreemem(tmp);
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
-
+ smart_str_appendl(&s, Z_STRVAL_P(new_val), Z_STRLEN_P(new_val));
+ smart_str_0(&s);
+ efree(Z_STRVAL_P(new_val));
+ Z_STRVAL_P(new_val) = s.c;
+ Z_STRLEN_P(new_val) = s.len;
}
break;
@@ -5928,11 +6034,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
FREE_ZVAL(new_val);
break; /* break out for() */
}
+ /* If field is NULL and HAS DEFAULT, should be skipped */
if (!skip_field) {
- /* If field is NULL and HAS DEFAULT, should be skipped */
- field = php_addslashes(field, strlen(field), &new_len, 0 TSRMLS_CC);
- add_assoc_zval(result, field, new_val);
- efree(field);
+ char *escaped;
+ size_t field_len = strlen(field);
+
+ if (_php_pgsql_detect_identifier_escape(field, field_len) == SUCCESS) {
+ escaped = _php_pgsql_strndup(field, field_len);
+ } else {
+#if HAVE_PQESCAPELITERAL
+ escaped = PQescapeIdentifier(pg_link, field, field_len);
+#else
+ escaped = _php_pgsql_escape_identifier(field, field_len);
+#endif
+ }
+ add_assoc_zval(result, escaped, new_val);
+ free(escaped);
}
} /* for */
zval_dtor(meta);
@@ -6007,6 +6124,45 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
return -1;
}
+static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table)
+{
+ char *table_copy, *escaped, *token, *tmp;
+ size_t len;
+
+ /* schame.table should be "schame"."table" */
+ table_copy = estrdup(table);
+ token = php_strtok_r(table_copy, ".", &tmp);
+ len = strlen(token);
+ if (_php_pgsql_detect_identifier_escape(token, len) == SUCCESS) {
+ escaped = _php_pgsql_strndup(token, len);
+ } else {
+#if HAVE_PQESCAPELITERAL
+ escaped = PQescapeIdentifier(pg_link, token, len);
+#else
+ escaped = _php_pgsql_escape_identifier(token, len);
+#endif
+ }
+ smart_str_appends(querystr, escaped);
+ free(escaped);
+ if (tmp && *tmp) {
+ len = strlen(tmp);
+ /* "schema"."table" format */
+ if (_php_pgsql_detect_identifier_escape(tmp, len) == SUCCESS) {
+ escaped = _php_pgsql_strndup(tmp, len);
+ } else {
+#if HAVE_PQESCAPELITERAL
+ escaped = PQescapeIdentifier(pg_link, tmp, len);
+#else
+ escaped = _php_pgsql_escape_identifier(tmp, len);
+#endif
+ }
+ smart_str_appendc(querystr, '.');
+ smart_str_appends(querystr, escaped);
+ free(escaped);
+ }
+ efree(table_copy);
+}
+
/* {{{ php_pgsql_insert
*/
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC)
@@ -6026,7 +6182,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) {
smart_str_appends(&querystr, "INSERT INTO ");
- smart_str_appends(&querystr, table);
+ build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " DEFAULT VALUES");
goto no_values;
@@ -6041,11 +6197,11 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
}
var_array = converted;
}
-
+
smart_str_appends(&querystr, "INSERT INTO ");
- smart_str_appends(&querystr, table);
+ build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " (");
-
+
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos);
while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld,
&fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
@@ -6232,7 +6388,7 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var
}
smart_str_appends(&querystr, "UPDATE ");
- smart_str_appends(&querystr, table);
+ build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " SET ");
if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), 0, ",", 1 TSRMLS_CC))
@@ -6333,7 +6489,7 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids
}
smart_str_appends(&querystr, "DELETE FROM ");
- smart_str_appends(&querystr, table);
+ build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " WHERE ");
if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC))
@@ -6469,7 +6625,7 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids
}
smart_str_appends(&querystr, "SELECT * FROM ");
- smart_str_appends(&querystr, table);
+ build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " WHERE ");
if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC))
diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt
index 3167069169..67ef262fca 100644
--- a/ext/pgsql/tests/09notice.phpt
+++ b/ext/pgsql/tests/09notice.phpt
@@ -10,7 +10,7 @@ _skip_lc_messages();
?>
--INI--
pgsql.log_notice=1
-pgsql.ignore_notices=0
+pgsql.ignore_notice=0
--FILE--
<?php
include 'config.inc';
diff --git a/ext/pgsql/tests/10pg_convert.phpt b/ext/pgsql/tests/10pg_convert.phpt
index fde4c67d37..adc2756e25 100644
--- a/ext/pgsql/tests/10pg_convert.phpt
+++ b/ext/pgsql/tests/10pg_convert.phpt
@@ -20,10 +20,10 @@ var_dump($converted);
?>
--EXPECT--
array(3) {
- ["num"]=>
+ [""num""]=>
string(4) "1234"
- ["str"]=>
- string(5) "'AAA'"
- ["bin"]=>
- string(5) "'BBB'"
-}
+ [""str""]=>
+ string(6) "E'AAA'"
+ [""bin""]=>
+ string(6) "E'BBB'"
+} \ No newline at end of file
diff --git a/ext/pgsql/tests/10pg_convert_9.phpt b/ext/pgsql/tests/10pg_convert_9.phpt
index bb2e7e6d2a..827c96250d 100644
--- a/ext/pgsql/tests/10pg_convert_9.phpt
+++ b/ext/pgsql/tests/10pg_convert_9.phpt
@@ -21,10 +21,10 @@ var_dump($converted);
?>
--EXPECT--
array(3) {
- ["num"]=>
+ [""num""]=>
string(4) "1234"
- ["str"]=>
- string(5) "'AAA'"
- ["bin"]=>
- string(11) "'\\x424242'"
-}
+ [""str""]=>
+ string(6) "E'AAA'"
+ [""bin""]=>
+ string(12) "E'\\x424242'"
+} \ No newline at end of file
diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt
index 66304944b0..9fd0dd1e3b 100644
--- a/ext/pgsql/tests/12pg_insert.phpt
+++ b/ext/pgsql/tests/12pg_insert.phpt
@@ -20,5 +20,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
--EXPECT--
-INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB');
-Ok
+INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'BBB');
+Ok \ No newline at end of file
diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt
index 8afae0df91..329364ad64 100644
--- a/ext/pgsql/tests/12pg_insert_9.phpt
+++ b/ext/pgsql/tests/12pg_insert_9.phpt
@@ -22,5 +22,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
--EXPECT--
-INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','\\x424242');
-Ok
+INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242');
+Ok \ No newline at end of file
diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt
index f1504a8b17..db2ca06bf8 100644
--- a/ext/pgsql/tests/13pg_select.phpt
+++ b/ext/pgsql/tests/13pg_select.phpt
@@ -33,5 +33,5 @@ array(1) {
string(3) "BBB"
}
}
-SELECT * FROM php_pgsql_test WHERE num=1234;
+SELECT * FROM "php_pgsql_test" WHERE "num"=1234;
Ok
diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt
index 422c461b60..67adc9d21d 100644
--- a/ext/pgsql/tests/13pg_select_9.phpt
+++ b/ext/pgsql/tests/13pg_select_9.phpt
@@ -35,5 +35,5 @@ array(1) {
string(8) "\x424242"
}
}
-SELECT * FROM php_pgsql_test WHERE num=1234;
-Ok
+SELECT * FROM "php_pgsql_test" WHERE "num"=1234;
+Ok \ No newline at end of file
diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt
index 3260f2b73e..347cac9447 100644
--- a/ext/pgsql/tests/14pg_update.phpt
+++ b/ext/pgsql/tests/14pg_update.phpt
@@ -21,5 +21,5 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
--EXPECT--
-UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234;
-Ok
+UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'XYZ' WHERE "num"=1234;
+Ok \ No newline at end of file
diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt
index bc5cf673e3..e766c1f380 100644
--- a/ext/pgsql/tests/14pg_update_9.phpt
+++ b/ext/pgsql/tests/14pg_update_9.phpt
@@ -23,5 +23,5 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
--EXPECT--
-UPDATE php_pgsql_test SET num=1234,str='ABC',bin='\\x58595a' WHERE num=1234;
-Ok
+UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234;
+Ok \ No newline at end of file
diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt
index 573742c6e4..cad5fb3a12 100644
--- a/ext/pgsql/tests/80_bug32223.phpt
+++ b/ext/pgsql/tests/80_bug32223.phpt
@@ -15,6 +15,8 @@ end;
' LANGUAGE plpgsql;");
if (!$res) die('skip PLPGSQL not available');
?>
+--INI--
+pgsql.ignore_notice=0
--FILE--
<?php
diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt
index aada3f01ba..e79685c43d 100644
--- a/ext/pgsql/tests/80_bug32223b.phpt
+++ b/ext/pgsql/tests/80_bug32223b.phpt
@@ -15,6 +15,8 @@ end;
' LANGUAGE plpgsql;");
if (!$res) die('skip PLPGSQL not available');
?>
+--INI--
+pgsql.ignore_notice=0
--FILE--
<?php
diff --git a/ext/pgsql/tests/bug47199.phpt b/ext/pgsql/tests/bug47199.phpt
index 5bfac0b1bb..faa787fd54 100644
--- a/ext/pgsql/tests/bug47199.phpt
+++ b/ext/pgsql/tests/bug47199.phpt
@@ -52,8 +52,8 @@ array(2) {
string(1) "2"
}
}
-DELETE FROM test_47199 WHERE null_field IS NULL AND not_null_field=2;
-UPDATE test_47199 SET null_field=NULL,not_null_field=0 WHERE not_null_field=1 AND null_field IS NULL;
+DELETE FROM "test_47199" WHERE "null_field" IS NULL AND "not_null_field"=2;
+UPDATE "test_47199" SET "null_field"=NULL,"not_null_field"=0 WHERE "not_null_field"=1 AND "null_field" IS NULL;
array(1) {
[0]=>
array(2) {
diff --git a/ext/pgsql/tests/bug64609.phpt b/ext/pgsql/tests/bug64609.phpt
index 0df63012da..72fac7648e 100644
--- a/ext/pgsql/tests/bug64609.phpt
+++ b/ext/pgsql/tests/bug64609.phpt
@@ -25,6 +25,6 @@ var_dump($converted);
?>
--EXPECT--
array(1) {
- ["a"]=>
- string(4) "'ok'"
-}
+ [""a""]=>
+ string(5) "E'ok'"
+} \ No newline at end of file
diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc
index 2b5f05a71d..d4bbb33824 100644
--- a/ext/pgsql/tests/config.inc
+++ b/ext/pgsql/tests/config.inc
@@ -2,7 +2,7 @@
// These vars are used to connect db and create test table.
// values can be set to meet your environment
-$conn_str = "host=localhost dbname=test"; // connection string
+$conn_str = "host=localhost dbname=test port=5432"; // connection string
$table_name = "php_pgsql_test"; // test table that should be exist
$num_test_record = 1000; // Number of records to create
diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt
index abb65be142..a98c95dc4c 100644
--- a/ext/pgsql/tests/pg_delete_001.phpt
+++ b/ext/pgsql/tests/pg_delete_001.phpt
@@ -45,8 +45,8 @@ pg_query('DROP SCHEMA phptests');
?>
--EXPECTF--
-string(37) "DELETE FROM foo WHERE id=1 AND id2=2;"
-string(46) "DELETE FROM phptests.foo WHERE id=2 AND id2=3;"
+string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;"
+string(54) "DELETE FROM "phptests"."foo" WHERE "id"=2 AND "id2"=3;"
array(2) {
[0]=>
array(2) {
diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt
index 7d27219187..626d4d0f82 100644
--- a/ext/pgsql/tests/pg_insert_001.phpt
+++ b/ext/pgsql/tests/pg_insert_001.phpt
@@ -28,7 +28,7 @@ pg_query('DROP SCHEMA phptests');
--EXPECTF--
Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d
-string(47) "INSERT INTO phptests.foo (id,id2) VALUES (1,2);"
+string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);"
array(1) {
[0]=>
array(2) {
diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt
index 95fa692568..60db35c157 100644
--- a/ext/pgsql/tests/pg_update_001.phpt
+++ b/ext/pgsql/tests/pg_update_001.phpt
@@ -35,8 +35,8 @@ pg_query('DROP SCHEMA phptests');
?>
--EXPECT--
-string(32) "UPDATE foo SET id=10 WHERE id=1;"
-string(43) "UPDATE phptests.foo SET id=100 WHERE id2=2;"
+string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;"
+string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;"
array(2) {
["id"]=>
string(2) "10"
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index c5042cc34a..c85687ef5c 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -2579,6 +2579,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
php_serialize_data_t metadata_hash;
smart_str main_metadata_str = {0};
int free_user_stub, free_fp = 1, free_ufp = 1;
+ int manifest_hack = 0;
if (phar->is_persistent) {
if (error) {
@@ -2930,6 +2931,12 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
manifest_len = offset + phar->alias_len + sizeof(manifest) + main_metadata_str.len;
phar_set_32(manifest, manifest_len);
+ /* Hack - see bug #65028, add padding byte to the end of the manifest */
+ if(manifest[0] == '\r' || manifest[0] == '\n') {
+ manifest_len++;
+ phar_set_32(manifest, manifest_len);
+ manifest_hack = 1;
+ }
phar_set_32(manifest+4, new_manifest_count);
if (has_dirs) {
*(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF);
@@ -3054,6 +3061,22 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
return EOF;
}
}
+ /* Hack - see bug #65028, add padding byte to the end of the manifest */
+ if(manifest_hack) {
+ if(1 != php_stream_write(newfile, manifest, 1)) {
+ if (closeoldfile) {
+ php_stream_close(oldfile);
+ }
+
+ php_stream_close(newfile);
+
+ if (error) {
+ spprintf(error, 0, "unable to write manifest padding byte");
+ }
+
+ return EOF;
+ }
+ }
/* now copy the actual file data to the new phar */
offset = php_stream_tell(newfile);
diff --git a/ext/phar/tests/bug65028.phpt b/ext/phar/tests/bug65028.phpt
new file mode 100644
index 0000000000..74273b850b
--- /dev/null
+++ b/ext/phar/tests/bug65028.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Phar - test specific manifest length
+--INI--
+phar.readonly=0
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--FILE--
+<?php
+
+$files = array(
+ "lib/widgets/Widgets.php",
+ "lib/events/FormBeginEventArgs.php",
+ "lib/events/FormEndEventArgs.php",
+ "lib/Core.php",
+ "lib/database/MySqlDatabase.php",
+ "lib/utils/DateUtil.php",
+ "js/global.js",
+ "files/_emptyDirectory",
+ "files/search/schema.xml",
+ "vendor/Fusonic/Linq/Internal/WhereIterator.php",
+ "vendor/Fusonic/Linq/Internal/SelectManyIterator.php",
+ "vendor/Fusonic/Linq/Internal/SelectIterator.php",
+ "vendor/Fusonic/Linq/Internal/DiffIterator.php",
+ "vendor/Fusonic/Linq/Internal/GroupIterator.php",
+ "vendor/Fusonic/Linq/Internal/DistinctIterator.php",
+ "vendor/Fusonic/Linq/Internal/LinqHelper.php",
+ "vendor/Fusonic/Linq/Internal/OrderIterator.php",
+ "vendor/Fusonic/Linq/Internal/IntersectIterator.php",
+ "vendor/Fusonic/Linq/GroupedLinq.php",
+ "vendor/Fusonic/Linq.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormBegin.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php",
+ "vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php",
+ "vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormEnd.php",
+ "vendor/Fusonic/UI/Widgets/WidgetBase.php",
+ "modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php",
+ "modules/calendar/js/calendarAppointmentForm.js",
+ "modules/calendar/misc/calendarAppointment.php",
+ "modules/calendar/pages/forms/calendarAppointmentForm.php",
+ "modules/calendar/setup/config.xml",
+ "modules/cmt/js/cmtMicroCommentsWidget.js",
+ "modules/cmt/setup/config.xml",
+ "modules/meta/misc/metaContentHelper.php",
+ "modules/meta/setup/config.xml",
+ "modules/brd/misc/brdPostStreamFormatter.php",
+ "modules/brd/misc/brdPost.php",
+ "modules/brd/setup/config/streamContents.xml",
+ "modules/brd/setup/resources/lang/en.xml",
+ "modules/brd/setup/resources/lang/de.xml",
+ "modules/brd/setup/config.xml",
+ "modules/auth/misc/authLoginService.php",
+ "modules/auth/setup/config.xml",
+ "modules/bwd/cache/bwdWordCacheCreator.php",
+ "modules/bwd/bwd.php",
+ "modules/bwd/setup/config.xml",
+ "modules/nws/templates/pages/forms/nwsNewsForm.tpl",
+ "modules/nws/templates/pages/nwsShowNewsPage.tpl",
+ "modules/nws/pages/forms/nwsNewsForm.php",
+ "modules/nws/pages/nwsShowNewsPage.php",
+ "modules/nws/setup/config.xml",
+ "modules/gmp/cache/gmpMarkersCacheCreator.php",
+ "modules/gmp/select/gmpMapContentSelect.php",
+ "modules/gmp/templates/gmpShowAppointmentPage.tpl",
+ "modules/gmp/templates/gmpShowLinkPage.tpl",
+ "modules/gmp/setup/config.xml",
+ "modules/mul/cache/mulVideoPortalCacheCreator.php",
+ "modules/mul/misc/mulPermissionHelper.php",
+ "modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl",
+ "modules/mul/setup/config/mulUploadVideoPortalMatches.xml",
+ "modules/mul/setup/config.xml",
+ "modules/cat/select/catCategorySelect.php",
+ "modules/cat/misc/catCategory.php",
+ "modules/cat/templates/pages/forms/catCategoryForm.tpl",
+ "modules/cat/pages/forms/catEditCategoryForm.php",
+ "modules/cat/pages/forms/catAddCategoryForm.php",
+ "modules/cat/setup/config.xml",
+ "modules/sty/events/styPageShowEventHandler.php",
+ "modules/sty/misc/styBox.php",
+ "modules/sty/templates/pages/forms/styLayoutForm.tpl",
+ "modules/sty/templates/pages/forms/styBoxForm.tpl",
+ "modules/sty/templates/pages/forms/styVariantForm.tpl",
+ "modules/sty/setup/resources/lang/en.xml",
+ "modules/sty/setup/resources/lang/de.xml",
+ "modules/sty/setup/config.xml",
+ "modules/reg/misc/regRegistrationHelper.php",
+ "modules/reg/setup/config.xml",
+ "modules/not/misc/notEmailNotificationProvider.php",
+ "modules/not/setup/config.xml",
+ "modules/styfusonic/setup/config.xml",
+ "modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php",
+ "modules/sys/js/sysUserAutoSuggestSelect.js",
+ "modules/sys/select/sysPermissionSelect.php",
+ "modules/sys/misc/sysHtaccessConfigWriter.php",
+ "modules/sys/misc/sysUserRepository.php",
+ "modules/sys/setup/resources/lang/en.xml",
+ "modules/sys/setup/resources/lang/de.xml",
+ "modules/sys/setup/config.xml",
+ "modules/igr/boxes/igrGreatestEntriesBoxTab.php",
+ "modules/igr/boxes/igrTopRatedEntriesBoxTab.php",
+ "modules/igr/setup/config.xml",
+ "modules/rat/ajax/ratRateAjaxHandler.php",
+ "modules/rat/ajax/ratUnlikeAjaxHandler.php",
+ "modules/rat/setup/config.xml",
+ "modules/search/select/searchModuleSelect.php",
+ "modules/search/select/searchOrderSelect.php",
+ "modules/search/misc/searchResultFormatter.php",
+ "modules/search/misc/searchProviderSolr.php",
+ "modules/search/misc/searchProviderLucene.php",
+ "modules/search/misc/searchResultItem.php",
+ "modules/search/misc/searchProviderBase.php",
+ "modules/search/misc/searchIProvider.php",
+ "modules/search/templates/misc/searchResultFormatter.tpl",
+ "modules/search/templates/pages/searchIndexPage.tpl",
+ "modules/search/templates/pages/forms/searchSearchForm.tpl",
+ "modules/search/pages/forms/searchSearchForm.php",
+ "modules/search/css/searchResultFormatter.css",
+ "modules/search/setup/config/sysSettings.xml",
+ "modules/search/setup/resources/lang/en.xml",
+ "modules/search/setup/resources/lang/de.xml",
+ "modules/search/setup/config.xml",
+ "style/Fusonic/40components.css",
+ "style/_emptyDirectory",
+ "index.php",
+// "a", // This will make the test pass
+);
+
+// Create Phar with the filenames above
+$phar = new Phar(__DIR__ . "/bug65028.phar");
+foreach($files as $file)
+{
+ $phar->addFromString($file, "");
+}
+
+// Copy phar
+copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar");
+
+// Open phar
+try
+{
+ $phar = new Phar(__DIR__ . "/bug65028-copy.phar");
+ echo "No exception thrown.\n";
+}
+catch(UnexpectedValueException $ex)
+{
+ echo "Exception thrown: " . $ex->getMessage() . "\n";
+}
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . "/bug65028.phar");
+@unlink(__DIR__ . "/bug65028-copy.phar");
+?>
+--EXPECT--
+No exception thrown.
+
diff --git a/ext/posix/tests/posix_ctermid.phpt b/ext/posix/tests/posix_ctermid.phpt
index f77da00aab..551ed7304e 100644
--- a/ext/posix/tests/posix_ctermid.phpt
+++ b/ext/posix/tests/posix_ctermid.phpt
@@ -13,7 +13,7 @@ PHP Testfest Berlin 2009-05-10
}
// needed because of #ifdef HAVE_CTERMID in posix.c
if (!function_exists('posix_ctermid')) {
- die('SKIP - Fuction posix_ctermid() not available');
+ die('SKIP - Function posix_ctermid() not available');
}
?>
--FILE--
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 6c4d806236..c4a7c554f0 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5237,7 +5237,7 @@ ZEND_METHOD(reflection_extension, getVersion)
/* }}} */
/* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions()
- Returns an array of this extension's fuctions */
+ Returns an array of this extension's functions */
ZEND_METHOD(reflection_extension, getFunctions)
{
reflection_object *intern;
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
index 465e868cfa..dfec951f79 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-ReflectionExtension::getClassNames() method on an extension which acually returns some information
+ReflectionExtension::getClassNames() method on an extension which actually returns some information
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>
--FILE--
diff --git a/ext/session/session.c b/ext/session/session.c
index 3879edcce6..e699cb9b5c 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -281,7 +281,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
PHP_MD5_CTX md5_context;
PHP_SHA1_CTX sha1_context;
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
- void *hash_context;
+ void *hash_context = NULL;
#endif
unsigned char *digest;
int digest_len;
@@ -341,7 +341,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
unsigned char rbuf[2048];
size_t toread = PS(entropy_length);
- if (php_win32_get_random_bytes(rbuf, (size_t) toread) == SUCCESS){
+ if (php_win32_get_random_bytes(rbuf, MIN(toread, sizeof(rbuf))) == SUCCESS){
switch (PS(hash_func)) {
case PS_HASH_FUNC_MD5:
@@ -733,7 +733,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir,save_path, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateName, session_name, php_ps_globals, ps_globals)
PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
- STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
+ STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_PERDIR, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateLong, gc_probability, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.gc_divisor", "100", PHP_INI_ALL, OnUpdateLong, gc_divisor, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateLong, gc_maxlifetime, php_ps_globals, ps_globals)
@@ -1052,7 +1052,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */
res = php_gmtime_r(when, &tm);
if (!res) {
- buf[0] = '\0';
+ ubuf[0] = '\0';
return;
}
@@ -2246,8 +2246,11 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */
PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
#endif
- /* restore the orig callback */
- php_rfc1867_callback = php_session_rfc1867_orig_callback;
+ /* reset rfc1867 callbacks */
+ php_session_rfc1867_orig_callback = NULL;
+ if (php_rfc1867_callback == php_session_rfc1867_callback) {
+ php_rfc1867_callback = NULL;
+ }
ps_serializers[PREDEFINED_SERIALIZERS].name = NULL;
memset(&ps_modules[PREDEFINED_MODULES], 0, (MAX_MODULES-PREDEFINED_MODULES)*sizeof(ps_module *));
diff --git a/ext/session/tests/020.phpt b/ext/session/tests/020.phpt
index f43bac5d1f..0141129820 100644
--- a/ext/session/tests/020.phpt
+++ b/ext/session/tests/020.phpt
@@ -1,5 +1,5 @@
--TEST--
-rewriter uses arg_seperator.output for modifying URLs
+rewriter uses arg_separator.output for modifying URLs
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
diff --git a/ext/session/tests/bug50308.phpt b/ext/session/tests/bug50308.phpt
new file mode 100644
index 0000000000..110277ce3c
--- /dev/null
+++ b/ext/session/tests/bug50308.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #50308 (session id not appended properly for empty anchor tags)
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.name=PHPSESSID
+session.save_handler=files
+session.use_trans_sid=1
+session.use_only_cookies=0
+--FILE--
+<?php
+@session_start();
+?>
+<a href=""/>
+<a href="" />
+<a href="foo"/>
+<a href="foo" />
+<a href=foo/>
+<a href=/>
+<a href=?foo=bar/>
+<a href="?foo=bar"/>
+--EXPECTF--
+<a href="?PHPSESSID=%s"/>
+<a href="?PHPSESSID=%s" />
+<a href="foo?PHPSESSID=%s"/>
+<a href="foo?PHPSESSID=%s" />
+<a href=foo/?PHPSESSID=%s>
+<a href=/?PHPSESSID=%s>
+<a href=?foo=bar/&PHPSESSID=%s>
+<a href="?foo=bar&PHPSESSID=%s"/>
diff --git a/ext/session/tests/session_status_disabled.phpt b/ext/session/tests/session_status_disabled.phpt
index 24e0ecd7bf..c4d1f2192d 100644
--- a/ext/session/tests/session_status_disabled.phpt
+++ b/ext/session/tests/session_status_disabled.phpt
@@ -3,7 +3,7 @@ Test session_status() function : disabled
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
-session.save_handler=non-existant
+session.save_handler=non-existent
--FILE--
<?php
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 692516840b..2358f2be65 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1070,7 +1070,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{
int namelen;
int test;
char use_iter;
- zval *iter_data;
+ zval *iter_data = NULL;
use_iter = 0;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 727328b407..93c2b21ddc 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -514,7 +514,7 @@ static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS
static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type, const char *format, ...)
{
va_list args;
- php_snmp_object *snmp_object;
+ php_snmp_object *snmp_object = NULL;
if (object) {
snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC);
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php
index 5b978734e8..b8ee893d8d 100644
--- a/ext/soap/interop/client_round2_interop.php
+++ b/ext/soap/interop/client_round2_interop.php
@@ -300,7 +300,7 @@ class Interop_Client
/**
* decodeSoapval
- * decodes a soap value to php type, used for test result comparisions
+ * decodes a soap value to php type, used for test result comparisons
*
* @param SOAP_Value soapval
* @return mixed result
@@ -398,7 +398,7 @@ class Interop_Client
$namespace = $soapaction = 'http://soapinterop.org/';
// hack to make tests work with MS SoapToolkit
// it's the only one that uses this soapaction, and breaks if
- // it isn't right. Can't wait for soapaction to be fully depricated
+ // it isn't right. Can't wait for soapaction to be fully deprecated
if ($this->currentTest == 'base' &&
strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) {
$soapaction = 'urn:soapinterop';
diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php
index 1ae25d92f0..fc12bc8cb7 100644
--- a/ext/soap/interop/index.php
+++ b/ext/soap/interop/index.php
@@ -35,7 +35,7 @@ classes to define what the type of the value is.</p>
<h3>Client Test Interface</h3>
<p>The <a href="client_round2.php">client interface</a> allows you to run the PHP SOAP
-Client against a choosen interop server. Each run updates the results database below.</p>
+Client against a chosen interop server. Each run updates the results database below.</p>
<h3>Interop Client Test Results</h3>
<p>This is a database of the current test results using PHP SOAP Clients against interop servers.</p>
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 7d2e129746..25bb177273 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -1081,6 +1081,14 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp
nsptr = xmlSearchNs(groupType->doc, groupType, BAD_CAST(ns));
if (nsptr != NULL) {
smart_str_appends(&key, (char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(groupType->properties, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&key, (char*)ns->children->content);
+ }
}
smart_str_appendc(&key, ':');
smart_str_appends(&key, type);
@@ -1509,6 +1517,14 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
if (nsptr != NULL) {
smart_str_appends(&nscat, (char*)nsptr->href);
newType->namens = estrdup((char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(attrs, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&nscat, (char*)ns->children->content);
+ }
}
smart_str_appendc(&nscat, ':');
smart_str_appends(&nscat, type);
@@ -1735,6 +1751,14 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
if (nsptr != NULL) {
smart_str_appends(&key, (char*)nsptr->href);
newAttr->namens = estrdup((char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(attrType->properties, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&key, (char*)ns->children->content);
+ }
}
smart_str_appendc(&key, ':');
smart_str_appends(&key, attr_name);
@@ -2036,13 +2060,31 @@ static void copy_extra_attribute(void *attribute)
}
}
+static void* schema_find_by_ref(HashTable *ht, char *ref)
+{
+ void **tmp;
+
+ if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
+ return tmp;
+ } else {
+ ref = strrchr(ref, ':');
+ if (ref) {
+ if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
+ return tmp;
+ }
+ }
+ }
+ return NULL;
+}
+
static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
{
sdlAttributePtr *tmp;
if (attr->ref != NULL) {
if (ctx->attributes != NULL) {
- if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlAttributePtr*)schema_find_by_ref(ctx->attributes, attr->ref);
+ if (tmp) {
schema_attribute_fixup(ctx, *tmp);
if ((*tmp)->name != NULL && attr->name == NULL) {
attr->name = estrdup((*tmp)->name);
@@ -2092,7 +2134,8 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
if (attr->ref != NULL) {
if (ctx->attributeGroups != NULL) {
- if (zend_hash_find(ctx->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlTypePtr*)schema_find_by_ref(ctx->attributeGroups, attr->ref);
+ if (tmp) {
if ((*tmp)->attributes) {
zend_hash_internal_pointer_reset((*tmp)->attributes);
while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
@@ -2149,7 +2192,7 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
model->kind = XSD_CONTENT_GROUP;
model->u.group = (*tmp);
} else {
- soap_error0(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute");
+ soap_error1(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute '%s'", model->u.group_ref);
}
break;
}
@@ -2193,7 +2236,8 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
if (type->ref != NULL) {
if (ctx->sdl->elements != NULL) {
- if (zend_hash_find(ctx->sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlTypePtr*)schema_find_by_ref(ctx->sdl->elements, type->ref);
+ if (tmp) {
type->kind = (*tmp)->kind;
type->encode = (*tmp)->encode;
if ((*tmp)->nillable) {
@@ -2209,7 +2253,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
} else if (strcmp(type->ref, SCHEMA_NAMESPACE ":schema") == 0) {
type->encode = get_conversion(XSD_ANYXML);
} else {
- soap_error0(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute");
+ soap_error1(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute '%s'", type->ref);
}
}
efree(type->ref);
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 2a7299eced..9371df6fb4 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1284,7 +1284,7 @@ PHP_METHOD(SoapServer, setClass)
}
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existant class (%s)", classname);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existent class (%s)", classname);
return;
}
@@ -1415,7 +1415,7 @@ PHP_METHOD(SoapServer, addFunction)
zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len);
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_PP(tmp_function));
return;
}
@@ -1437,7 +1437,7 @@ PHP_METHOD(SoapServer, addFunction)
zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len);
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name));
return;
}
if (service->soap_functions.ft == NULL) {
@@ -3658,7 +3658,44 @@ ignore_header:
return function;
}
-static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main TSRMLS_DC)
+static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version)
+{
+ zval **tmp;
+
+ if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) {
+ if (version == SOAP_1_1) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1"));
+ } else {
+ xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true"));
+ }
+ }
+ if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) {
+ if (Z_TYPE_PP(tmp) == IS_STRING) {
+ if (version == SOAP_1_1) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp)));
+ } else {
+ xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp)));
+ }
+ } else if (Z_TYPE_PP(tmp) == IS_LONG) {
+ if (version == SOAP_1_1) {
+ if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT));
+ }
+ } else {
+ if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT));
+ } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE));
+ } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
+ xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER));
+ }
+ }
+ }
+ }
+}
+
+static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main, xmlNodePtr *node TSRMLS_DC)
{
xmlNodePtr method = NULL, param;
sdlParamPtr parameter = NULL;
@@ -3758,6 +3795,9 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch
if (use == SOAP_ENCODED && version == SOAP_1_2 && method != NULL) {
xmlSetNsProp(method, body->ns, BAD_CAST("encodingStyle"), BAD_CAST(SOAP_1_2_ENC_NAMESPACE));
}
+ if (node) {
+ *node = method;
+ }
return use;
}
@@ -3839,7 +3879,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
}
if (headers->function) {
- if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) {
+ if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0, NULL TSRMLS_CC) == SOAP_ENCODED) {
use = SOAP_ENCODED;
}
} else {
@@ -4025,15 +4065,15 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
zval *hdr_ret = &h->retval;
char *hdr_ns = h->hdr?h->hdr->ns:NULL;
char *hdr_name = Z_STRVAL(h->function_name);
-
+ HashTable *ht = NULL;
if (Z_TYPE(h->retval) == IS_OBJECT &&
instanceof_function(Z_OBJCE(h->retval), soap_header_class_entry TSRMLS_CC)) {
- HashTable* ht = Z_OBJPROP(h->retval);
zval **tmp;
sdlSoapBindingFunctionHeaderPtr *hdr;
smart_str key = {0};
+ ht = Z_OBJPROP(h->retval);
if (zend_hash_find(ht, "namespace", sizeof("namespace"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
smart_str_appendl(&key, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
@@ -4064,9 +4104,14 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
}
if (h->function) {
- if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) {
+ xmlNodePtr xmlHdr = NULL;
+
+ if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0, &xmlHdr TSRMLS_CC) == SOAP_ENCODED) {
use = SOAP_ENCODED;
}
+ if (ht) {
+ set_soap_header_attributes(xmlHdr, ht, version);
+ }
} else {
xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head TSRMLS_CC);
if (hdr_name) {
@@ -4076,6 +4121,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
xmlNsPtr nsptr = encode_add_ns(xmlHdr,hdr_ns);
xmlSetNs(xmlHdr, nsptr);
}
+ if (ht) {
+ set_soap_header_attributes(xmlHdr, ht, version);
+ }
}
}
h = h->next;
@@ -4089,7 +4137,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL);
- if (serialize_response_call2(body, function, function_name, uri, ret, version, 1 TSRMLS_CC) == SOAP_ENCODED) {
+ if (serialize_response_call2(body, function, function_name, uri, ret, version, 1, NULL TSRMLS_CC) == SOAP_ENCODED) {
use = SOAP_ENCODED;
}
@@ -4281,38 +4329,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
}
nsptr = encode_add_ns(h, Z_STRVAL_PP(ns));
xmlSetNs(h, nsptr);
-
- if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) {
- if (version == SOAP_1_1) {
- xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1"));
- } else {
- xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true"));
- }
- }
- if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_STRING) {
- if (version == SOAP_1_1) {
- xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp)));
- } else {
- xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp)));
- }
- } else if (Z_TYPE_PP(tmp) == IS_LONG) {
- if (version == SOAP_1_1) {
- if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
- xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT));
- }
- } else {
- if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
- xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT));
- } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) {
- xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE));
- } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
- xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER));
- }
- }
- }
- }
+ set_soap_header_attributes(h, ht, version);
}
zend_hash_move_forward(soap_headers);
}
diff --git a/ext/soap/tests/bugs/bug28985.phpt b/ext/soap/tests/bugs/bug28985.phpt
index 59d96e2c77..73ff899c39 100644
--- a/ext/soap/tests/bugs/bug28985.phpt
+++ b/ext/soap/tests/bugs/bug28985.phpt
@@ -44,10 +44,10 @@ array(42) {
string iUserPassword;
}"
[8]=>
- string(86) "struct MGCodeLibelle {
+ string(87) "struct MGCodeLibelle {
string Code;
string Libelle;
- boolean Defaut;
+ boolean Default;
anyType Tag;
}"
[9]=>
@@ -203,4 +203,4 @@ array(42) {
string(76) "struct GetEnvironnementResponse {
MGEnvironnement GetEnvironnementResult;
}"
-} \ No newline at end of file
+}
diff --git a/ext/soap/tests/bugs/bug28985.wsdl b/ext/soap/tests/bugs/bug28985.wsdl
index ee528818bb..50c2fcda84 100644
--- a/ext/soap/tests/bugs/bug28985.wsdl
+++ b/ext/soap/tests/bugs/bug28985.wsdl
@@ -67,7 +67,7 @@ type="s:string" />
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Libelle"
type="s:string" />
- <s:element minOccurs="1" maxOccurs="1" name="Defaut"
+ <s:element minOccurs="1" maxOccurs="1" name="Default"
type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="Tag" />
</s:sequence>
diff --git a/ext/soap/tests/bugs/bug65018.phpt b/ext/soap/tests/bugs/bug65018.phpt
new file mode 100644
index 0000000000..bbb9b5e42d
--- /dev/null
+++ b/ext/soap/tests/bugs/bug65018.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #65018 (SoapHeader problems with SoapServer)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ class Tool{
+ public function TOKEN($id){
+ return new SoapHeader('namespace1', 'TOKEN', $id, true);
+ }
+ public function Method(){}
+ }
+
+ $input = $input =
+ '<?xml version="1.0"?>'.PHP_EOL.
+ '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'.
+ ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
+ ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'.
+ '<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'.
+ '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
+
+ $soap = new SoapServer(null, array('uri' => '127.0.0.1'));
+ $soap->setClass('Tool');
+ $soap->handle($input);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1" xmlns:ns2="127.0.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns1:TOKEN SOAP-ENV:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header><SOAP-ENV:Body><ns2:MethodResponse><return xsi:nil="true"/></ns2:MethodResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 0c0380861a..d0d0294647 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -352,7 +352,7 @@ const zend_function_entry sockets_functions[] = {
PHP_FE(socket_clear_error, arginfo_socket_clear_error)
PHP_FE(socket_import_stream, arginfo_socket_import_stream)
- /* for downwards compatability */
+ /* for downwards compatibility */
PHP_FALIAS(socket_getopt, socket_get_option, arginfo_socket_get_option)
PHP_FALIAS(socket_setopt, socket_set_option, arginfo_socket_set_option)
diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc
index 37676e0537..451d05da32 100644
--- a/ext/spl/internal/iteratoriterator.inc
+++ b/ext/spl/internal/iteratoriterator.inc
@@ -17,7 +17,7 @@
* an Iterator. It is very important to understand that most classes that do
* not implement Iterator have their reasone to. Most likely they do not allow
* the full Iterator feature set. If so you need to provide techniques to
- * prevent missuse. If you do not you must expect exceptions or fatal erros.
+ * prevent missuse. If you do not you must expect exceptions or fatal errors.
*
* It is also possible to derive the class and implement IteratorAggregate by
* downcasting the instances returned in getIterator. See the following
diff --git a/ext/spl/internal/multipleiterator.inc b/ext/spl/internal/multipleiterator.inc
index 2ed71d53a7..12df011ecc 100644
--- a/ext/spl/internal/multipleiterator.inc
+++ b/ext/spl/internal/multipleiterator.inc
@@ -163,7 +163,7 @@ class MultipleIterator implements Iterator
$retval = array();
foreach($this->iterators as $iter)
{
- if ($it->valid())
+ if ($iter->valid())
{
if ($this->flags & self::MIT_KEYS_ASSOC)
{
@@ -205,7 +205,7 @@ class MultipleIterator implements Iterator
$retval = array();
foreach($this->iterators as $iter)
{
- if ($it->valid())
+ if ($iter->valid())
{
$retval[] = $iter->key();
}
diff --git a/ext/spl/internal/splobjectstorage.inc b/ext/spl/internal/splobjectstorage.inc
index fa164066c7..ffc6c99488 100644
--- a/ext/spl/internal/splobjectstorage.inc
+++ b/ext/spl/internal/splobjectstorage.inc
@@ -16,7 +16,7 @@
* @since PHP 5.1.2
*
* This container allows to store objects uniquly without the need to compare
- * them one by one. This is only possible internally. The code represenation
+ * them one by one. This is only possible internally. The code representation
* here therefore has a complexity of O(n) while the actual implementation has
* complexity O(1).
*/
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index fdffda3687..3638a5a2b7 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -260,7 +260,7 @@ class Exception
/** The exception message */
protected $message;
- /** The string represenations as generated during construction */
+ /** The string representations as generated during construction */
private $string;
/** The code passed to the constructor */
@@ -336,7 +336,7 @@ class Exception
{
}
- /** @return string represenation of exception
+ /** @return string representation of exception
*/
public function __toString()
{
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 40fbb4c8f6..552f67b185 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -166,7 +166,7 @@ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object,
/* {{{ spl_array_object_new_ex */
static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC)
{
- zend_object_value retval;
+ zend_object_value retval = {0};
spl_array_object *intern;
zval *tmp;
zend_class_entry * parent = class_type;
@@ -1658,7 +1658,7 @@ SPL_METHOD(Array, getChildren)
return;
}
if (instanceof_function(Z_OBJCE_PP(entry), Z_OBJCE_P(getThis()) TSRMLS_CC)) {
- RETURN_ZVAL(*entry, 0, 0);
+ RETURN_ZVAL(*entry, 1, 0);
}
}
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 215476a724..f7be97d4ce 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -368,7 +368,7 @@ zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object
static zend_object_value spl_dllist_object_new_ex(zend_class_entry *class_type, spl_dllist_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* {{{ */
{
- zend_object_value retval;
+ zend_object_value retval = {0};
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
int inherited = 0;
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
index 32705f0919..4402d6ca4c 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
index 942c7619d9..64d6514a29 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
index ee2497252d..efbb5fb685 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
index 5430e53758..7487b8353c 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
index 96c0290953..1a94532b2b 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
index a570318999..fd90103bfa 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-SplFileObject::fgetcsv with alternative delimeter
+SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv.csv', 'w+');
diff --git a/ext/spl/tests/bug63680.phpt b/ext/spl/tests/bug63680.phpt
index 3a20c4bb17..0b5c35dc74 100644
--- a/ext/spl/tests/bug63680.phpt
+++ b/ext/spl/tests/bug63680.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #63680 (Memleak in splfixedarray with cycle reference)
+--INI--
+zend.enable_gc=1
--FILE--
<?php
function dummy() {
diff --git a/ext/spl/tests/bug65328.phpt b/ext/spl/tests/bug65328.phpt
new file mode 100644
index 0000000000..32e6c24fa7
--- /dev/null
+++ b/ext/spl/tests/bug65328.phpt
@@ -0,0 +1,348 @@
+--TEST--
+Bug #65328 (Segfault when getting SplStack object Value)
+--FILE--
+<?php
+/**
+ * @author AlexanderC
+ */
+
+class Tree
+{
+ /**
+ * @var Node
+ */
+ protected $head;
+
+ /**
+ * @param Node $head
+ */
+ public function __construct(Node $head = null)
+ {
+ $this->head = $head ? : new Node('HEAD');
+ }
+
+ /**
+ * @return Node
+ */
+ public function getHead()
+ {
+ return $this->head;
+ }
+
+ /**
+ * @param mixed $uid
+ * @return Node|bool
+ */
+ public function find($uid)
+ {
+ $iterator = $this->getIterator();
+
+ /** @var Node $node */
+ foreach($iterator as $node) {
+ if($node->getUid() === $uid) {
+ return $node;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @param mixed $uid
+ * @return \SplStack
+ */
+ public function & findAll($uid)
+ {
+ $result = new \SplStack();
+
+ /** @var Node $node */
+ foreach($this->getIterator() as $node) {
+ if($node->getUid() == $uid) {
+ $result->push($node);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * @return \RecursiveIteratorIterator
+ */
+ public function getIterator()
+ {
+ return new \RecursiveIteratorIterator(
+ $this->head->getChildren(),
+ \RecursiveIteratorIterator::SELF_FIRST
+ );
+ }
+}
+
+class Node extends \RecursiveArrayIterator implements \Countable
+{
+ /**
+ * @var array
+ */
+ protected $children = [];
+
+ /**
+ * @var Node
+ */
+ protected $parent;
+
+ /**
+ * @var mixed
+ */
+ protected $data;
+
+ /**
+ * @var mixed
+ */
+ protected $uid;
+
+ /**
+ * @var int
+ */
+ protected $index = 0;
+
+ /**
+ * @var bool
+ */
+ protected $assureUnique;
+
+ /**
+ * @param mixed $data
+ * @param mixed $uid
+ * @param Node $parent
+ * @param bool $assureUnique
+ */
+ public function __construct($data, $uid = null, Node $parent = null, $assureUnique = false)
+ {
+ if(null !== $parent) {
+ $this->parent = $parent;
+ }
+
+ $this->data = $data;
+ $this->uid = $uid ? : uniqid(sha1(serialize($data)), true);
+ $this->assureUnique = $assureUnique;
+ }
+
+ /**
+ * @param mixed $uid
+ */
+ public function setUid($uid)
+ {
+ $this->uid = $uid;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUid()
+ {
+ return $this->uid;
+ }
+
+ /**
+ * @param Node $child
+ */
+ public function addChild(Node $child)
+ {
+ $child->setParent($this);
+ $this->children[] = $child;
+ }
+
+ /**
+ * @param array $children
+ */
+ public function setChildren(array $children)
+ {
+ $this->children = $children;
+ }
+
+ /**
+ * @return array
+ */
+ public function getChildrenArray()
+ {
+ return $this->children;
+ }
+
+ /**
+ * @param mixed $data
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getData()
+ {
+ return $this->data;
+ }
+
+ /**
+ * @param Node $parent
+ * @throws \RuntimeException
+ */
+ public function setParent(Node $parent)
+ {
+ if(true === $this->assureUnique && !self::checkUnique($parent, $this->uid)) {
+ throw new \RuntimeException("Node uid is not unique in assigned node tree");
+ }
+
+ $this->parent = $parent;
+ }
+
+ /**
+ * @param Node $node
+ * @param mixed $uid
+ * @return bool
+ */
+ protected static function checkUnique(Node $node, $uid)
+ {
+ $headNode = $node;
+ do {
+ $headNode = $node;
+ } while($node = $node->getParent());
+
+ $tree = new Tree($headNode);
+
+ return !$tree->find($uid);
+ }
+
+ /**
+ * @return \IJsonRPC\Helpers\Tree\Node
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * @return Node
+ */
+ public function current()
+ {
+ return $this->children[$this->index];
+ }
+
+ /**
+ * @return scalar
+ */
+ public function key()
+ {
+ return $this->index;
+ }
+
+ /**
+ * @return void
+ */
+ public function next()
+ {
+ ++$this->index;
+ }
+
+ /**
+ * @return void
+ */
+ public function rewind()
+ {
+ $this->index = 0;
+ }
+
+ /**
+ * @return bool
+ */
+ public function valid()
+ {
+ return array_key_exists($this->index, $this->children);
+ }
+
+ /**
+ * @return int
+ */
+ public function count()
+ {
+ return count($this->children);
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasChildren()
+ {
+ return !empty($this->children);
+ }
+
+ /**
+ * @return \RecursiveArrayIterator
+ */
+ public function getChildren()
+ {
+ return new \RecursiveArrayIterator($this->children);
+ }
+}
+
+$tree = new Tree();
+$node1 = new Node('value1', 1);
+$tree->getHead()->addChild($node1);
+$node2 = new Node('value2', 2);
+$node1->addChild($node2);
+
+print_r($tree->findAll(2)->offsetGet(0));
+--EXPECTF--
+Node Object
+(
+ [children:protected] => Array
+ (
+ )
+
+ [parent:protected] => Node Object
+ (
+ [children:protected] => Array
+ (
+ [0] => Node Object
+ *RECURSION*
+ )
+
+ [parent:protected] => Node Object
+ (
+ [children:protected] => Array
+ (
+ [0] => Node Object
+ *RECURSION*
+ )
+
+ [parent:protected] =>
+ [data:protected] => HEAD
+ [uid:protected] => %s
+ [index:protected] => 0
+ [assureUnique:protected] =>
+ [storage:ArrayIterator:private] => Array
+ (
+ )
+
+ )
+
+ [data:protected] => value1
+ [uid:protected] => 1
+ [index:protected] => 1
+ [assureUnique:protected] =>
+ [storage:ArrayIterator:private] => Array
+ (
+ )
+
+ )
+
+ [data:protected] => value2
+ [uid:protected] => 2
+ [index:protected] => 0
+ [assureUnique:protected] =>
+ [storage:ArrayIterator:private] => Array
+ (
+ )
+
+)
diff --git a/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt b/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt
index 659ffb4bc0..076c687712 100644
--- a/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt
+++ b/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: priorityQueue paramter test on insert method
+SPL: priorityQueue parameter test on insert method
--CREDITS--
Sean Burlington www.practicalweb.co.uk
TestFest London May 2009
diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c
index 655b4cf4dc..3d71ebb18d 100644
--- a/ext/sqlite3/libsqlite/sqlite3.c
+++ b/ext/sqlite3/libsqlite/sqlite3.c
@@ -11864,7 +11864,7 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8);
**
*************************************************************************
**
-** This file contains definitions of global variables and contants.
+** This file contains definitions of global variables and constants.
*/
/* An array to map all upper-case characters into their corresponding
@@ -12731,7 +12731,7 @@ struct VdbeFunc {
*/
struct sqlite3_context {
FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
- VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
+ VdbeFunc *pVdbeFunc; /* Auxiliary data, if created. */
Mem s; /* The return value is stored here */
Mem *pMem; /* Memory cell used to store aggregate context */
int isError; /* Error code returned by the function. */
@@ -16130,7 +16130,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
** 1. All memory allocations sizes are rounded up to a power of 2.
**
** 2. If two adjacent free blocks are the halves of a larger block,
-** then the two blocks are coalesed into the single larger block.
+** then the two blocks are coalesced into the single larger block.
**
** 3. New memory is allocated from the first available free block.
**
@@ -20926,7 +20926,7 @@ do_atof_calc:
/* store the result */
*pResult = result;
- /* return true if number and no extra non-whitespace chracters after */
+ /* return true if number and no extra non-whitespace characters after */
return z>=zEnd && nDigits>0 && eValid;
#else
return !sqlite3Atoi64(z, pResult, length, enc);
@@ -30074,7 +30074,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
** force proxy locking to be used for every database file opened, and 0
** will force automatic proxy locking to be disabled for all database
-** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or
+** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or
** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
*/
@@ -44929,7 +44929,7 @@ SQLITE_PRIVATE int sqlite3WalOpen(
}
/*
-** Change the size to which the WAL file is trucated on each reset.
+** Change the size to which the WAL file is truncated on each reset.
*/
SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
if( pWal ) pWal->mxWalSize = iLimit;
@@ -59355,7 +59355,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
/* The complex case - There is a multi-file write-transaction active.
** This requires a master journal file to ensure the transaction is
- ** committed atomicly.
+ ** committed atomically.
*/
#ifndef SQLITE_OMIT_DISKIO
else{
@@ -61383,7 +61383,7 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
}
/*
-** Return the auxilary data pointer, if any, for the iArg'th argument to
+** Return the auxiliary data pointer, if any, for the iArg'th argument to
** the user-function defined by pCtx.
*/
SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
@@ -61398,7 +61398,7 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
}
/*
-** Set the auxilary data pointer and delete function, for the iArg'th
+** Set the auxiliary data pointer and delete function, for the iArg'th
** argument to the user-function defined by pCtx. Any previous value is
** deleted by calling the delete function specified when it was set.
*/
@@ -63408,7 +63408,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
}
#endif
- /* On any opcode with the "out2-prerelase" tag, free any
+ /* On any opcode with the "out2-prerelease" tag, free any
** external allocations out of mem[p2] and set mem[p2] to be
** an undefined integer. Opcodes will either fill in the integer
** value or convert mem[p2] to a different type.
@@ -69899,7 +69899,7 @@ SQLITE_PRIVATE int sqlite3MemJournalSize(void){
/*
** Walk an expression tree. Invoke the callback once for each node
-** of the expression, while decending. (In other words, the callback
+** of the expression, while descending. (In other words, the callback
** is invoked before visiting children.)
**
** The return value from the callback should be one of the WRC_*
@@ -70936,7 +70936,7 @@ static int resolveOrderGroupBy(
}
/*
-** Resolve names in the SELECT statement p and all of its descendents.
+** Resolve names in the SELECT statement p and all of its descendants.
*/
static int resolveSelectStep(Walker *pWalker, Select *p){
NameContext *pOuterNC; /* Context that contains this SELECT */
@@ -71244,7 +71244,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames(
** affinity of that column is returned. Otherwise, 0x00 is returned,
** indicating no affinity for the expression.
**
-** i.e. the WHERE clause expresssions in the following statements all
+** i.e. the WHERE clause expressions in the following statements all
** have an affinity:
**
** CREATE TABLE t1(a);
@@ -74260,13 +74260,13 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){
/*
** Preevaluate constant subexpressions within pExpr and store the
-** results in registers. Modify pExpr so that the constant subexpresions
+** results in registers. Modify pExpr so that the constant subexpressions
** are TK_REGISTER opcodes that refer to the precomputed values.
**
** This routine is a no-op if the jump to the cookie-check code has
** already occur. Since the cookie-check jump is generated prior to
** any other serious processing, this check ensures that there is no
-** way to accidently bypass the constant initializations.
+** way to accidentally bypass the constant initializations.
**
** This routine is also a no-op if the SQLITE_FactorOutConst optimization
** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS)
@@ -75132,7 +75132,7 @@ static void renameParentFunc(
** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER
** statement. The second is a table name. The table name in the CREATE
** TRIGGER statement is replaced with the third argument and the result
-** returned. This is analagous to renameTableFunc() above, except for CREATE
+** returned. This is analogous to renameTableFunc() above, except for CREATE
** TRIGGER, not CREATE INDEX and CREATE TABLE.
*/
static void renameTriggerFunc(
@@ -86752,7 +86752,7 @@ static int xferOptimization(
}
#endif
#ifndef SQLITE_OMIT_FOREIGN_KEY
- /* Disallow the transfer optimization if the destination table constains
+ /* Disallow the transfer optimization if the destination table constrains
** any foreign key constraints. This is more restrictive than necessary.
** But the main beneficiary of the transfer optimization is the VACUUM
** command, and the VACUUM command disables foreign key constraints. So
@@ -93175,7 +93175,7 @@ static int flattenSubquery(
pSubSrc = pSub->pSrc;
assert( pSubSrc );
/* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
- ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET
+ ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET
** because they could be computed at compile-time. But when LIMIT and OFFSET
** became arbitrary expressions, we were forced to add restrictions (13)
** and (14). */
@@ -94472,7 +94472,7 @@ SQLITE_PRIVATE int sqlite3Select(
*/
if( pGroupBy ){
KeyInfo *pKeyInfo; /* Keying information for the group by clause */
- int j1; /* A-vs-B comparision jump */
+ int j1; /* A-vs-B comparison jump */
int addrOutputRow; /* Start of subroutine that outputs a result row */
int regOutputRow; /* Return address register for output subroutine */
int addrSetAbort; /* Set the abort flag and return */
@@ -118508,7 +118508,7 @@ static int star_oh(const char *z){
/*
** If the word ends with zFrom and xCond() is true for the stem
-** of the word that preceds the zFrom ending, then change the
+** of the word that precede the zFrom ending, then change the
** ending to zTo.
**
** The input word *pz and zFrom are both in reverse order. zTo
@@ -127688,7 +127688,7 @@ SQLITE_API int sqlite3_extension_init(
** * Implementations of the SQL scalar upper() and lower() functions
** for case mapping.
**
-** * Integration of ICU and SQLite collation seqences.
+** * Integration of ICU and SQLite collation sequences.
**
** * An implementation of the LIKE operator that uses ICU to
** provide case-independent matching.
diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h
index 0e813b6dfd..6c65e02ee7 100644
--- a/ext/sqlite3/php_sqlite3_structs.h
+++ b/ext/sqlite3/php_sqlite3_structs.h
@@ -23,7 +23,7 @@
#include <sqlite3.h>
-/* for backwards compatability reasons */
+/* for backwards compatibility reasons */
#ifndef SQLITE_OPEN_READONLY
#define SQLITE_OPEN_READONLY 0x00000001
#endif
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 40a27c0536..1deacc7159 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -352,7 +352,7 @@ PHP_FUNCTION(count)
/* Numbers are always smaller than strings int this function as it
* anyway doesn't make much sense to compare two different data types.
- * This keeps it consistant and simple.
+ * This keeps it consistent and simple.
*
* This is not correct any more, depends on what compare_func is set to.
*/
@@ -1053,7 +1053,7 @@ PHP_FUNCTION(max)
static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */
{
zval **args[3], /* Arguments to userland function */
- *retval_ptr, /* Return value - unused */
+ *retval_ptr = NULL, /* Return value - unused */
*key=NULL; /* Entry key */
char *string_key;
uint string_key_len;
@@ -2877,7 +2877,7 @@ static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
{
zval **args[2];
- zval *retval_ptr;
+ zval *retval_ptr = NULL;
args[0] = (zval **) a;
args[1] = (zval **) b;
@@ -2996,8 +2996,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
- zend_fcall_info *fci_key, *fci_data;
- zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
+ zend_fcall_info *fci_key = NULL, *fci_data;
+ zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
PHP_ARRAY_CMP_FUNC_VARS;
int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -3414,8 +3414,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
- zend_fcall_info *fci_key, *fci_data;
- zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
+ zend_fcall_info *fci_key = NULL, *fci_data;
+ zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
PHP_ARRAY_CMP_FUNC_VARS;
int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -4019,7 +4019,6 @@ PHP_FUNCTION(array_sum)
**entry,
entry_n;
HashPosition pos;
- double dval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
return;
@@ -4037,17 +4036,7 @@ PHP_FUNCTION(array_sum)
entry_n = **entry;
zval_copy_ctor(&entry_n);
convert_scalar_to_number(&entry_n TSRMLS_CC);
-
- if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) {
- dval = (double)Z_LVAL_P(return_value) + (double)Z_LVAL(entry_n);
- if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) {
- Z_LVAL_P(return_value) += Z_LVAL(entry_n);
- continue;
- }
- }
- convert_to_double(return_value);
- convert_to_double(&entry_n);
- Z_DVAL_P(return_value) += Z_DVAL(entry_n);
+ fast_add_function(return_value, return_value, &entry_n TSRMLS_CC);
}
}
/* }}} */
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 0a59039635..15dae1bee6 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
*(pd++) = qp_digits[(c & 0x0f)];
ocnt -= 3;
line_ccnt -= 3;
- trail_ws--;
+ if (trail_ws > 0) {
+ trail_ws--;
+ }
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
}
}
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 414fa65c91..b4d9ba109d 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1221,8 +1221,8 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
const enc_to_uni *to_uni_table = NULL;
const entity_ht *inv_map = NULL; /* used for !double_encode */
/* only used if flags includes ENT_HTML_IGNORE_ERRORS or ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS */
- const unsigned char *replacement;
- size_t replacement_len;
+ const unsigned char *replacement = NULL;
+ size_t replacement_len = 0;
if (all) { /* replace with all named entities */
if (CHARSET_PARTIAL_SUPPORT(charset)) {
@@ -1596,7 +1596,7 @@ PHP_FUNCTION(get_html_translation_table)
flags = ENT_COMPAT;
int doctype;
entity_table_opt entity_table;
- const enc_to_uni *to_uni_table;
+ const enc_to_uni *to_uni_table = NULL;
char *charset_hint = NULL;
int charset_hint_len;
enum entity_charset charset;
diff --git a/ext/standard/image.c b/ext/standard/image.c
index b3dade4a75..bd80f11dec 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -112,7 +112,7 @@ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC)
result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8);
result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8);
result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0;
- result->channels = 3; /* allways */
+ result->channels = 3; /* always */
return result;
}
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 6bc406fede..cb2e469845 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -295,7 +295,7 @@ void php_info_print_style(TSRMLS_D)
PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
{
size_t new_len;
- return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
+ return php_escape_html_entities((unsigned char *) string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 25766818f6..b4f6a926c1 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -318,7 +318,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC);
#else
/* Since popen() doesn't indicate if the internal fork() doesn't work
- * (e.g. the shell can't be executed) we explicitely set it to 0 to be
+ * (e.g. the shell can't be executed) we explicitly set it to 0 to be
* sure we don't catch any older errno value. */
errno = 0;
sendmail = popen(sendmail_cmd, "w");
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 29419d211f..eb80395f53 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -69,7 +69,7 @@ char machine_little_endian;
/* Mapping of byte from char (8bit) to long for machine endian */
static int byte_map[1];
-/* Mappings of bytes from int (machine dependant) to int for machine endian */
+/* Mappings of bytes from int (machine dependent) to int for machine endian */
static int int_map[sizeof(int)];
/* Mappings of bytes from shorts (16bit) for all endian environments */
@@ -503,7 +503,7 @@ static long php_unpack(char *data, int size, int issigned, int *map)
/* unpack() is based on Perl's unpack(), but is modified a bit from there.
* Rather than depending on error-prone ordered lists or syntactically
- * unpleasant pass-by-reference, we return an object with named paramters
+ * unpleasant pass-by-reference, we return an object with named parameters
* (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the
* formatter char (like pack()), "[repeat]" is the optional repeater argument,
* and "name" is the name of the variable to use.
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 35343b3d5d..afc5f178e4 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -115,6 +115,7 @@ do { \
PHPAPI void var_replace(php_unserialize_data_t *var_hash, zval *ozval, zval **nzval);
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hash, zval **val);
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval);
PHPAPI void var_destroy(php_unserialize_data_t *var_hash);
#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash, ozval, nzval) \
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 77e0dff4c3..c744cb46fc 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1581,7 +1581,7 @@ PHP_FUNCTION(pathinfo)
const char *p;
int idx;
- /* Have we alrady looked up the basename? */
+ /* Have we already looked up the basename? */
if (!have_basename && !ret) {
php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC);
}
@@ -3253,7 +3253,7 @@ static void php_similar_str(const char *txt1, int len1, const char *txt2, int le
static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2)
{
int sum;
- int pos1, pos2, max;
+ int pos1 = 0, pos2 = 0, max;
php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
if ((sum = max)) {
@@ -4613,7 +4613,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow,
char *tbuf, *buf, *p, *tp, *rp, c, lc;
int br, i=0, depth=0, in_q = 0;
int state = 0, pos;
- char *allow_free;
+ char *allow_free = NULL;
if (stateptr)
state = *stateptr;
diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt
index 89d7f37b1f..1d614b452a 100644
--- a/ext/standard/tests/array/array_count_values_variation.phpt
+++ b/ext/standard/tests/array/array_count_values_variation.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_count_values() function : Test all normal paramter variations
+Test array_count_values() function : Test all normal parameter variations
--FILE--
<?php
/* Prototype : proto array array_count_values(array input)
@@ -9,7 +9,7 @@ Test array_count_values() function : Test all normal paramter variations
*/
/*
- * Test behaviour with paramter variations
+ * Test behaviour with parameter variations
*/
echo "*** Testing array_count_values() : parameter variations ***\n";
diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt
index a6e9cd2bbf..69a1f0a6d1 100644
--- a/ext/standard/tests/array/array_key_exists_variation2.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_key_exists() function : usage variations - Pass differnt data types to $search arg
+Test array_key_exists() function : usage variations - Pass different data types to $search arg
--FILE--
<?php
/* Prototype : bool array_key_exists(mixed $key, array $search)
diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt
index 04f3b91388..c247879ccc 100644
--- a/ext/standard/tests/array/array_search_variation4.phpt
+++ b/ext/standard/tests/array/array_search_variation4.phpt
@@ -16,7 +16,7 @@ $file_handle = fopen(__FILE__, "r");
//directory type resource
$dir_handle = opendir( dirname(__FILE__) );
-//store resources in array for comparision.
+//store resources in array for comparison.
$resources = array($file_handle, $dir_handle);
// search for resouce type in the resource array
diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt
index b713064569..660809357d 100644
--- a/ext/standard/tests/array/array_values_variation7.phpt
+++ b/ext/standard/tests/array/array_values_variation7.phpt
@@ -9,7 +9,7 @@ Test array_values() function : usage variations - Internal order check
/*
* Check that array_values is re-assigning keys according to the internal order of the array,
- * and is not dependant on the \$input argument's keys
+ * and is not dependent on the \$input argument's keys
*/
echo "*** Testing array_values() : usage variations ***\n";
diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt
index 31f6b4c1db..023f4176fc 100644
--- a/ext/standard/tests/array/bug34066.phpt
+++ b/ext/standard/tests/array/bug34066.phpt
@@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault)
"ProceedKeyArticle" => "01",
"ActionKey" => "00",
"ContactCommissionArticle"=> "0,00",
- "QuantDependantPriceKey"=> "",
+ "QuantdependentPriceKey"=> "",
"Quant" => "1",
"QuantUnit" => "",
"Meas" => array(
@@ -584,7 +584,7 @@ gen_xml(prefix=/Docs/Doc/DocItems/DocItem/)
/Docs/Doc/DocItems/DocItem/ContactCommissionArticle=0,00
gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end
gen_xml(prefix=/Docs/Doc/DocItems/DocItem/)
-/Docs/Doc/DocItems/DocItem/QuantDependantPriceKey
+/Docs/Doc/DocItems/DocItem/QuantdependentPriceKey
gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end
gen_xml(prefix=/Docs/Doc/DocItems/DocItem/)
/Docs/Doc/DocItems/DocItem/Quant=1
diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt
index edc16efd05..6d0f7f84e9 100644
--- a/ext/standard/tests/array/bug34066_1.phpt
+++ b/ext/standard/tests/array/bug34066_1.phpt
@@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault)
"ProceedKeyArticle" => "01",
"ActionKey" => "00",
"ContactCommissionArticle"=> "0,00",
- "QuantDependantPriceKey"=> "",
+ "QuantdependentPriceKey"=> "",
"Quant" => "1",
"QuantUnit" => "",
"Meas" => array(
@@ -543,7 +543,7 @@ gen_xml(prefix=/Docs/)
/Docs/ContactCommissionArticle=0,00
gen_xml(prefix=/Docs/) end
gen_xml(prefix=/Docs/)
-/Docs/QuantDependantPriceKey
+/Docs/QuantdependentPriceKey
gen_xml(prefix=/Docs/) end
gen_xml(prefix=/Docs/)
/Docs/Quant=1
diff --git a/ext/standard/tests/array/bug65304.phpt b/ext/standard/tests/array/bug65304.phpt
new file mode 100644
index 0000000000..e5c9dfc5e6
--- /dev/null
+++ b/ext/standard/tests/array/bug65304.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #65304 (Use of max int in array_sum)
+--FILE--
+<?php
+var_dump(array_sum(array(PHP_INT_MAX, 1)));
+var_dump(PHP_INT_MAX + 1);
+?>
+--EXPECTF--
+float(%s)
+float(%s)
diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt
index b88a5a2d62..a27bb196b4 100644
--- a/ext/standard/tests/array/in_array_variation4.phpt
+++ b/ext/standard/tests/array/in_array_variation4.phpt
@@ -19,7 +19,7 @@ $file_handle = fopen(__FILE__, "r");
//directory type resource
$dir_handle = opendir( dirname(__FILE__) );
-//store resources in array for comparision.
+//store resources in array for comparison.
$resources = array($file_handle, $dir_handle);
// search for resouce type in the resource array
diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt
index cd32d8d947..889db9886a 100644
--- a/ext/standard/tests/array/uasort_object2.phpt
+++ b/ext/standard/tests/array/uasort_object2.phpt
@@ -8,7 +8,7 @@ Test uasort() function : object functionality - sort diff. objects
*
/*
- * This testcase tests uasort() functionality with differnt objects
+ * This testcase tests uasort() functionality with different objects
* Objects of different classes:
* simple class,
* child class,
diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt
index 809cb78f56..e0c5e72f7e 100644
--- a/ext/standard/tests/array/uasort_variation10.phpt
+++ b/ext/standard/tests/array/uasort_variation10.phpt
@@ -11,7 +11,7 @@ Test uasort() function : usage variations - sort array with reference variables
* Testing uasort() with 'array_arg' containing different reference variables
*/
-// comparision function
+// comparison function
/* Prototype : int cmp_function(mixed $value1, mixed $value2)
* Parameters : $value1 and $value2 - values to be compared
* Return value : 0 - if both values are same
diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt
index c2844bfd24..0ed797fb87 100644
--- a/ext/standard/tests/array/uasort_variation4.phpt
+++ b/ext/standard/tests/array/uasort_variation4.phpt
@@ -12,7 +12,7 @@ Test uasort() function : usage variations - sort different numeric values
* integer, octal, hexadecimal & float
*/
-// comparision function
+// comparison function
/* Prototype : int cmp_function(mixed $value1, mixed $value2)
* Parameters : $value1 and $value2 - values to be compared
* Return value : 0 - if both values are same
diff --git a/ext/standard/tests/file/bug41874.phpt b/ext/standard/tests/file/bug41874.phpt
index 827f486d4d..8cc1ce2e6e 100644
--- a/ext/standard/tests/file/bug41874.phpt
+++ b/ext/standard/tests/file/bug41874.phpt
@@ -6,9 +6,9 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test');
?>
--FILE--
<?php
-$result = exec('cd 1:\non_existant; dir nonexistant');
+$result = exec('cd 1:\non_existent; dir nonexistent');
echo "$result";
-system('cd 1:\non_existant; dir nonexistant');
+system('cd 1:\non_existent; dir nonexistent');
?>
--EXPECT--
The system cannot find the drive specified.
diff --git a/ext/standard/tests/file/bug41874_2.phpt b/ext/standard/tests/file/bug41874_2.phpt
index 5d7b7cad8d..bf76a749fd 100644
--- a/ext/standard/tests/file/bug41874_2.phpt
+++ b/ext/standard/tests/file/bug41874_2.phpt
@@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
?>
--FILE--
<?php
-$result = exec('cd 1:\\non_existant; dir nonexistant');
+$result = exec('cd 1:\\non_existent; dir nonexistent');
echo "$result";
?>
--EXPECT--
diff --git a/ext/standard/tests/file/bug41874_3.phpt b/ext/standard/tests/file/bug41874_3.phpt
index 4d7b139ad7..05095c6f10 100644
--- a/ext/standard/tests/file/bug41874_3.phpt
+++ b/ext/standard/tests/file/bug41874_3.phpt
@@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
?>
--FILE--
<?php
-system('cd 1:\\non_existant; dir nonexistant');
+system('cd 1:\\non_existent; dir nonexistent');
?>
--EXPECT--
The system cannot find the drive specified. \ No newline at end of file
diff --git a/ext/standard/tests/file/chmod_basic-win32.phpt b/ext/standard/tests/file/chmod_basic-win32.phpt
index ca224f7d11..31d44c80aa 100644
--- a/ext/standard/tests/file/chmod_basic-win32.phpt
+++ b/ext/standard/tests/file/chmod_basic-win32.phpt
@@ -1,5 +1,5 @@
--TEST--
-chmod() basic fuctionality
+chmod() basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
diff --git a/ext/standard/tests/file/chmod_basic.phpt b/ext/standard/tests/file/chmod_basic.phpt
index 582f273d47..fc983074fd 100644
--- a/ext/standard/tests/file/chmod_basic.phpt
+++ b/ext/standard/tests/file/chmod_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-chmod() basic fuctionality
+chmod() basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc
index c0f86e7c3f..b3cd99e1c1 100644
--- a/ext/standard/tests/file/file.inc
+++ b/ext/standard/tests/file/file.inc
@@ -575,13 +575,13 @@ Description:
Compares two stat values, stat value should be obtained by stat/lstat
$stat1 = first stat array
$stat2 = second stat array
- $op = type of the comparision to be perform between elements of stat1 and stat2
+ $op = type of the comparison to be perform between elements of stat1 and stat2
"!=" compare for not equal
"==" compare for equality
">" if each element of stat1 is > than stat2
"<" if each element of stat1 is < than stat2
$fields = contains the key of the elements that needs to be compared.
- type of the comparision is based on $op argument value
+ type of the comparison is based on $op argument value
$flag = specify true to dump the stat1 and stat2
*/
diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt
index 127901ad79..a347d9d3d1 100644
--- a/ext/standard/tests/file/file_get_contents_error001.phpt
+++ b/ext/standard/tests/file/file_get_contents_error001.phpt
@@ -10,6 +10,7 @@ display_errors=false
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
if (!function_exists("file_get_contents"))
die ("skip file_get_contents function is not found");
+ if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/glob_variation3.phpt b/ext/standard/tests/file/glob_variation3.phpt
new file mode 100644
index 0000000000..9e1e28baf9
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test glob() function: ensure no platform difference
+--FILE--
+<?php
+$path = dirname(__FILE__);
+
+ini_set('open_basedir', NULL);
+var_dump(glob("$path/*.none"));
+
+ini_set('open_basedir', $path);
+var_dump(glob("$path/*.none"));
+
+?>
+==DONE==
+--EXPECT--
+array(0) {
+}
+bool(false)
+==DONE==
diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt
index 979959e280..bacbd93c82 100644
--- a/ext/standard/tests/file/lchown_error.phpt
+++ b/ext/standard/tests/file/lchown_error.phpt
@@ -36,7 +36,7 @@ var_dump( lchown( $filename ) );
// More than expected arguments
var_dump( lchown( $filename, $uid, 'foobar' ) );
-// Non-existant filename
+// Non-existent filename
var_dump( lchown( 'foobar_lchown.txt', $uid ) );
// Wrong argument types
diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt
index b7554f9bd0..8b7ff65cf0 100644
--- a/ext/standard/tests/file/symlink_to_symlink.phpt
+++ b/ext/standard/tests/file/symlink_to_symlink.phpt
@@ -19,8 +19,8 @@ symlink(basename($prefix . "_file"), $prefix . "_link1");
symlink(basename($prefix . "_link1"), $prefix . "_link2");
// symlink to a non-existent path
-@unlink($prefix . "_nonexistant");
-symlink(basename($prefix . "_nonexistant"), $prefix . "_link3");
+@unlink($prefix . "_nonexistent");
+symlink(basename($prefix . "_nonexistent"), $prefix . "_link3");
// symlink to a regular file using an absolute path
symlink($prefix . "_file", $prefix . "_link4");
@@ -45,6 +45,6 @@ unlink($prefix . "_file");
--EXPECTF--
%unicode|string%(%d) "symlink_to_symlink.php_file"
%unicode|string%(%d) "symlink_to_symlink.php_link1"
-%unicode|string%(%d) "symlink_to_symlink.php_nonexistant"
+%unicode|string%(%d) "symlink_to_symlink.php_nonexistent"
%unicode|string%(%d) "%s/symlink_to_symlink.php_file"
%unicode|string%(%d) "%s/symlink_to_symlink.php_link4"
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
index b5a9707e95..d39898bbe2 100644
--- a/ext/standard/tests/file/userstreams.phpt
+++ b/ext/standard/tests/file/userstreams.phpt
@@ -158,7 +158,7 @@ class mystream
}
if (@stream_wrapper_register("bogus", "class_not_exist")) {
- die("Registered a non-existant class!!!???");
+ die("Registered a non-existent class!!!???");
}
echo "Not Registered\n";
diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
index e242d45dcb..c53b5153f8 100644
--- a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
+++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
@@ -1,5 +1,12 @@
--TEST--
dl() filename length checks (CVE-2007-4887)
+--SKIPIF--
+<?php
+$enabled_sapi = array('cgi-fcgi', 'cli', 'embed', 'fpm');
+if (!in_array(php_sapi_name(), $enabled_sapi)) {
+ die('skip dl() is not enabled for ' . php_sapi_name());
+}
+?>
--INI--
enable_dl=1
--FILE--
diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt
index aa1e521e92..58957c84a9 100644
--- a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt
+++ b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt
@@ -24,8 +24,8 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
-// array with different values for $delimeter
-$delimeters = array (
+// array with different values for $delimiter
+$delimiters = array (
// integer values
0,
@@ -68,13 +68,13 @@ $delimeters = array (
@$unset_var
);
-// loop through with each element of the $delimeters array to test explode() function
+// loop through with each element of the $delimiters array to test explode() function
$count = 1;
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
$limit = 5;
-foreach($delimeters as $delimeter) {
+foreach($delimiters as $delimiter) {
echo "-- Iteration $count --\n";
- var_dump( explode($delimeter, $string, $limit) );
+ var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
diff --git a/ext/standard/tests/serialize/bug65481.phpt b/ext/standard/tests/serialize/bug65481.phpt
new file mode 100644
index 0000000000..65634f63ba
--- /dev/null
+++ b/ext/standard/tests/serialize/bug65481.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #65481 (shutdown segfault due to serialize)
+--FILE--
+<?php
+echo "Test\n";
+
+class A {
+ public $e = array();
+}
+
+class Token implements \Serializable {
+ public function serialize()
+ {
+ $c = new A;
+
+ for ($i = 0; $i < 4; $i++)
+ {
+ $e = new A;
+ $c->e[] = $e;
+ $e->e = $c->e;
+ }
+
+ return serialize(array(serialize($c)));
+ }
+
+ public function unserialize($str)
+ {
+ $r = unserialize($str);
+ $r = unserialize($r[0]);
+ }
+}
+
+$token = new Token;
+$token = serialize($token);
+
+?>
+Done
+--EXPECT--
+Test
+Done
diff --git a/ext/standard/tests/streams/bug65483.phpt b/ext/standard/tests/streams/bug65483.phpt
new file mode 100644
index 0000000000..d214bbbbcc
--- /dev/null
+++ b/ext/standard/tests/streams/bug65483.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces
+--FILE--
+<?php
+
+$data = 'a b=c d';
+
+$fd = fopen('php://temp', 'w+');
+fwrite($fd, $data);
+rewind($fd);
+
+$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ);
+var_dump(stream_get_contents($fd, -1, 0));
+
+fclose($fd);
+
+?>
+--EXPECT--
+string(9) "a b=3Dc d"
diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/bug38322.phpt
index 37f5a93f66..79f66f1fa0 100644
--- a/ext/standard/tests/strings/bug38322.phpt
+++ b/ext/standard/tests/strings/bug38322.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #38322 (reading past array in sscanf() leads to segfault/arbitary code execution)
+Bug #38322 (reading past array in sscanf() leads to segfault/arbitrary code execution)
--FILE--
<?php
diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/bug47322.phpt
index e04b230bab..1fedc2937f 100644
--- a/ext/standard/tests/strings/bug47322.phpt
+++ b/ext/standard/tests/strings/bug47322.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #47322 (sscanf %d does't work)
+Bug #47322 (sscanf %d doesn't work)
--FILE--
<?php
diff --git a/ext/standard/tests/strings/explode_error.phpt b/ext/standard/tests/strings/explode_error.phpt
index f7342e7ad3..e88b1b0c6b 100644
--- a/ext/standard/tests/strings/explode_error.phpt
+++ b/ext/standard/tests/strings/explode_error.phpt
@@ -14,11 +14,11 @@ echo "\n-- Testing explode() function with no arguments --\n";
var_dump( explode() );
echo "\n-- Testing explode() function with more than expected no. of arguments --\n";
-$delimeter = " ";
+$delimiter = " ";
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
$limit = 5;
$extra_arg = 10;
-var_dump( explode($delimeter, $string, $limit, $extra_arg) );
+var_dump( explode($delimiter, $string, $limit, $extra_arg) );
?>
===Done===
diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt
index 9c9ce11695..f16f69bece 100644
--- a/ext/standard/tests/strings/explode_variation1.phpt
+++ b/ext/standard/tests/strings/explode_variation1.phpt
@@ -24,8 +24,8 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
-// array with different values for $delimeter
-$delimeters = array (
+// array with different values for $delimiter
+$delimiters = array (
// integer values
/*1*/ 0,
@@ -68,13 +68,13 @@ $delimeters = array (
/*22*/ @$unset_var
);
-// loop through with each element of the $delimeters array to test explode() function
+// loop through with each element of the $delimiters array to test explode() function
$count = 1;
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
$limit = 5;
-foreach($delimeters as $delimeter) {
+foreach($delimiters as $delimiter) {
echo "-- Iteration $count --\n";
- var_dump( explode($delimeter, $string, $limit) );
+ var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt
index 9e1f72c5ac..4de4637ac1 100644
--- a/ext/standard/tests/strings/explode_variation2.phpt
+++ b/ext/standard/tests/strings/explode_variation2.phpt
@@ -70,11 +70,11 @@ $strings = array (
// loop through with each element of the $strings array to test explode() function
$count = 1;
-$delimeter = " ";
+$delimiter = " ";
$limit = 5;
foreach($strings as $string) {
echo "-- Iteration $count --\n";
- var_dump( explode($delimeter, $string, $limit) );
+ var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt
index 54d5222caa..2e87893107 100644
--- a/ext/standard/tests/strings/explode_variation3.phpt
+++ b/ext/standard/tests/strings/explode_variation3.phpt
@@ -24,7 +24,7 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
-// array with different values for $delimeter
+// array with different values for $delimiter
$limits = array (
// integer values
@@ -70,11 +70,11 @@ $limits = array (
// loop through with each element of the $limits array to test explode() function
$count = 1;
-$delimeter = " ";
+$delimiter = " ";
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
foreach($limits as $limit) {
echo "-- Iteration $count --\n";
- var_dump( explode($delimeter, $string, $limit) );
+ var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 4d3502f18a..3997c54b59 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 4c5bec898d..e603f4bbf8 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
index 830378b9a1..15c1c8e53d 100644
--- a/ext/standard/tests/strings/str_replace.phpt
+++ b/ext/standard/tests/strings/str_replace.phpt
@@ -120,7 +120,7 @@ var_dump($count);
echo "\n-- Testing objects --\n";
/* we get "Catchable fatal error: saying Object of class could not be converted
to string" by default, when an object is passed instead of string:
-The error can be avoided by chosing the __toString magix method as follows: */
+The error can be avoided by choosing the __toString magix method as follows: */
class subject
{
diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt
index 9b19153fa8..7b46f8b286 100644
--- a/ext/standard/tests/strings/str_replace_variation3.phpt
+++ b/ext/standard/tests/strings/str_replace_variation3.phpt
@@ -33,7 +33,7 @@ var_dump($count);
echo "\n-- Testing objects --\n";
/* we get "Catchable fatal error: saying Object of class could not be converted
to string" by default, when an object is passed instead of string:
-The error can be avoided by chosing the __toString magix method as follows: */
+The error can be avoided by choosing the __toString magix method as follows: */
class subject
{
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
index 33694f987b..b3452cfd7c 100644
--- a/ext/standard/tests/strings/strcasecmp.phpt
+++ b/ext/standard/tests/strings/strcasecmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
index 0693880119..e77ed6e466 100644
--- a/ext/standard/tests/strings/strcmp.phpt
+++ b/ext/standard/tests/strings/strcmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt
index 5a1114d5cb..df39f2469c 100644
--- a/ext/standard/tests/strings/strlen.phpt
+++ b/ext/standard/tests/strings/strlen.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 9b44584ee1..44785ef6c8 100644
--- a/ext/standard/tests/strings/strpos.phpt
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_basic.phpt b/ext/standard/tests/strings/strrchr_basic.phpt
index 1d4e50efdf..b5bfe2d9c2 100644
--- a/ext/standard/tests/strings/strrchr_basic.phpt
+++ b/ext/standard/tests/strings/strrchr_basic.phpt
@@ -34,7 +34,7 @@ var_dump( strrchr("Hello, World", "Hi") );
var_dump( strrchr("Hello, World", "o") );
var_dump( strrchr("Hello, World", "ooo") );
-var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack
+var_dump( strrchr("Hello, World", "Zzzz") ); //non-existent needle in haystack
echo "*** Done ***";
?>
--EXPECTF--
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index b135258f88..bdedb7e9f6 100644
--- a/ext/standard/tests/strings/strstr.phpt
+++ b/ext/standard/tests/strings/strstr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt
index 7d3a695d4e..fd314cbd9d 100644
--- a/ext/standard/tests/strings/substr_replace_error.phpt
+++ b/ext/standard/tests/strings/substr_replace_error.phpt
@@ -26,7 +26,7 @@ echo "\n-- Testing substr_replace() function with start and length different typ
var_dump(substr_replace($s1, "evening", array(5)));
var_dump(substr_replace($s1, "evening", 5, array(8)));
-echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n";
+echo "\n-- Testing substr_replace() function with start and length with a different number of elements --\n";
var_dump(substr_replace($s1, "evening", array(5, 1), array(8)));
echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n";
@@ -58,7 +58,7 @@ string(12) "Good morning"
Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d
string(12) "Good morning"
--- Testing substr_replace() function with start and length with a different number of elments --
+-- Testing substr_replace() function with start and length with a different number of elements --
Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d
string(12) "Good morning"
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index bae40955db..468f7f034e 100644
--- a/ext/standard/tests/strings/ucfirst.phpt
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 94f6638d64..190b4665eb 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -266,7 +266,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
p = s;
} else {
/* memrchr is a GNU specific extension
- Emulate for wide compatability */
+ Emulate for wide compatibility */
for(p = e; *p != ':' && p >= s; p--);
}
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 9aff2cb61e..236276a648 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Tue Jan 1 16:28:14 2013 */
+/* Generated by re2c 0.13.5 */
#line 1 "ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
@@ -764,147 +764,120 @@ state_val:
{
YYCTYPE yych;
static const unsigned char yybm[] = {
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 160, 160, 248, 248, 160, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 160, 248, 56, 248, 248, 248, 248, 200,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 0, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 192, 192, 224, 224, 192, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 192, 224, 64, 224, 224, 224, 224, 128,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 0, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224,
};
- if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
+ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= ' ') {
if (yych <= '\f') {
if (yych <= 0x08) goto yy63;
- if (yych <= '\n') goto yy64;
+ if (yych <= '\n') goto yy65;
goto yy63;
} else {
- if (yych <= '\r') goto yy64;
+ if (yych <= '\r') goto yy65;
if (yych <= 0x1F) goto yy63;
- goto yy64;
+ goto yy65;
}
} else {
if (yych <= '&') {
if (yych != '"') goto yy63;
} else {
if (yych <= '\'') goto yy62;
- if (yych == '>') goto yy64;
+ if (yych == '>') goto yy65;
goto yy63;
}
}
yych = *(YYMARKER = ++YYCURSOR);
- goto yy77;
+ if (yych != '>') goto yy74;
yy61:
-#line 346 "ext/standard/url_scanner_ex.re"
- { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
+#line 347 "ext/standard/url_scanner_ex.re"
+ { passthru(STD_ARGS); goto state_next_arg_begin; }
#line 827 "ext/standard/url_scanner_ex.c"
yy62:
yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == '>') goto yy61;
goto yy69;
yy63:
- yych = *++YYCURSOR;
+ ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy67;
yy64:
- ++YYCURSOR;
-#line 347 "ext/standard/url_scanner_ex.re"
- { passthru(STD_ARGS); goto state_next_arg_begin; }
-#line 838 "ext/standard/url_scanner_ex.c"
+#line 346 "ext/standard/url_scanner_ex.re"
+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
+#line 839 "ext/standard/url_scanner_ex.c"
+yy65:
+ yych = *++YYCURSOR;
+ goto yy61;
yy66:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy67:
- if (yybm[0+yych] & 8) {
+ if (yybm[0+yych] & 32) {
goto yy66;
}
- goto yy61;
+ goto yy64;
yy68:
- YYMARKER = ++YYCURSOR;
- if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy69:
- if (yybm[0+yych] & 16) {
+ if (yybm[0+yych] & 64) {
goto yy68;
}
- if (yych <= '&') goto yy72;
- if (yych >= '(') goto yy61;
- ++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 8) {
- goto yy66;
- }
+ if (yych <= '=') goto yy71;
+yy70:
+ YYCURSOR = YYMARKER;
+ goto yy61;
yy71:
+ ++YYCURSOR;
#line 345 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-#line 865 "ext/standard/url_scanner_ex.c"
-yy72:
+#line 868 "ext/standard/url_scanner_ex.c"
+yy73:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if (yybm[0+yych] & 32) {
- goto yy72;
- }
- if (yych <= '=') goto yy75;
yy74:
- YYCURSOR = YYMARKER;
- goto yy61;
-yy75:
- yych = *++YYCURSOR;
- goto yy71;
-yy76:
- YYMARKER = ++YYCURSOR;
- if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
-yy77:
- if (yybm[0+yych] & 64) {
- goto yy76;
+ if (yybm[0+yych] & 128) {
+ goto yy73;
}
- if (yych <= '!') goto yy80;
- if (yych >= '#') goto yy61;
+ if (yych >= '>') goto yy70;
++YYCURSOR;
- if (yybm[0+(yych = *YYCURSOR)] & 8) {
- goto yy66;
- }
-yy79:
#line 344 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-#line 897 "ext/standard/url_scanner_ex.c"
-yy80:
- ++YYCURSOR;
- if (YYLIMIT <= YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 128) {
- goto yy80;
- }
- if (yych >= '>') goto yy74;
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy79;
+#line 881 "ext/standard/url_scanner_ex.c"
}
#line 348 "ext/standard/url_scanner_ex.re"
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 760f725e98..ecacb76f94 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -317,7 +317,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
/*!re2c
- ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
+ [/]? [>] { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
[ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; }
alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
any { passthru(STD_ARGS); goto state_plain_begin; }
@@ -343,7 +343,7 @@ state_val:
/*!re2c
["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
- (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
+ (any\[ \r\t\n>'"])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
any { passthru(STD_ARGS); goto state_next_arg_begin; }
*/
@@ -463,7 +463,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC)
{
- char *encoded;
+ char *encoded = NULL;
int encoded_len;
smart_str val;
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index d8bae08d2a..8a35e0a5af 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sat Mar 9 22:33:09 2013 */
+/* Generated by re2c 0.13.5 on Mon Jul 29 17:57:26 2013 */
#line 1 "ext/standard/var_unserializer.re"
/*
+----------------------------------------------------------------------+
@@ -26,6 +26,7 @@
/* {{{ reference-handling for unserializer: var_* */
#define VAR_ENTRIES_MAX 1024
+#define VAR_ENTRIES_DBG 0
typedef struct {
zval *data[VAR_ENTRIES_MAX];
@@ -36,7 +37,7 @@ typedef struct {
static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -60,7 +61,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last_dtor;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -82,11 +83,35 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
var_hash->data[var_hash->used_slots++] = *rval;
}
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
+{
+ var_entries *var_hash = (*var_hashx)->last_dtor;
+#if VAR_ENTRIES_DBG
+ fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
+#endif
+
+ if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
+ var_hash = emalloc(sizeof(var_entries));
+ var_hash->used_slots = 0;
+ var_hash->next = 0;
+
+ if (!(*var_hashx)->first_dtor) {
+ (*var_hashx)->first_dtor = var_hash;
+ } else {
+ ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash;
+ }
+
+ (*var_hashx)->last_dtor = var_hash;
+ }
+
+ var_hash->data[var_hash->used_slots++] = *rval;
+}
+
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
{
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
#endif
@@ -104,7 +129,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
{
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
#endif
@@ -127,7 +152,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
void *next;
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
#endif
@@ -201,7 +226,7 @@ static char *unserialize_str(const unsigned char **p, size_t *len, size_t maxlen
#define YYMARKER marker
-#line 209 "ext/standard/var_unserializer.re"
+#line 234 "ext/standard/var_unserializer.re"
@@ -432,7 +457,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
-#line 436 "ext/standard/var_unserializer.c"
+#line 461 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -492,9 +517,9 @@ yy2:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy95;
yy3:
-#line 785 "ext/standard/var_unserializer.re"
+#line 812 "ext/standard/var_unserializer.re"
{ return 0; }
-#line 498 "ext/standard/var_unserializer.c"
+#line 523 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy89;
@@ -537,13 +562,13 @@ yy13:
goto yy3;
yy14:
++YYCURSOR;
-#line 779 "ext/standard/var_unserializer.re"
+#line 806 "ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */
}
-#line 547 "ext/standard/var_unserializer.c"
+#line 572 "ext/standard/var_unserializer.c"
yy16:
yych = *++YYCURSOR;
goto yy3;
@@ -573,7 +598,7 @@ yy20:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 635 "ext/standard/var_unserializer.re"
+#line 660 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
long elements;
@@ -625,9 +650,9 @@ yy20:
do {
/* Try to find class directly */
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
return 0;
@@ -635,7 +660,7 @@ yy20:
ce = *pce;
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
@@ -655,9 +680,9 @@ yy20:
args[0] = &arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
zval_ptr_dtor(&user_func);
@@ -671,7 +696,7 @@ yy20:
zval_ptr_dtor(&arg_func_name);
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -699,7 +724,9 @@ yy20:
*p = YYCURSOR;
if (custom_object) {
- int ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
+ int ret;
+
+ ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
php_store_class_name(*rval, class_name, len2);
@@ -717,7 +744,7 @@ yy20:
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 721 "ext/standard/var_unserializer.c"
+#line 748 "ext/standard/var_unserializer.c"
yy25:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -742,7 +769,7 @@ yy27:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 627 "ext/standard/var_unserializer.re"
+#line 652 "ext/standard/var_unserializer.re"
{
INIT_PZVAL(*rval);
@@ -750,7 +777,7 @@ yy27:
return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
}
-#line 754 "ext/standard/var_unserializer.c"
+#line 781 "ext/standard/var_unserializer.c"
yy32:
yych = *++YYCURSOR;
if (yych == '+') goto yy33;
@@ -771,7 +798,7 @@ yy34:
yych = *++YYCURSOR;
if (yych != '{') goto yy18;
++YYCURSOR;
-#line 607 "ext/standard/var_unserializer.re"
+#line 632 "ext/standard/var_unserializer.re"
{
long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
@@ -791,7 +818,7 @@ yy34:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-#line 795 "ext/standard/var_unserializer.c"
+#line 822 "ext/standard/var_unserializer.c"
yy39:
yych = *++YYCURSOR;
if (yych == '+') goto yy40;
@@ -812,7 +839,7 @@ yy41:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 578 "ext/standard/var_unserializer.re"
+#line 603 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -841,7 +868,7 @@ yy41:
ZVAL_STRINGL(*rval, str, len, 0);
return 1;
}
-#line 845 "ext/standard/var_unserializer.c"
+#line 872 "ext/standard/var_unserializer.c"
yy46:
yych = *++YYCURSOR;
if (yych == '+') goto yy47;
@@ -862,7 +889,7 @@ yy48:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 550 "ext/standard/var_unserializer.re"
+#line 575 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -890,7 +917,7 @@ yy48:
ZVAL_STRINGL(*rval, str, len, 1);
return 1;
}
-#line 894 "ext/standard/var_unserializer.c"
+#line 921 "ext/standard/var_unserializer.c"
yy53:
yych = *++YYCURSOR;
if (yych <= '/') {
@@ -978,7 +1005,7 @@ yy61:
}
yy63:
++YYCURSOR;
-#line 540 "ext/standard/var_unserializer.re"
+#line 565 "ext/standard/var_unserializer.re"
{
#if SIZEOF_LONG == 4
use_double:
@@ -988,7 +1015,7 @@ use_double:
ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
-#line 992 "ext/standard/var_unserializer.c"
+#line 1019 "ext/standard/var_unserializer.c"
yy65:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1047,7 +1074,7 @@ yy73:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 525 "ext/standard/var_unserializer.re"
+#line 550 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
@@ -1062,7 +1089,7 @@ yy73:
return 1;
}
-#line 1066 "ext/standard/var_unserializer.c"
+#line 1093 "ext/standard/var_unserializer.c"
yy76:
yych = *++YYCURSOR;
if (yych == 'N') goto yy73;
@@ -1089,7 +1116,7 @@ yy79:
if (yych <= '9') goto yy79;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 498 "ext/standard/var_unserializer.re"
+#line 523 "ext/standard/var_unserializer.re"
{
#if SIZEOF_LONG == 4
int digits = YYCURSOR - start - 3;
@@ -1116,7 +1143,7 @@ yy79:
ZVAL_LONG(*rval, parse_iv(start + 2));
return 1;
}
-#line 1120 "ext/standard/var_unserializer.c"
+#line 1147 "ext/standard/var_unserializer.c"
yy83:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
@@ -1124,24 +1151,24 @@ yy83:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 491 "ext/standard/var_unserializer.re"
+#line 516 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
ZVAL_BOOL(*rval, parse_iv(start + 2));
return 1;
}
-#line 1135 "ext/standard/var_unserializer.c"
+#line 1162 "ext/standard/var_unserializer.c"
yy87:
++YYCURSOR;
-#line 484 "ext/standard/var_unserializer.re"
+#line 509 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
ZVAL_NULL(*rval);
return 1;
}
-#line 1145 "ext/standard/var_unserializer.c"
+#line 1172 "ext/standard/var_unserializer.c"
yy89:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1164,7 +1191,7 @@ yy91:
if (yych <= '9') goto yy91;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 461 "ext/standard/var_unserializer.re"
+#line 486 "ext/standard/var_unserializer.re"
{
long id;
@@ -1179,7 +1206,7 @@ yy91:
if (*rval == *rval_ref) return 0;
if (*rval != NULL) {
- zval_ptr_dtor(rval);
+ var_push_dtor_no_addref(var_hash, rval);
}
*rval = *rval_ref;
Z_ADDREF_PP(rval);
@@ -1187,7 +1214,7 @@ yy91:
return 1;
}
-#line 1191 "ext/standard/var_unserializer.c"
+#line 1218 "ext/standard/var_unserializer.c"
yy95:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1210,7 +1237,7 @@ yy97:
if (yych <= '9') goto yy97;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 440 "ext/standard/var_unserializer.re"
+#line 465 "ext/standard/var_unserializer.re"
{
long id;
@@ -1231,9 +1258,9 @@ yy97:
return 1;
}
-#line 1235 "ext/standard/var_unserializer.c"
+#line 1262 "ext/standard/var_unserializer.c"
}
-#line 787 "ext/standard/var_unserializer.re"
+#line 814 "ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 4d99cbfd78..76c501e1b5 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -24,6 +24,7 @@
/* {{{ reference-handling for unserializer: var_* */
#define VAR_ENTRIES_MAX 1024
+#define VAR_ENTRIES_DBG 0
typedef struct {
zval *data[VAR_ENTRIES_MAX];
@@ -34,7 +35,7 @@ typedef struct {
static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -58,7 +59,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last_dtor;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -80,11 +81,35 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
var_hash->data[var_hash->used_slots++] = *rval;
}
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
+{
+ var_entries *var_hash = (*var_hashx)->last_dtor;
+#if VAR_ENTRIES_DBG
+ fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
+#endif
+
+ if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
+ var_hash = emalloc(sizeof(var_entries));
+ var_hash->used_slots = 0;
+ var_hash->next = 0;
+
+ if (!(*var_hashx)->first_dtor) {
+ (*var_hashx)->first_dtor = var_hash;
+ } else {
+ ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash;
+ }
+
+ (*var_hashx)->last_dtor = var_hash;
+ }
+
+ var_hash->data[var_hash->used_slots++] = *rval;
+}
+
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
{
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
#endif
@@ -102,7 +127,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
{
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
#endif
@@ -125,7 +150,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
void *next;
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
#endif
@@ -472,7 +497,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
if (*rval == *rval_ref) return 0;
if (*rval != NULL) {
- zval_ptr_dtor(rval);
+ var_push_dtor_no_addref(var_hash, rval);
}
*rval = *rval_ref;
Z_ADDREF_PP(rval);
@@ -683,9 +708,9 @@ object ":" uiv ":" ["] {
do {
/* Try to find class directly */
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
return 0;
@@ -693,7 +718,7 @@ object ":" uiv ":" ["] {
ce = *pce;
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
@@ -713,9 +738,9 @@ object ":" uiv ":" ["] {
args[0] = &arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
zval_ptr_dtor(&user_func);
@@ -729,7 +754,7 @@ object ":" uiv ":" ["] {
zval_ptr_dtor(&arg_func_name);
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -757,7 +782,9 @@ object ":" uiv ":" ["] {
*p = YYCURSOR;
if (custom_object) {
- int ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
+ int ret;
+
+ ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
php_store_class_name(*rval, class_name, len2);
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index bd4cf1429c..ee53d484cf 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -1121,7 +1121,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC)
break;
case CS_CMD_FAIL:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, cancelling rest");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, canceling rest");
ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
fail = 1;
break;
@@ -1131,7 +1131,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC)
case CS_PARAM_RESULT:
case CS_ROW_RESULT:
/* Unexpected results, cancel them. */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling current");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling current");
ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT);
break;
@@ -1141,7 +1141,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC)
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling all");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling all");
ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
break;
}
@@ -1696,7 +1696,7 @@ PHP_FUNCTION(sybase_free_result)
/* Did we fetch up until the end? */
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) {
- /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results"); */
+ /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: canceling the rest of the results"); */
ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL);
php_sybase_finish_results(result TSRMLS_CC);
}
diff --git a/ext/sybase_ct/tests/bug26407.phpt b/ext/sybase_ct/tests/bug26407.phpt
index 35bf6df7ad..27f5f99b9d 100644
--- a/ext/sybase_ct/tests/bug26407.phpt
+++ b/ext/sybase_ct/tests/bug26407.phpt
@@ -80,7 +80,7 @@ bool(true)
select "bar"
-Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %stest.inc on line %d
+Notice: sybase_query(): Sybase: Unexpected results, canceling current in %stest.inc on line %d
<<< Return: resource
array(1) {
[0]=>
diff --git a/ext/sybase_ct/tests/bug43578.phpt b/ext/sybase_ct/tests/bug43578.phpt
index e840402edc..9f75b9c0ea 100644
--- a/ext/sybase_ct/tests/bug43578.phpt
+++ b/ext/sybase_ct/tests/bug43578.phpt
@@ -23,7 +23,7 @@ Sybase-CT bug #43578 (Incurred fault #6 - if returned textfield ist empty)
var_dump(sybase_query('insert into #Resource values (123, NULL)', $db));
var_dump(sybase_query('insert into #Resource values (124, "")', $db));
- // Select non-existant
+ // Select non-existent
var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 122'));
// Select null
diff --git a/ext/sybase_ct/tests/test_fetch_object.phpt b/ext/sybase_ct/tests/test_fetch_object.phpt
index c23658fa35..2d225cd9cf 100644
--- a/ext/sybase_ct/tests/test_fetch_object.phpt
+++ b/ext/sybase_ct/tests/test_fetch_object.phpt
@@ -40,7 +40,7 @@ Sybase-CT sybase_fetch_object
// Test with object
var_export(fetch_object($db, new article())); echo "\n";
- // Test with non-existant class
+ // Test with non-existent class
var_export(fetch_object($db, '***')); echo "\n";
sybase_close($db);
diff --git a/ext/sybase_ct/tests/test_msghandler.phpt b/ext/sybase_ct/tests/test_msghandler.phpt
index afe97cbef3..3189aaac21 100644
--- a/ext/sybase_ct/tests/test_msghandler.phpt
+++ b/ext/sybase_ct/tests/test_msghandler.phpt
@@ -13,7 +13,7 @@ Sybase-CT server message handler
$db= sybase_connect_ex();
- echo 'Nonexistant: '; sybase_set_messagehandler_ex('function_does_not_exist');
+ echo 'Nonexistent: '; sybase_set_messagehandler_ex('function_does_not_exist');
echo 'Static method: '; sybase_set_messagehandler_ex(array('sybase', 'static_handler'));
echo 'Instance method: '; sybase_set_messagehandler_ex(array(new sybase(), 'handler'));
echo 'Lambda function: '; sybase_set_messagehandler_ex(create_function('', 'return FALSE;'));
@@ -25,7 +25,7 @@ Sybase-CT server message handler
sybase_close($db);
?>
--EXPECTF--
-Nonexistant:
+Nonexistent:
Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, function 'function_does_not_exist' not found or invalid function name in %stest.inc on line %d
NULL
Static method: bool(true)
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 5cfb164569..c3b9d8c346 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -1443,7 +1443,7 @@ static PHP_FUNCTION(tidy_get_config)
/* }}} */
/* {{{ proto int tidy_get_status()
- Get status of specfied document. */
+ Get status of specified document. */
static PHP_FUNCTION(tidy_get_status)
{
TIDY_FETCH_OBJECT;
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index fbebb635ee..c2d4497ba1 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -619,109 +619,109 @@ XML_GetErrorCode(XML_Parser parser)
}
static const XML_Char *const error_mapping[] = {
- "No error",
- "No memory",
- "Invalid document start",
- "Empty document",
- "Not well-formed (invalid token)",
- "Invalid document end",
- "Invalid hexadecimal character reference",
- "Invalid decimal character reference",
- "Invalid character reference",
- "Invalid character",
- "XML_ERR_CHARREF_AT_EOF",
- "XML_ERR_CHARREF_IN_PROLOG",
- "XML_ERR_CHARREF_IN_EPILOG",
- "XML_ERR_CHARREF_IN_DTD",
- "XML_ERR_ENTITYREF_AT_EOF",
- "XML_ERR_ENTITYREF_IN_PROLOG",
- "XML_ERR_ENTITYREF_IN_EPILOG",
- "XML_ERR_ENTITYREF_IN_DTD",
- "PEReference at end of document",
- "PEReference in prolog",
- "PEReference in epilog",
- "PEReference: forbidden within markup decl in internal subset",
- "XML_ERR_ENTITYREF_NO_NAME",
- "EntityRef: expecting ';'",
- "PEReference: no name",
- "PEReference: expecting ';'",
- "Undeclared entity error",
- "Undeclared entity warning",
- "Unparsed Entity",
- "XML_ERR_ENTITY_IS_EXTERNAL",
- "XML_ERR_ENTITY_IS_PARAMETER",
- "Unknown encoding",
- "Unsupported encoding",
- "String not started expecting ' or \"",
- "String not closed expecting \" or '",
- "Namespace declaration error",
- "EntityValue: \" or ' expected",
- "EntityValue: \" or ' expected",
- "< in attribute",
- "Attribute not started",
- "Attribute not finished",
- "Attribute without value",
- "Attribute redefined",
- "SystemLiteral \" or ' expected",
- "SystemLiteral \" or ' expected",
- /* "XML_ERR_COMMENT_NOT_STARTED", <= eliminated on purpose */
- "Comment not finished",
- "Processing Instruction not started",
- "Processing Instruction not finished",
- "NOTATION: Name expected here",
- "'>' required to close NOTATION declaration",
- "'(' required to start ATTLIST enumeration",
- "'(' required to start ATTLIST enumeration",
- "MixedContentDecl : '|' or ')*' expected",
- "XML_ERR_MIXED_NOT_FINISHED",
- "ELEMENT in DTD not started",
- "ELEMENT in DTD not finished",
- "XML declaration not started",
- "XML declaration not finished",
- "XML_ERR_CONDSEC_NOT_STARTED",
- "XML conditional section not closed",
- "Content error in the external subset",
- "DOCTYPE not finished",
- "Sequence ']]>' not allowed in content",
- "CDATA not finished",
- "Reserved XML Name",
- "Space required",
- "XML_ERR_SEPARATOR_REQUIRED",
- "NmToken expected in ATTLIST enumeration",
- "XML_ERR_NAME_REQUIRED",
- "MixedContentDecl : '#PCDATA' expected",
- "SYSTEM or PUBLIC, the URI is missing",
- "PUBLIC, the Public Identifier is missing",
- "< required",
- "> required",
- "</ required",
- "= required",
- "Mismatched tag",
- "Tag not finished",
- "standalone accepts only 'yes' or 'no'",
- "Invalid XML encoding name",
- "Comment must not contain '--' (double-hyphen)",
- "Invalid encoding",
- "external parsed entities cannot be standalone",
- "XML conditional section '[' expected",
- "Entity value required",
- "chunk is not well balanced",
- "extra content at the end of well balanced chunk",
- "XML_ERR_ENTITY_CHAR_ERROR",
- "PEReferences forbidden in internal subset",
- "Detected an entity reference loop",
- "XML_ERR_ENTITY_BOUNDARY",
- "Invalid URI",
- "Fragment not allowed",
- "XML_WAR_CATALOG_PI",
- "XML_ERR_NO_DTD",
- "conditional section INCLUDE or IGNORE keyword expected", /* 95 */
- "Version in XML Declaration missing", /* 96 */
- "XML_WAR_UNKNOWN_VERSION", /* 97 */
- "XML_WAR_LANG_VALUE", /* 98 */
- "XML_WAR_NS_URI", /* 99 */
- "XML_WAR_NS_URI_RELATIVE", /* 100 */
- "Missing encoding in text declaration" /* 101 */
+ (const XML_Char *)"No error",
+ (const XML_Char *)"No memory",
+ (const XML_Char *)"Invalid document start",
+ (const XML_Char *)"Empty document",
+ (const XML_Char *)"Not well-formed (invalid token)",
+ (const XML_Char *)"Invalid document end",
+ (const XML_Char *)"Invalid hexadecimal character reference",
+ (const XML_Char *)"Invalid decimal character reference",
+ (const XML_Char *)"Invalid character reference",
+ (const XML_Char *)"Invalid character",
+ (const XML_Char *)"XML_ERR_CHARREF_AT_EOF",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_PROLOG",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_EPILOG",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_DTD",
+ (const XML_Char *)"XML_ERR_ENTITYREF_AT_EOF",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_PROLOG",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_EPILOG",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_DTD",
+ (const XML_Char *)"PEReference at end of document",
+ (const XML_Char *)"PEReference in prolog",
+ (const XML_Char *)"PEReference in epilog",
+ (const XML_Char *)"PEReference: forbidden within markup decl in internal subset",
+ (const XML_Char *)"XML_ERR_ENTITYREF_NO_NAME",
+ (const XML_Char *)"EntityRef: expecting ';'",
+ (const XML_Char *)"PEReference: no name",
+ (const XML_Char *)"PEReference: expecting ';'",
+ (const XML_Char *)"Undeclared entity error",
+ (const XML_Char *)"Undeclared entity warning",
+ (const XML_Char *)"Unparsed Entity",
+ (const XML_Char *)"XML_ERR_ENTITY_IS_EXTERNAL",
+ (const XML_Char *)"XML_ERR_ENTITY_IS_PARAMETER",
+ (const XML_Char *)"Unknown encoding",
+ (const XML_Char *)"Unsupported encoding",
+ (const XML_Char *)"String not started expecting ' or \"",
+ (const XML_Char *)"String not closed expecting \" or '",
+ (const XML_Char *)"Namespace declaration error",
+ (const XML_Char *)"EntityValue: \" or ' expected",
+ (const XML_Char *)"EntityValue: \" or ' expected",
+ (const XML_Char *)"< in attribute",
+ (const XML_Char *)"Attribute not started",
+ (const XML_Char *)"Attribute not finished",
+ (const XML_Char *)"Attribute without value",
+ (const XML_Char *)"Attribute redefined",
+ (const XML_Char *)"SystemLiteral \" or ' expected",
+ (const XML_Char *)"SystemLiteral \" or ' expected",
+ /* (const XML_Char *)"XML_ERR_COMMENT_NOT_STARTED", <= eliminated on purpose */
+ (const XML_Char *)"Comment not finished",
+ (const XML_Char *)"Processing Instruction not started",
+ (const XML_Char *)"Processing Instruction not finished",
+ (const XML_Char *)"NOTATION: Name expected here",
+ (const XML_Char *)"'>' required to close NOTATION declaration",
+ (const XML_Char *)"'(' required to start ATTLIST enumeration",
+ (const XML_Char *)"'(' required to start ATTLIST enumeration",
+ (const XML_Char *)"MixedContentDecl : '|' or ')*' expected",
+ (const XML_Char *)"XML_ERR_MIXED_NOT_FINISHED",
+ (const XML_Char *)"ELEMENT in DTD not started",
+ (const XML_Char *)"ELEMENT in DTD not finished",
+ (const XML_Char *)"XML declaration not started",
+ (const XML_Char *)"XML declaration not finished",
+ (const XML_Char *)"XML_ERR_CONDSEC_NOT_STARTED",
+ (const XML_Char *)"XML conditional section not closed",
+ (const XML_Char *)"Content error in the external subset",
+ (const XML_Char *)"DOCTYPE not finished",
+ (const XML_Char *)"Sequence ']]>' not allowed in content",
+ (const XML_Char *)"CDATA not finished",
+ (const XML_Char *)"Reserved XML Name",
+ (const XML_Char *)"Space required",
+ (const XML_Char *)"XML_ERR_SEPARATOR_REQUIRED",
+ (const XML_Char *)"NmToken expected in ATTLIST enumeration",
+ (const XML_Char *)"XML_ERR_NAME_REQUIRED",
+ (const XML_Char *)"MixedContentDecl : '#PCDATA' expected",
+ (const XML_Char *)"SYSTEM or PUBLIC, the URI is missing",
+ (const XML_Char *)"PUBLIC, the Public Identifier is missing",
+ (const XML_Char *)"< required",
+ (const XML_Char *)"> required",
+ (const XML_Char *)"</ required",
+ (const XML_Char *)"= required",
+ (const XML_Char *)"Mismatched tag",
+ (const XML_Char *)"Tag not finished",
+ (const XML_Char *)"standalone accepts only 'yes' or 'no'",
+ (const XML_Char *)"Invalid XML encoding name",
+ (const XML_Char *)"Comment must not contain '--' (double-hyphen)",
+ (const XML_Char *)"Invalid encoding",
+ (const XML_Char *)"external parsed entities cannot be standalone",
+ (const XML_Char *)"XML conditional section '[' expected",
+ (const XML_Char *)"Entity value required",
+ (const XML_Char *)"chunk is not well balanced",
+ (const XML_Char *)"extra content at the end of well balanced chunk",
+ (const XML_Char *)"XML_ERR_ENTITY_CHAR_ERROR",
+ (const XML_Char *)"PEReferences forbidden in internal subset",
+ (const XML_Char *)"Detected an entity reference loop",
+ (const XML_Char *)"XML_ERR_ENTITY_BOUNDARY",
+ (const XML_Char *)"Invalid URI",
+ (const XML_Char *)"Fragment not allowed",
+ (const XML_Char *)"XML_WAR_CATALOG_PI",
+ (const XML_Char *)"XML_ERR_NO_DTD",
+ (const XML_Char *)"conditional section INCLUDE or IGNORE keyword expected", /* 95 */
+ (const XML_Char *)"Version in XML Declaration missing", /* 96 */
+ (const XML_Char *)"XML_WAR_UNKNOWN_VERSION", /* 97 */
+ (const XML_Char *)"XML_WAR_LANG_VALUE", /* 98 */
+ (const XML_Char *)"XML_WAR_NS_URI", /* 99 */
+ (const XML_Char *)"XML_WAR_NS_URI_RELATIVE", /* 100 */
+ (const XML_Char *)"Missing encoding in text declaration" /* 101 */
};
PHPAPI const XML_Char *
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 334938ab24..1ef01c8864 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -274,10 +274,10 @@ zend_module_entry xml_module_entry = {
* the encoding is currently done internally by expat/xmltok.
*/
xml_encoding xml_encodings[] = {
- { "ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
- { "US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
- { "UTF-8", NULL, NULL },
- { NULL, NULL, NULL }
+ { (XML_Char *)"ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
+ { (XML_Char *)"US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
+ { (XML_Char *)"UTF-8", NULL, NULL },
+ { (XML_Char *)NULL, NULL, NULL }
};
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
index 664e8b77b3..ac103e0616 100644
--- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c
+++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
@@ -279,7 +279,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
else if (!strcmp(attr_iter->key, TOKEN_MUSTUNDERSTAND)) {
b_must_understand = strchr(attr_iter->val, '1') ? 1 : 0;
}
- /* actor, used in conjuction with must understand. */
+ /* actor, used in conjunction with must understand. */
else if (!strcmp(attr_iter->key, TOKEN_ACTOR)) {
actor = attr_iter->val;
}
diff --git a/ext/xmlrpc/tests/003.phpt b/ext/xmlrpc/tests/003.phpt
new file mode 100644
index 0000000000..3d6796dbab
--- /dev/null
+++ b/ext/xmlrpc/tests/003.phpt
@@ -0,0 +1,109 @@
+--TEST--
+xmlrpc_encode() Simple test encode array
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+$params = array(
+ "one" => "red",
+ "two" => "blue",
+ "three" => "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+$params = array(
+ "red",
+ "blue",
+ "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+$params = array(
+ 0 => "red",
+ 1 => "blue",
+ 3 => "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <struct>
+ <member>
+ <name>one</name>
+ <value>
+ <string>red</string>
+ </value>
+ </member>
+ <member>
+ <name>two</name>
+ <value>
+ <string>blue</string>
+ </value>
+ </member>
+ <member>
+ <name>three</name>
+ <value>
+ <string>green</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <string>red</string>
+ </value>
+ <value>
+ <string>blue</string>
+ </value>
+ <value>
+ <string>green</string>
+ </value>
+ </data>
+ </array>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <struct>
+ <member>
+ <name>0</name>
+ <value>
+ <string>red</string>
+ </value>
+ </member>
+ <member>
+ <name>1</name>
+ <value>
+ <string>blue</string>
+ </value>
+ </member>
+ <member>
+ <name>3</name>
+ <value>
+ <string>green</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/004.phpt b/ext/xmlrpc/tests/004.phpt
new file mode 100644
index 0000000000..04f3ef315e
--- /dev/null
+++ b/ext/xmlrpc/tests/004.phpt
@@ -0,0 +1,19 @@
+--TEST--
+xmlrpc_encode() Simple test encode int
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+$response = xmlrpc_encode(1);
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <int>1</int>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/005.phpt b/ext/xmlrpc/tests/005.phpt
new file mode 100644
index 0000000000..613dfde249
--- /dev/null
+++ b/ext/xmlrpc/tests/005.phpt
@@ -0,0 +1,47 @@
+--TEST--
+xmlrpc_encode() Simple test encode type double and String
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$response = xmlrpc_encode(3.24234);
+echo $response;
+
+$response = xmlrpc_encode(-3.24234);
+echo $response;
+
+$response = xmlrpc_encode('Is string');
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <double>3.24234</double>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <double>-3.24234</double>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <string>Is string</string>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/006.phpt b/ext/xmlrpc/tests/006.phpt
new file mode 100644
index 0000000000..f33932d5a2
--- /dev/null
+++ b/ext/xmlrpc/tests/006.phpt
@@ -0,0 +1,29 @@
+--TEST--
+xmlrpc_decode() Simple test decode type string
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <string>Is string</string>
+ </value>
+</param>
+</params>
+XML;
+
+$response = xmlrpc_decode($xml);
+echo $response;
+
+--EXPECT--
+Is string \ No newline at end of file
diff --git a/ext/xmlrpc/tests/007.phpt b/ext/xmlrpc/tests/007.phpt
new file mode 100644
index 0000000000..84c15a7d8a
--- /dev/null
+++ b/ext/xmlrpc/tests/007.phpt
@@ -0,0 +1,29 @@
+--TEST--
+xmlrpc_decode() Simple test decode type int
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <int>1</int>
+ </value>
+</param>
+</params>
+XML;
+
+$response = xmlrpc_decode($xml);
+echo $response;
+
+--EXPECT--
+1 \ No newline at end of file
diff --git a/ext/xmlwriter/tests/bug41287.phpt b/ext/xmlwriter/tests/bug41287.phpt
index 0612b21f15..72b6720f1d 100644
--- a/ext/xmlwriter/tests/bug41287.phpt
+++ b/ext/xmlwriter/tests/bug41287.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #41287 (Namespace functions don't allow xmlns defintion to be optional)
+Bug #41287 (Namespace functions don't allow xmlns definition to be optional)
--SKIPIF--
<?php
if (!extension_loaded("xmlwriter")) die("skip");
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 1785519c15..af11104a2e 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -476,7 +476,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */
{
- xmlDocPtr newdocp;
+ xmlDocPtr newdocp = NULL;
xmlDocPtr doc = NULL;
xmlNodePtr node = NULL;
xsltTransformContextPtr ctxt;
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 0c033d4e46..d7bd5f49e6 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1654,7 +1654,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
char *path = NULL;
char *remove_path = NULL;
char *add_path = NULL;
- int pattern_len, add_path_len, remove_path_len, path_len = 0;
+ int pattern_len, add_path_len = 0, remove_path_len = 0, path_len = 0;
long remove_all_path = 0;
long flags = 0;
zval *options = NULL;
diff --git a/ext/zlib/tests/bug65391.phpt b/ext/zlib/tests/bug65391.phpt
new file mode 100644
index 0000000000..3ba5350810
--- /dev/null
+++ b/ext/zlib/tests/bug65391.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #65391 (Unable to send vary header user-agent when ob_start('ob_gzhandler') is called)
+--SKIPIF--
+<?php
+extension_loaded("zlib") or die("skip need zlib");
+?>
+--GET--
+dummy=1
+--FILE--
+<?php
+header("Vary: Cookie");
+ob_start("ob_gzhandler");
+
+// run-tests cannot test for a multiple Vary header
+ob_flush();
+print_r(headers_list());
+
+?>
+Done
+--EXPECTF--
+Array
+(
+ [0] => X-Powered-By: PHP/%s
+ [1] => Vary: Cookie
+ [2] => Vary: Accept-Encoding
+)
+Done
+
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 1a202e344e..1114bc8a65 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -190,7 +190,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
if ((output_context->op & PHP_OUTPUT_HANDLER_START)
&& (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL))
) {
- sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
+ sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC);
}
return FAILURE;
}
@@ -220,7 +220,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
deflateEnd(&ctx->Z);
return FAILURE;
}
- sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
+ sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC);
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
}
}
@@ -478,7 +478,7 @@ static PHP_FUNCTION(ob_gzhandler)
sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC);
break;
}
- sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
+ sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC);
}
if (!ZLIBG(ob_gzhandler)) {
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 6f11cf3f32..9b8645a061 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -775,7 +775,12 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co
* we cannot cannot getcwd() and the requested,
* relatively referenced file is accessible */
copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath);
- real_path = estrndup(filepath, copy_len);
+ if (real_path) {
+ memcpy(real_path, filepath, copy_len);
+ real_path[copy_len] = '\0';
+ } else {
+ real_path = estrndup(filepath, copy_len);
+ }
close(fdtest);
return real_path;
} else {
diff --git a/main/main.c b/main/main.c
index 2821dfcdca..1fd82c8398 100644
--- a/main/main.c
+++ b/main/main.c
@@ -115,6 +115,10 @@
#endif
/* }}} */
+#ifndef S_ISREG
+#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+
PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions;
#ifndef ZTS
@@ -276,13 +280,14 @@ static void php_binary_init(TSRMLS_D)
if ((envpath = getenv("PATH")) != NULL) {
char *search_dir, search_path[MAXPATHLEN];
char *last = NULL;
+ struct stat s;
path = estrdup(envpath);
search_dir = php_strtok_r(path, ":", &last);
while (search_dir) {
snprintf(search_path, MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location);
- if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK)) {
+ if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK) && VCWD_STAT(binary_location, &s) == 0 && S_ISREG(s.st_mode)) {
found = 1;
break;
}
@@ -1526,7 +1531,7 @@ int php_request_startup(TSRMLS_D)
int retval = SUCCESS;
#ifdef HAVE_DTRACE
- DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method));
+ DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method));
#endif /* HAVE_DTRACE */
#ifdef PHP_WIN32
@@ -1836,7 +1841,7 @@ void php_request_shutdown(void *dummy)
#endif
#ifdef HAVE_DTRACE
- DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method));
+ DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method));
#endif /* HAVE_DTRACE */
}
/* }}} */
diff --git a/main/php_ini.c b/main/php_ini.c
index bceb6e59f8..444b4ce844 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -785,7 +785,12 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC)
char path_bak[MAXPATHLEN];
#endif
+#if PHP_WIN32
+ /* MAX_PATH is \0-terminated, path_len == MAXPATHLEN would overrun path_bak */
+ if (path_len >= MAXPATHLEN) {
+#else
if (path_len > MAXPATHLEN) {
+#endif
return;
}
diff --git a/main/php_variables.c b/main/php_variables.c
index cf2b623d61..4c614692bb 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -56,7 +56,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
{
char *p = NULL;
- char *ip; /* index pointer */
+ char *ip = NULL; /* index pointer */
char *index;
char *var, *var_orig;
int var_len, index_len;
diff --git a/main/php_version.h b/main/php_version.h
index 35b9b6d066..e30528ed51 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -2,7 +2,7 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 4
-#define PHP_RELEASE_VERSION 18
+#define PHP_RELEASE_VERSION 21
#define PHP_EXTRA_VERSION "-dev"
-#define PHP_VERSION "5.4.18-dev"
-#define PHP_VERSION_ID 50418
+#define PHP_VERSION "5.4.21-dev"
+#define PHP_VERSION_ID 50421
diff --git a/main/rfc1867.c b/main/rfc1867.c
index b9007f2cb8..8e4820988d 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -398,7 +398,7 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC)
static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC)
{
char *line;
- mime_header_entry prev_entry, entry;
+ mime_header_entry prev_entry = {0}, entry;
int prev_len, cur_len;
/* didn't find boundary, abort */
diff --git a/main/snprintf.h b/main/snprintf.h
index de03542cad..f4ed4d234d 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -27,7 +27,7 @@ sprintf offers the ability to make a lot of failures since it does not know
the size of the buffer it uses. Therefore usage of sprintf often
results in possible entries for buffer overrun attacks. So please
use this version only if you are sure the call is safe. sprintf
- allways terminstes the buffer it writes to.
+ always terminstes the buffer it writes to.
snprintf knows the buffers size and will not write behind it. But you will
have to use either a static buffer or allocate a dynamic buffer
@@ -48,7 +48,7 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size
snprintf and offers possible memory leakes if you miss freeing the
buffer allocated by the function. Therfore this function should be
used where either no maximum is known or the maximum is much bigger
- than normal size required. spprintf allways terminates the buffer.
+ than normal size required. spprintf always terminates the buffer.
Example:
@@ -60,7 +60,7 @@ Example:
sprintf(buffer, "test"); | snprintf(buffer, MAX, "test"); | spprintf(&buffer, MAX, "text");
| | if (!buffer)
| | return OUT_OF_MEMORY
- // sprintf allways terminates | // manual termination of | // spprintf allays terminates buffer
+ // sprintf always terminates | // manual termination of | // spprintf allays terminates buffer
// buffer | // buffer *IS* required |
| buffer[MAX-1] = 0; |
action_with_buffer(buffer); | action_with_buffer(buffer); | action_with_buffer(buffer);
diff --git a/main/spprintf.h b/main/spprintf.h
index 397928a794..d9aa9533e5 100644
--- a/main/spprintf.h
+++ b/main/spprintf.h
@@ -22,7 +22,7 @@
The pbuf parameter of all spprintf version receives a pointer to the allocated
buffer. This buffer must be freed manually after usage using efree() function.
-The buffer will allways be terminated by a zero character. When pbuf is NULL
+The buffer will always be terminated by a zero character. When pbuf is NULL
the function can be used to calculate the required size of the buffer but for
that purpose snprintf is faster. When both pbuf and the return value are 0
than you are out of memory.
diff --git a/main/streams/cast.c b/main/streams/cast.c
index da6a293e45..bf96d3cf80 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -33,7 +33,7 @@
#if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
/* NetBSD 6.0+ uses off_t instead of fpos_t in funopen */
-# if defined(__NetBSD__) && (__NetBSD_Version__ > 600000000)
+# if defined(__NetBSD__) && (__NetBSD_Version__ >= 600000000)
# define PHP_FPOS_T off_t
# else
# define PHP_FPOS_T fpos_t
diff --git a/php.ini-development b/php.ini-development
index 4ff4192f6f..ba20bd3fb8 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -197,13 +197,12 @@
engine = On
; This directive determines whether or not PHP will recognize code between
-; <? and ?> tags as PHP source which should be processed as such. It's been
-; recommended for several years that you not use the short tag "short cut" and
-; instead to use the full <?php and ?> tag combination. With the wide spread use
-; of XML and use of these tags by other languages, the server can become easily
-; confused and end up parsing the wrong code in the wrong context. But because
-; this short cut has been a feature for such a long time, it's currently still
-; supported for backwards compatibility, but we recommend you don't use them.
+; <? and ?> tags as PHP source which should be processed as such. It is
+; generally recommended that <?php and ?> should be used and that this feature
+; should be disabled, as enabling it may result in issues when generating XML
+; documents, however this remains supported for backward compatibility reasons.
+; Note that this directive does not control the <?= shorthand tag, which can be
+; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
@@ -903,7 +902,6 @@ default_socket_timeout = 60
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
-;extension=php_zip.dll
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
@@ -1474,7 +1472,7 @@ session.gc_maxlifetime = 1440
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
-; find /path/to/sessions -cmin +24 | xargs rm
+; find /path/to/sessions -cmin +24 -type f | xargs rm
; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope.
@@ -1856,6 +1854,11 @@ ldap.max_links = -1
[dba]
;dba.default_handler=
+[curl]
+; A default value for the CURLOPT_CAINFO option. This is required to be an
+; absolute path.
+;curl.cainfo =
+
; Local Variables:
; tab-width: 4
; End:
diff --git a/php.ini-production b/php.ini-production
index 814455bbbb..db48a8fbc8 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -197,13 +197,12 @@
engine = On
; This directive determines whether or not PHP will recognize code between
-; <? and ?> tags as PHP source which should be processed as such. It's been
-; recommended for several years that you not use the short tag "short cut" and
-; instead to use the full <?php and ?> tag combination. With the wide spread use
-; of XML and use of these tags by other languages, the server can become easily
-; confused and end up parsing the wrong code in the wrong context. But because
-; this short cut has been a feature for such a long time, it's currently still
-; supported for backwards compatibility, but we recommend you don't use them.
+; <? and ?> tags as PHP source which should be processed as such. It is
+; generally recommended that <?php and ?> should be used and that this feature
+; should be disabled, as enabling it may result in issues when generating XML
+; documents, however this remains supported for backward compatibility reasons.
+; Note that this directive does not control the <?= shorthand tag, which can be
+; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
@@ -903,7 +902,6 @@ default_socket_timeout = 60
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
-;extension=php_zip.dll
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
@@ -1474,7 +1472,7 @@ session.gc_maxlifetime = 1440
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
-; find /path/to/sessions -cmin +24 | xargs rm
+; find /path/to/sessions -cmin +24 -type f | xargs rm
; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope.
@@ -1856,6 +1854,11 @@ ldap.max_links = -1
[dba]
;dba.default_handler=
+[curl]
+; A default value for the CURLOPT_CAINFO option. This is required to be an
+; absolute path.
+;curl.cainfo =
+
; Local Variables:
; tab-width: 4
; End:
diff --git a/run-tests.php b/run-tests.php
index 830dcd759b..935f821f4e 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -597,6 +597,15 @@ if (isset($argc) && $argc > 1) {
putenv("TEST_PHP_EXECUTABLE=$php");
$environment['TEST_PHP_EXECUTABLE'] = $php;
break;
+ case 'P':
+ if(constant('PHP_BINARY')) {
+ $php = PHP_BINARY;
+ } else {
+ break;
+ }
+ putenv("TEST_PHP_EXECUTABLE=$php");
+ $environment['TEST_PHP_EXECUTABLE'] = $php;
+ break;
case 'q':
putenv('NO_INTERACTION=1');
break;
@@ -686,6 +695,8 @@ Options:
-p <php> Specify PHP executable to run.
+ -P Use PHP_BINARY as PHP executable to run.
+
-q Quiet, no user interaction (same as environment NO_INTERACTION).
-s <file> Write output to <file>.
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index af83e9bcfa..1961289de0 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -59,7 +59,7 @@ if test "$PHP_APXS" != "no"; then
# Test that we're trying to configure with apache 1.x
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
if test "$APACHE_VERSION" -ge 2000000; then
- AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
+ AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
fi
for flag in $APXS_CFLAGS; do
diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4
index c49488d182..b6524fd874 100644
--- a/sapi/apache2filter/config.m4
+++ b/sapi/apache2filter/config.m4
@@ -62,7 +62,7 @@ if test "$PHP_APXS2FILTER" != "no"; then
# Test that we're trying to configure with apache 2.x
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
if test "$APACHE_VERSION" -le 2000000; then
- AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
+ AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)])
elif test "$APACHE_VERSION" -lt 2000040; then
AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required])
fi
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 702f91f5d2..753de10ba8 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -61,7 +61,7 @@ if test "$PHP_APXS2" != "no"; then
# Test that we're trying to configure with apache 2.x
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
if test "$APACHE_VERSION" -le 2000000; then
- AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
+ AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)])
elif test "$APACHE_VERSION" -lt 2000044; then
AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
fi
diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4
index 4213b7c6a6..672f298084 100644
--- a/sapi/apache_hooks/config.m4
+++ b/sapi/apache_hooks/config.m4
@@ -60,7 +60,7 @@ if test "$PHP_APACHE_HOOKS" != "no"; then
# Test that we're trying to configure with apache 1.x
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
if test "$APACHE_VERSION" -ge 2000000; then
- AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
+ AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
fi
for flag in $APXS_CFLAGS; do
diff --git a/sapi/cgi/Makefile.frag b/sapi/cgi/Makefile.frag
index d54dd40808..d3d7cb3553 100644
--- a/sapi/cgi/Makefile.frag
+++ b/sapi/cgi/Makefile.frag
@@ -5,6 +5,7 @@ $(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_CGI_OBJS)
install-cgi: $(SAPI_CGI_PATH)
@echo "Installing PHP CGI binary: $(INSTALL_ROOT)$(bindir)/"
+ @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
@$(INSTALL) -m 0755 $(SAPI_CGI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php-cgi$(program_suffix)$(EXEEXT)
@echo "Installing PHP CGI man page: $(INSTALL_ROOT)$(mandir)/man1/"
@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in
index 749baa8a6b..c113030d14 100644
--- a/sapi/cli/php.1.in
+++ b/sapi/cli/php.1.in
@@ -20,21 +20,21 @@ php-cgi \- PHP Common Gateway Interface 'CGI' command
.LP
.B php
[options] [\-B
-.IR code ]
+.IR begin_code ]
.B \-R
.IR code
[\-E
-.IR code ]
+.IR end_code ]
[[\-\-]
.IR args.\|.\|. ]
.LP
.B php
[options] [\-B
-.IR code ]
+.IR begin_code ]
.B \-F
.IR file
[\-E
-.IR code ]
+.IR end_code ]
[[\-\-]
.IR args.\|.\|. ]
.LP
@@ -86,7 +86,7 @@ and therefore reading from
.B STDIN
explicitly changes the next input line or skips input lines.
.LP
-PHP also contains an embedded web server for application development purpose. By using the \-S option where
+PHP also contains an built-in web server for application development purpose. By using the \-S option where
.B addr:port
point to a local address and port PHP will listen to HTTP requests on that address and port and serve files from the current working directory or the
.B docroot
@@ -237,9 +237,9 @@ without using script tags
.B \-\-process\-begin \fIcode\fP
.TP
.PD 1
-.B \-B \fIcode\fP
+.B \-B \fIbegin_code\fP
Run PHP
-.IR code
+.IR begin_code
before processing input lines
.TP
.PD 0
@@ -264,9 +264,9 @@ for every input line
.B \-\-process\-end \fIcode\fP
.TP
.PD 1
-.B \-E \fIcode\fP
+.B \-E \fIend_code\fP
Run PHP
-.IR code
+.IR end_code
after processing all input lines
.TP
.PD 0
@@ -281,14 +281,14 @@ Output HTML syntax highlighted source
.TP
.PD 1
.B \-S \fIaddr:port\fP
-Start embedded Webserver on the given local address and port
+Start built-in web server on the given local address and port
.TP
.PD 0
.B \-\-docroot \fIdocroot\fP
.TP
.PD 1
.B \-t \fIdocroot\fP
-Specify the document root to be used by the embedded web server
+Specify the document root to be used by the built-in web server
.TP
.PD 0
.B \-\-version
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index c01f3705b5..aa300ce88d 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -498,6 +498,7 @@ static void php_cli_usage(char *argv0)
" %s [options] -r <code> [--] [args...]\n"
" %s [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]\n"
" %s [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]\n"
+ " %s [options] -S <addr>:<port> [-t docroot]\n"
" %s [options] -- [args...]\n"
" %s [options] -a\n"
"\n"
@@ -539,7 +540,7 @@ static void php_cli_usage(char *argv0)
" --rz <name> Show information about Zend extension <name>.\n"
" --ri <name> Show configuration for extension <name>.\n"
"\n"
- , prog, prog, prog, prog, prog, prog);
+ , prog, prog, prog, prog, prog, prog, prog);
}
/* }}} */
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 335d589a67..4da55acc6c 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -408,7 +408,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
{
{
char **val;
- if (SUCCESS == zend_hash_find(&client->request.headers, "Host", sizeof("Host"), (void**)&val)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "host", sizeof("host"), (void**)&val)) {
smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
smart_str_appends_ex(buffer, *val, persistent);
@@ -558,7 +558,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */
{
php_cli_server_client *client = SG(server_context);
char **val;
- if (FAILURE == zend_hash_find(&client->request.headers, "Cookie", sizeof("Cookie"), (void**)&val)) {
+ if (FAILURE == zend_hash_find(&client->request.headers, "cookie", sizeof("cookie"), (void**)&val)) {
return NULL;
}
return *val;
@@ -1325,7 +1325,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque
static const char *index_files[] = { "index.php", "index.html", NULL };
char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1);
char *p = buf, *prev_path = NULL, *q, *vpath;
- size_t prev_path_len;
+ size_t prev_path_len = 0;
int is_static_file = 0;
if (!buf) {
@@ -1556,12 +1556,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
return 1;
}
{
- char *header_name = client->current_header_name;
- size_t header_name_len = client->current_header_name_len;
- char c = header_name[header_name_len];
- header_name[header_name_len] = '\0';
- zend_hash_add(&client->request.headers, header_name, header_name_len + 1, &value, sizeof(char *), NULL);
- header_name[header_name_len] = c;
+ char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len);
+ zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL);
+ efree(header_name);
}
if (client->current_header_name_allocated) {
@@ -1719,7 +1716,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli
request_info->post_data = client->request.content;
request_info->content_length = request_info->post_data_length = client->request.content_len;
request_info->auth_user = request_info->auth_password = request_info->auth_digest = NULL;
- if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "content-type", sizeof("content-type"), (void**)&val)) {
request_info->content_type = *val;
}
} /* }}} */
@@ -1957,7 +1954,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
static int php_cli_server_request_startup(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) { /* {{{ */
char **auth;
php_cli_server_client_populate_request_info(client, &SG(request_info));
- if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "authorization", sizeof("authorization"), (void**)&auth)) {
php_handle_auth_data(*auth TSRMLS_CC);
}
SG(sapi_headers).http_response_code = 200;
diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt
new file mode 100644
index 0000000000..55834095b1
--- /dev/null
+++ b/sapi/cli/tests/bug65633.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #65633 (built-in server treat some http headers as case-sensitive)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start(<<<'PHP'
+var_dump($_COOKIE, $_SERVER['HTTP_FOO']);
+PHP
+);
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+ die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+GET / HTTP/1.1
+cookie: foo=bar
+foo: bar
+
+
+HEADER
+)) {
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
+}
+
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Connection: close
+X-Powered-By: %s
+Content-type: text/html
+
+array(1) {
+ ["foo"]=>
+ string(3) "bar"
+}
+string(3) "bar"
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index e0d80970af..af4f2fa325 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -3,7 +3,7 @@
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
-; prefix (@prefix@). This prefix can be dynamicaly changed by using the
+; prefix (@prefix@). This prefix can be dynamically changed by using the
; '-p' argument from the command line.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
@@ -401,7 +401,7 @@ pm.max_spare_servers = 3
; - %{megabytes}M
; - %{mega}M
; %n: pool name
-; %o: ouput header
+; %o: output header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
diff --git a/sapi/litespeed/README b/sapi/litespeed/README
index e548ec97db..b5cec05aa6 100644
--- a/sapi/litespeed/README
+++ b/sapi/litespeed/README
@@ -195,7 +195,7 @@ process.
By default a LSAPI application check the existence of its parent process
and exits automatically if the parent process died. This is to reduce
-orphan process when web server is restarted. However, it is desireable
+orphan process when web server is restarted. However, it is desirable
to disable this feature, such as when a LSAPI process was started
manually from command line. LSAPI_PPID_NO_CHECK should be set when
you want to disable the checking of existence of parent process.
diff --git a/scripts/Makefile.frag b/scripts/Makefile.frag
index 00272b02b1..7cd78fabad 100644
--- a/scripts/Makefile.frag
+++ b/scripts/Makefile.frag
@@ -44,7 +44,7 @@ install-programs: $(builddir)/phpize $(builddir)/php-config
echo " page: $(program_prefix)$${page}$(program_suffix).1"; \
$(INSTALL_DATA) $(builddir)/man1/$${page}.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)$${page}$(program_suffix).1; \
done
-
+
$(builddir)/phpize: $(srcdir)/phpize.in $(top_builddir)/config.status
(CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/scripts/dev/generate-phpt.phar b/scripts/dev/generate-phpt.phar
index a12c040f9c..c6268c0af3 100644
--- a/scripts/dev/generate-phpt.phar
+++ b/scripts/dev/generate-phpt.phar
Binary files differ
diff --git a/scripts/dev/generate-phpt/src/testcase/gtTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtTestCase.php
index cc5e19a5ae..60c115a9c1 100644
--- a/scripts/dev/generate-phpt/src/testcase/gtTestCase.php
+++ b/scripts/dev/generate-phpt/src/testcase/gtTestCase.php
@@ -104,7 +104,7 @@ abstract class gtTestCase {
/**
- * Add contructor argument initialisation to test case
+ * Add constructor argument initialisation to test case
*
*/
public function constructorArgInit() {
diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php
index dfee4ea75e..a62882a81a 100644
--- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php
+++ b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php
@@ -23,7 +23,7 @@ class gtVariationContainerFunction extends gtVariationContainer {
/**
- * Constucts all possible variation testcases in array $this->variationTests
+ * constructs all possible variation testcases in array $this->variationTests
*
*/
public function constructAll() {
diff --git a/scripts/phpize.in b/scripts/phpize.in
index 43cd8d30ff..b86925e295 100644
--- a/scripts/phpize.in
+++ b/scripts/phpize.in
@@ -11,7 +11,7 @@ SED="@SED@"
FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
-CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
+CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ modules/ install-sh \
mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
diff --git a/tests/basic/bug45986.phpt b/tests/basic/bug45986.phpt
index 1c30f10403..33c3f27eac 100644
--- a/tests/basic/bug45986.phpt
+++ b/tests/basic/bug45986.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #45986 (wrong error message for a non existant file on rename)
+Bug #45986 (wrong error message for a non existent file on rename)
--CREDITS--
Sebastian Schürmann
sebs@php.net
diff --git a/tests/classes/static_properties_004.phpt b/tests/classes/static_properties_004.phpt
index ce1d19dcc1..e98c605eb4 100644
--- a/tests/classes/static_properties_004.phpt
+++ b/tests/classes/static_properties_004.phpt
@@ -6,7 +6,7 @@ class C { public static $p = 'original'; }
class D extends C { }
class E extends D { }
-echo "\nInherited static properties refer to the same value accross classes:\n";
+echo "\nInherited static properties refer to the same value across classes:\n";
var_dump(C::$p, D::$p, E::$p);
echo "\nChanging one changes all the others:\n";
@@ -20,7 +20,7 @@ var_dump(C::$p, D::$p, E::$p);
?>
==Done==
--EXPECTF--
-Inherited static properties refer to the same value accross classes:
+Inherited static properties refer to the same value across classes:
%unicode|string%(8) "original"
%unicode|string%(8) "original"
%unicode|string%(8) "original"
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt
index 897d77b0be..ddbd925934 100644
--- a/win32/build/libs_version.txt
+++ b/win32/build/libs_version.txt
@@ -1,6 +1,6 @@
bz2-1.0.6
cclient-2007e
-freetype-2.4.3
+freetype-2.4.10
icu-49.1.2
jpeglib-8
libcurl-7.30.0
diff --git a/win32/sendmail.c b/win32/sendmail.c
index dac62871ae..f541016f58 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -408,7 +408,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
snprintf(Buffer, sizeof(Buffer), "HELO %s\r\n", LocalHost);
- /* in the beggining of the dialog */
+ /* in the beginning of the dialog */
/* attempt reconnect if the first Post fail */
if ((res = Post(Buffer)) != SUCCESS) {
MailConnect();