diff options
| author | Michael Wallner <mike@php.net> | 2013-08-13 17:08:01 +0200 |
|---|---|---|
| committer | Michael Wallner <mike@php.net> | 2013-08-13 17:08:01 +0200 |
| commit | fddc82dd0ebb4f7bb24921682251b79970315fbf (patch) | |
| tree | db499584eac53d88476039307c0bea32a958f240 | |
| parent | 15c351cc52971eb9a1a6c16a760cc0f7777681c5 (diff) | |
| parent | c5674bb502ba5a0b4f14c3171de1ab617245a39d (diff) | |
| download | php-git-fddc82dd0ebb4f7bb24921682251b79970315fbf.tar.gz | |
Merge branch 'master' into slim-postdata
* master: (62 commits)
removed unused vars
fixed strndup usage in the pgsql ext
Fixes to unified stdint usage
Fixed bug #65382 (Segfault in closure_030.phpt)
Revise pgsql test files
Revise pgsql test for Travis CI
Add 00version.phpt to get server/protocol/client version. Revise test script description
use mysqlnd, some tests fail otherwise
ensure notices are not ignored when tests need them
Embeds the content of the DTD in the DOCTYPE declaration of the XML files.
Adds 2 new xml files which include the dtd path relative to the base directory for the php source code. It fixs the fail on the load of the dtd in the tests modified by this commit.
Adds files: error 1 to 5 and variation 1 to 4
Fix #61345: fix install of CGI binary
Fix #61345: fix install of CGI binary
php.ini-development/production: remove php_zip.dll
Update NEWS
Update NEWS
Fixed possible buffer overflow under Windows. Note: Not a security fix.
Fixed Bug #62015 Changed session.auto_start to PHP_INI_PERDIR. It is simply wrong and never worked if the value is changed at runtime
Implemented Request #20421 (session_abort() and session_reset() function
...
Conflicts:
sapi/cli/tests/upload_2G.phpt
177 files changed, 2103 insertions, 541 deletions
diff --git a/Makefile.global b/Makefile.global index e744e3778f..bd82daf4d8 100644 --- a/Makefile.global +++ b/Makefile.global @@ -120,7 +120,7 @@ clean: distclean: clean rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h rm -f php5.spec main/build-defs.h scripts/phpize - rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/mysqlnd/php_mysqlnd_config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak + rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1 rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h @@ -93,3 +93,5 @@ PHP X.Y UPGRADE NOTES 11. Other Changes ======================================== +- File upload: + Uploads equal or greater than 2GB in size are now accepted. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index cfc19d515d..566f310998 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -48,7 +48,9 @@ UPGRADE NOTES - PHP X.Y ======================== a. Unix build system changes - - + - The bison version check is now a blacklist instead of a whitelist. + - The bison binary can be specified through the YACC environment/configure + variable. Previously `bison` was assumed to be in $PATH. b. Windows build system changes - diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 454513f68c..fe3ab63beb 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -3,8 +3,13 @@ dnl dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ - # we only support certain bison versions - bison_version_list="2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7" + # we only support certain bison versions; + # min: 2.4 (i.e. 204, major * 100 + minor for easier comparison) + bison_version_min="204" + # non-working versions, e.g. "3.0 3.2"; + # remove "none" when introducing the first incompatible bison version an + # separate any following additions by spaces + bison_version_exclude="none" # for standalone build of Zend Engine test -z "$SED" && SED=sed @@ -12,23 +17,27 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[ bison_version=none if test "$YACC"; then AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z` + bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z` php_cv_bison_version=invalid if test -n "$bison_version_vars"; then set $bison_version_vars bison_version="${1}.${2}" - for bison_check_version in $bison_version_list; do - if test "$bison_version" = "$bison_check_version"; then - php_cv_bison_version="$bison_check_version (ok)" - break - fi - done + bison_version_num="`expr ${1} \* 100 + ${2}`" + if test $bison_version_num -ge $bison_version_min; then + php_cv_bison_version="$bison_version (ok)" + for bison_check_version in $bison_version_exclude; do + if test "$bison_version" = "$bison_check_version"; then + php_cv_bison_version=invalid + break + fi + done + fi fi ]) fi case $php_cv_bison_version in ""|invalid[)] - bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)." + bison_msg="This bison version is not supported for regeneration of the Zend/PHP parsers (found: $bison_version, min: $bison_version_min, excluded: $bison_version_exclude)." AC_MSG_WARN([$bison_msg]) YACC="exit 0;" ;; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ba5f31b1fb..027b667532 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2684,7 +2684,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (call->object) { Z_ADDREF_P(call->object); } - if (OP2_TYPE == IS_VAR && OP2_FREE && + if (OP2_TYPE == IS_VAR && OP2_FREE && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -2929,6 +2929,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) 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_execute.h b/Zend/zend_vm_execute.h index 135a4caec0..c8214b8968 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1267,7 +1267,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (call->object) { Z_ADDREF_P(call->object); } - if (IS_CONST == IS_VAR && 0 && + if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -1592,7 +1592,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (call->object) { Z_ADDREF_P(call->object); } - if (IS_TMP_VAR == IS_VAR && 1 && + if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -1779,7 +1779,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (call->object) { Z_ADDREF_P(call->object); } - if (IS_VAR == IS_VAR && (free_op2.var != NULL) && + if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -2004,7 +2004,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (call->object) { Z_ADDREF_P(call->object); } - if (IS_CV == IS_VAR && 0 && + if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -2421,6 +2421,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, *retval_ptr_ptr); + zval_copy_ctor(ret); *EG(return_value_ptr_ptr) = ret; } break; @@ -7748,6 +7749,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, *retval_ptr_ptr); + zval_copy_ctor(ret); *EG(return_value_ptr_ptr) = ret; } break; @@ -12976,6 +12978,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, *retval_ptr_ptr); + zval_copy_ctor(ret); *EG(return_value_ptr_ptr) = ret; } break; @@ -30634,6 +30637,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, *retval_ptr_ptr); + zval_copy_ctor(ret); *EG(return_value_ptr_ptr) = ret; } break; diff --git a/acinclude.m4 b/acinclude.m4 index fb490594d4..b76bd344a7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2962,10 +2962,14 @@ 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 - CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && cp \$[]@ \$[]@.bak && \$(SED) 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@ + CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@ \$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj @@ -2974,3 +2978,22 @@ $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS) EOF ]) + +dnl +dnl PHP_CHECK_STDINT_TYPES +dnl +AC_DEFUN([PHP_CHECK_STDINT_TYPES], [ + AC_CHECK_SIZEOF([short], 2) + AC_CHECK_SIZEOF([int], 4) + AC_CHECK_SIZEOF([long], 4) + AC_CHECK_SIZEOF([long long], 8) + AC_CHECK_TYPES([int8, int16, int32, int64, int8_t, int16_t, int32_t, int64_t, uint8, uint16, uint32, uint64, uint8_t, uint16_t, uint32_t, uint64_t, u_int8_t, u_int16_t, u_int32_t, u_int64_t], [], [], [ +#if HAVE_STDINT_H +# include <stdint.h> +#endif +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + ]) + AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types]) +]) diff --git a/build/libtool.m4 b/build/libtool.m4 index 77735d36b3..56658ccbb4 100644 --- a/build/libtool.m4 +++ b/build/libtool.m4 @@ -193,11 +193,11 @@ AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], -[ --disable-libtool-lock avoid locking (might break parallel builds)]) +[ --disable-libtool-lock Avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +[ --with-pic Try to use only PIC/non-PIC objects [default=use both]], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default @@ -1919,7 +1919,7 @@ fi AC_DEFUN([_LT_AC_TAGCONFIG], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_ARG_WITH([tags], -[ --with-tags[=TAGS] include additional configurations [automatic] +[ --with-tags[=TAGS] Include additional configurations [automatic] ], [tagnames="$withval"]) @@ -2023,7 +2023,7 @@ AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +<< --enable-shared[=PKGS] Build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2063,7 +2063,7 @@ AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +<< --enable-static[=PKGS] Build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2103,7 +2103,8 @@ AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +<< --enable-fast-install[=PKGS] + Optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2241,7 +2242,7 @@ fi # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +[ --with-gnu-ld Assume the C compiler uses GNU ld [default=no]], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl diff --git a/configure.in b/configure.in index 51beea025f..16738fe30a 100644 --- a/configure.in +++ b/configure.in @@ -572,6 +572,9 @@ PHP_CHECK_SIZEOF(intmax_t, 0) PHP_CHECK_SIZEOF(ssize_t, 8) PHP_CHECK_SIZEOF(ptrdiff_t, 8) +dnl Check stdint types (must be after header check) +PHP_CHECK_STDINT_TYPES + dnl Check for members of the stat structure AC_STRUCT_ST_BLKSIZE dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists @@ -1006,7 +1009,7 @@ dnl Check if all enabled by default extensions should be disabled dnl AC_ARG_ENABLE(all, -[ --disable-all Disable all extensions which are enabled by default +[ --disable-all Disable all extensions which are enabled by default ], [ PHP_ENABLE_ALL=$enableval ]) diff --git a/ext/bz2/config.m4 b/ext/bz2/config.m4 index 3e6aa78d05..55917c07f4 100644 --- a/ext/bz2/config.m4 +++ b/ext/bz2/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(bz2, for BZip2 support, -[ --with-bz2[=DIR] Include BZip2 support]) +[ --with-bz2[=DIR] Include BZip2 support]) if test "$PHP_BZ2" != "no"; then if test -r $PHP_BZ2/include/bzlib.h; then diff --git a/ext/curl/config.m4 b/ext/curl/config.m4 index e3d1d51ccc..2f82c3485d 100644 --- a/ext/curl/config.m4 +++ b/ext/curl/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(curl, for cURL support, -[ --with-curl[=DIR] Include cURL support]) +[ --with-curl[=DIR] Include cURL support]) if test "$PHP_CURL" != "no"; then if test -r $PHP_CURL/include/curl/easy.h; then diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 index f403104a8a..0b46c6803a 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -22,4 +22,5 @@ cat > $ext_builddir/lib/timelib_config.h <<EOF #else # include <php_config.h> #endif +#include <php_stdint.h> EOF diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h index a3d7793447..cc12eb38a6 100644 --- a/ext/date/lib/timelib_structs.h +++ b/ext/date/lib/timelib_structs.h @@ -23,37 +23,7 @@ #include "timelib_config.h" -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#if defined(HAVE_INTTYPES_H) -#include <inttypes.h> -#elif defined(HAVE_STDINT_H) -#include <stdint.h> -#endif - -#ifdef PHP_WIN32 -/* TODO: Remove these hacks/defs once we have the int definitions in main/ - rathen than in each 2nd extension and win32/ */ -# include "win32/php_stdint.h" -#else -# ifndef HAVE_INT32_T -# if SIZEOF_INT == 4 -typedef int int32_t; -# elif SIZEOF_LONG == 4 -typedef long int int32_t; -# endif -# endif - -# ifndef HAVE_UINT32_T -# if SIZEOF_INT == 4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG == 4 -typedef unsigned long int uint32_t; -# endif -# endif -#endif +#include "php_stdint.h" #include <stdio.h> diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 index 4b123518b4..5442bb1415 100644 --- a/ext/dba/config.m4 +++ b/ext/dba/config.m4 @@ -557,10 +557,10 @@ PHP_ARG_WITH(cdb,, [ --without-cdb[=DIR] DBA: CDB support (bundled)], $php_dba_enable, no) PHP_ARG_ENABLE(inifile,, -[ --disable-inifile DBA: INI support (bundled)], $php_dba_enable, no) +[ --disable-inifile DBA: INI support (bundled)], $php_dba_enable, no) PHP_ARG_ENABLE(flatfile,, -[ --disable-flatfile DBA: FlatFile support (bundled)], $php_dba_enable, no) +[ --disable-flatfile DBA: FlatFile support (bundled)], $php_dba_enable, no) # CDB if test "$PHP_CDB" = "yes"; then diff --git a/ext/dom/document.c b/ext/dom/document.c index d17c7cbd55..efe6d9070f 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1973,14 +1973,15 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type xmlDoc *docp; dom_object *intern; char *source = NULL, *valid_file = NULL; - int source_len = 0; + int source_len = 0, valid_opts = 0; + long flags = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; xmlSchemaValidCtxtPtr vptr; int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { return; } @@ -2029,6 +2030,13 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type RETURN_FALSE; } +#if LIBXML_VERSION >= 20614 + if (flags & XML_SCHEMA_VAL_VC_I_CREATE) { + valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE; + } +#endif + + xmlSchemaSetValidOptions(vptr, valid_opts); xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr); is_valid = xmlSchemaValidateDoc(vptr, docp); xmlSchemaFree(sptr); @@ -2042,14 +2050,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type } /* }}} */ -/* {{{ proto boolean dom_document_schema_validate_file(string filename); */ +/* {{{ proto boolean dom_document_schema_validate_file(string filename, int flags); */ PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file */ -/* {{{ proto boolean dom_document_schema_validate(string source); */ +/* {{{ proto boolean dom_document_schema_validate(string source, int flags); */ PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); diff --git a/ext/dom/tests/DOMDocument_loadXML_basic.phpt b/ext/dom/tests/DOMDocument_loadXML_basic.phpt new file mode 100644 index 0000000000..569593c007 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test DOMDocument::loadXML() basic behavior +--DESCRIPTION-- +This test verifies the basic behaviour of the method +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_error1.phpt b/ext/dom/tests/DOMDocument_loadXML_error1.phpt new file mode 100644 index 0000000000..52d44ea291 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_error1.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test DOMDocument::loadXML() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects an opening and ending tag mismatch +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error2.phpt b/ext/dom/tests/DOMDocument_loadXML_error2.phpt new file mode 100644 index 0000000000..6ac4193daf --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_error2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test DOMDocument::loadXML() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects attributes values not closed between " or ' +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed2.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error3.phpt b/ext/dom/tests/DOMDocument_loadXML_error3.phpt new file mode 100644 index 0000000000..07f7ca7738 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_error3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::loadXML() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects a typo in tag names +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed3.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error4.phpt b/ext/dom/tests/DOMDocument_loadXML_error4.phpt new file mode 100644 index 0000000000..e35d3dcea5 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_error4.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::loadXML() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects an unsupported xml version +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed4.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error5.phpt b/ext/dom/tests/DOMDocument_loadXML_error5.phpt new file mode 100644 index 0000000000..a4aa1858f5 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_error5.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::loadXML() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects extra content at the end of the document +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed5.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_loadXML_variation1.phpt b/ext/dom/tests/DOMDocument_loadXML_variation1.phpt new file mode 100644 index 0000000000..558137526f --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_variation1.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test DOMDocument::loadXML() with LIBXML_DTDLOAD option +--DESCRIPTION-- +This test verifies the right behaviour of the LIBXML_DTDLOAD constant +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book_with_dtd2.xml +LOAD_OPTIONS=LIBXML_DTDLOAD +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_variation2.phpt b/ext/dom/tests/DOMDocument_loadXML_variation2.phpt new file mode 100644 index 0000000000..71f638efc1 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_variation2.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::loadXML() with LIBXML_DTDVALID option +--DESCRIPTION-- +This test verifies the right behaviour of the LIBXML_DTDVALID constant +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/wrong_book_with_dtd2.xml +LOAD_OPTIONS=LIBXML_DTDVALID +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s diff --git a/ext/dom/tests/DOMDocument_loadXML_variation3.phpt b/ext/dom/tests/DOMDocument_loadXML_variation3.phpt new file mode 100644 index 0000000000..8e61ec4dbc --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_variation3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::loadXML() with LIBXML_DTDVALID and LIBXML_NOERROR options +--DESCRIPTION-- +This test vrifies the right behaviour of the LIBXML_NOERROR constant +which avoids the display of the warning message +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/wrong_book_with_dtd.xml +LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_variation4.phpt b/ext/dom/tests/DOMDocument_loadXML_variation4.phpt new file mode 100644 index 0000000000..4f1ea37c19 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadXML_variation4.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test DOMDocument::loadXML() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS +--DESCRIPTION-- +This test verifies the right behaviour of the following constants: +LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book_with_dtd2.xml +LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentloadxml_test_method_savexml.php +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE books [ +<!ENTITY entitest "entity is only for test purposes"> +<!ATTLIST title default CDATA "default title"> +<!ELEMENT books (book)*> +<!ELEMENT book (title , author)> +<!ELEMENT title (#PCDATA)> +<!ELEMENT author (#PCDATA)> +]> +<books><book><title default="default title">The Grapes of Wrath</title><author>John Steinbeck</author></book><book><title default="default title">The Pearl</title><author>John Steinbeck</author></book><book><title default="default title">entity is only for test purposes</title><author>data for test</author></book></books> diff --git a/ext/dom/tests/DOMDocument_load_basic.phpt b/ext/dom/tests/DOMDocument_load_basic.phpt new file mode 100644 index 0000000000..6d70ed4522 --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test DOMDocument::load() basic behavior +--DESCRIPTION-- +This test verifies the basic behaviour of the method +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_error1.phpt b/ext/dom/tests/DOMDocument_load_error1.phpt new file mode 100644 index 0000000000..2ac3f50979 --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_error1.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test DOMDocument::load() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects an opening and ending tag mismatch +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s diff --git a/ext/dom/tests/DOMDocument_load_error2.phpt b/ext/dom/tests/DOMDocument_load_error2.phpt new file mode 100644 index 0000000000..23a5e4827d --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_error2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test DOMDocument::load() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects attributes values not closed between " or ' +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed2.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s + +Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_load_error3.phpt b/ext/dom/tests/DOMDocument_load_error3.phpt new file mode 100644 index 0000000000..b9ac49c466 --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_error3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::load() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects and opening and ending tag mismatch +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed3.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s diff --git a/ext/dom/tests/DOMDocument_load_error4.phpt b/ext/dom/tests/DOMDocument_load_error4.phpt new file mode 100644 index 0000000000..ca9ed79a3e --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_error4.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::load() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects an unsupported xml version +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed4.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s diff --git a/ext/dom/tests/DOMDocument_load_error5.phpt b/ext/dom/tests/DOMDocument_load_error5.phpt new file mode 100644 index 0000000000..a374f9474d --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_error5.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::load() detects not-well formed XML +--DESCRIPTION-- +This test verifies the method detects extra content at the end of the document +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/not_well_formed5.xml +LOAD_OPTIONS=0 +EXPECTED_RESULT=0 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_load_variation1.phpt b/ext/dom/tests/DOMDocument_load_variation1.phpt new file mode 100644 index 0000000000..b2b99e74c7 --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_variation1.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test DOMDocument::load() with LIBXML_DTDLOAD option +--DESCRIPTION-- +This test verifies the right behaviour of the LIBXML_DTDLOAD constant +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book_with_dtd.xml +LOAD_OPTIONS=LIBXML_DTDLOAD +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_variation2.phpt b/ext/dom/tests/DOMDocument_load_variation2.phpt new file mode 100644 index 0000000000..c8460e55eb --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_variation2.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::load() with LIBXML_DTDVALID option +--DESCRIPTION-- +This test verifies the right behaviour of the LIBXML_DTDVALID constant +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/wrong_book_with_dtd.xml +LOAD_OPTIONS=LIBXML_DTDVALID +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECTF-- +Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s diff --git a/ext/dom/tests/DOMDocument_load_variation3.phpt b/ext/dom/tests/DOMDocument_load_variation3.phpt new file mode 100644 index 0000000000..77801d475e --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_variation3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test DOMDocument::load() with LIBXML_DTDVALID and LIBXML_NOERROR options +--DESCRIPTION-- +This test vrifies the right behaviour of the LIBXML_NOERROR constant +which avoids the display of the warning message +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/wrong_book_with_dtd.xml +LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentload_test_method.php +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_variation4.phpt b/ext/dom/tests/DOMDocument_load_variation4.phpt new file mode 100644 index 0000000000..3bf7ccc04d --- /dev/null +++ b/ext/dom/tests/DOMDocument_load_variation4.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test DOMDocument::load() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS +--DESCRIPTION-- +This test verifies the right behaviour of the following constants: +LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS +Environment variables used in the test: +- XML_FILE: the xml file to load +- LOAD_OPTIONS: the second parameter to pass to the method +- EXPECTED_RESULT: the expected result +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--ENV-- +XML_FILE=/book_with_dtd.xml +LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS +EXPECTED_RESULT=1 +--FILE_EXTERNAL-- +domdocumentload_test_method_savexml.php +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE books SYSTEM "books.dtd"> +<books><book><title default="default title">The Grapes of Wrath</title><author>John Steinbeck</author></book><book><title default="default title">The Pearl</title><author>John Steinbeck</author></book><book><title default="default title">entity is only for test purposes</title><author>data for test</author></book></books> diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt new file mode 100644 index 0000000000..994b94d0c8 --- /dev/null +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt @@ -0,0 +1,25 @@ +--TEST-- +DomDocument::schemaValidateSource() - Add missing attribute default values from schema +--CREDITS-- +Chris Wright <info@daverandom.com> +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$doc = new DOMDocument; + +$doc->load(dirname(__FILE__)."/book-attr.xml"); + +$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); + +$doc->schemaValidateSource($xsd, LIBXML_SCHEMA_CREATE); + +foreach ($doc->getElementsByTagName('book') as $book) { + var_dump($book->getAttribute('is-hardback')); +} + +?> +--EXPECT-- +string(5) "false" +string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt index 65c8d8678f..f841b87428 100644 --- a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt @@ -17,5 +17,5 @@ var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 0 given in %s.php on line %d +Warning: DOMDocument::schemaValidateSource() expects at least 1 parameter, 0 given in %s.php on line %d NULL diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt new file mode 100644 index 0000000000..7c98a74b1d --- /dev/null +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt @@ -0,0 +1,25 @@ +--TEST-- +DomDocument::schemaValidateSource() - Don't add missing attribute default values from schema +--CREDITS-- +Chris Wright <info@daverandom.com> +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$doc = new DOMDocument; + +$doc->load(dirname(__FILE__)."/book-attr.xml"); + +$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); + +$doc->schemaValidateSource($xsd); + +foreach ($doc->getElementsByTagName('book') as $book) { + var_dump($book->getAttribute('is-hardback')); +} + +?> +--EXPECT-- +string(0) "" +string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt new file mode 100644 index 0000000000..e0b5251b23 --- /dev/null +++ b/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt @@ -0,0 +1,23 @@ +--TEST-- +DomDocument::schemaValidate() - Add missing attribute default values from schema +--CREDITS-- +Chris Wright <info@daverandom.com> +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$doc = new DOMDocument; + +$doc->load(dirname(__FILE__)."/book-attr.xml"); + +$doc->schemaValidate(dirname(__FILE__)."/book.xsd", LIBXML_SCHEMA_CREATE); + +foreach ($doc->getElementsByTagName('book') as $book) { + var_dump($book->getAttribute('is-hardback')); +} + +?> +--EXPECT-- +string(5) "false" +string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt index d4817deca0..9e4b6c4b7c 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt @@ -17,5 +17,5 @@ var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidate() expects exactly 1 parameter, 0 given in %s.php on line %d +Warning: DOMDocument::schemaValidate() expects at least 1 parameter, 0 given in %s.php on line %d NULL diff --git a/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt new file mode 100644 index 0000000000..d253ad9690 --- /dev/null +++ b/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt @@ -0,0 +1,23 @@ +--TEST-- +DomDocument::schemaValidate() - Don't add missing attribute default values from schema +--CREDITS-- +Chris Wright <info@daverandom.com> +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +$doc = new DOMDocument; + +$doc->load(dirname(__FILE__)."/book-attr.xml"); + +$doc->schemaValidate(dirname(__FILE__)."/book.xsd"); + +foreach ($doc->getElementsByTagName('book') as $book) { + var_dump($book->getAttribute('is-hardback')); +} + +?> +--EXPECT-- +string(0) "" +string(4) "true" diff --git a/ext/dom/tests/book-attr.xml b/ext/dom/tests/book-attr.xml new file mode 100644 index 0000000000..ba4298d098 --- /dev/null +++ b/ext/dom/tests/book-attr.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" ?> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book is-hardback="true"> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/book.xsd b/ext/dom/tests/book.xsd index 45986fc4b3..6b4a8ea545 100755 --- a/ext/dom/tests/book.xsd +++ b/ext/dom/tests/book.xsd @@ -9,6 +9,7 @@ <xs:element name="title" type="xs:string"/> <xs:element name="author" type="xs:string"/> </xs:sequence> + <xs:attribute name="is-hardback" type="xs:boolean" default="false" use="optional" /> </xs:complexType> </xs:element> </xs:sequence> diff --git a/ext/dom/tests/book_with_dtd.xml b/ext/dom/tests/book_with_dtd.xml new file mode 100644 index 0000000000..de12e92102 --- /dev/null +++ b/ext/dom/tests/book_with_dtd.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE books SYSTEM "books.dtd"> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> + <book> + <title>&entitest;</title> + <author><![CDATA[data for test]]></author> + </book> +</books> diff --git a/ext/dom/tests/book_with_dtd2.xml b/ext/dom/tests/book_with_dtd2.xml new file mode 100644 index 0000000000..aeb4f0b800 --- /dev/null +++ b/ext/dom/tests/book_with_dtd2.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE books [ +<!ENTITY entitest "entity is only for test purposes"> +<!ATTLIST title default CDATA "default title"> +<!ELEMENT books (book*)> +<!ELEMENT book (title, author)> +<!ELEMENT title (#PCDATA)> +<!ELEMENT author (#PCDATA)> +]> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> + <book> + <title>&entitest;</title> + <author><![CDATA[data for test]]></author> + </book> +</books> diff --git a/ext/dom/tests/books.dtd b/ext/dom/tests/books.dtd new file mode 100644 index 0000000000..b3f03c1c16 --- /dev/null +++ b/ext/dom/tests/books.dtd @@ -0,0 +1,7 @@ +<!ENTITY entitest "entity is only for test purposes"> +<!ATTLIST title + default CDATA "default title"> + <!ELEMENT books (book*)> + <!ELEMENT book (title, author)> + <!ELEMENT title (#PCDATA)> + <!ELEMENT author (#PCDATA)> diff --git a/ext/dom/tests/domdocumentload_test_method.php b/ext/dom/tests/domdocumentload_test_method.php new file mode 100644 index 0000000000..7afce15c3a --- /dev/null +++ b/ext/dom/tests/domdocumentload_test_method.php @@ -0,0 +1,12 @@ +<?php +include(dirname(__FILE__) . '/domdocumentload_utilities.php'); + +$doc = new DOMDocument(); + +$libxml_options = libxml_options_to_int(getenv('LOAD_OPTIONS')); + +$result = $doc->load(dirname(__FILE__) . getenv('XML_FILE'), $libxml_options); + +$expectedResult = (bool) getenv('EXPECTED_RESULT'); +assert('$result === $expectedResult'); +?> diff --git a/ext/dom/tests/domdocumentload_test_method_savexml.php b/ext/dom/tests/domdocumentload_test_method_savexml.php new file mode 100644 index 0000000000..8ffd944524 --- /dev/null +++ b/ext/dom/tests/domdocumentload_test_method_savexml.php @@ -0,0 +1,14 @@ +<?php +include(dirname(__FILE__) . '/domdocumentload_utilities.php'); + +$doc = new DOMDocument(); + +$libxml_options = libxml_options_to_int(getenv('LOAD_OPTIONS')); + +$result = $doc->load(dirname(__FILE__) . getenv('XML_FILE'), $libxml_options); + +$expectedResult = (bool) getenv('EXPECTED_RESULT'); +assert('$result === $expectedResult'); + +echo $doc->saveXML(); +?> diff --git a/ext/dom/tests/domdocumentload_utilities.php b/ext/dom/tests/domdocumentload_utilities.php new file mode 100644 index 0000000000..efd1e5a1a5 --- /dev/null +++ b/ext/dom/tests/domdocumentload_utilities.php @@ -0,0 +1,16 @@ +<?php + +function libxml_options_to_int($libxmlOptions) { + + $defined_constants = get_defined_constants(true); + $env_array = explode('|', $libxmlOptions); + $libxml_constants = array_intersect_key($defined_constants['libxml'], array_flip($env_array)); + + $sum = 0; + foreach($libxml_constants as $value) { + $sum = $sum|$value; + } + + return $sum; +} +?> diff --git a/ext/dom/tests/domdocumentloadxml_test_method.php b/ext/dom/tests/domdocumentloadxml_test_method.php new file mode 100644 index 0000000000..7c4be85cf1 --- /dev/null +++ b/ext/dom/tests/domdocumentloadxml_test_method.php @@ -0,0 +1,12 @@ +<?php +include(dirname(__FILE__) . '/domdocumentload_utilities.php'); + +$doc = new DOMDocument(); + +$libxml_options = libxml_options_to_int(getenv('LOAD_OPTIONS')); +$result = $doc->loadXML(file_get_contents(dirname(__FILE__) . getenv('XML_FILE')), + $libxml_options); + +$expectedResult = (bool) getenv('EXPECTED_RESULT'); +assert('$result === $expectedResult'); +?> diff --git a/ext/dom/tests/domdocumentloadxml_test_method_savexml.php b/ext/dom/tests/domdocumentloadxml_test_method_savexml.php new file mode 100644 index 0000000000..550219fb78 --- /dev/null +++ b/ext/dom/tests/domdocumentloadxml_test_method_savexml.php @@ -0,0 +1,14 @@ +<?php +include(dirname(__FILE__) . '/domdocumentload_utilities.php'); + +$doc = new DOMDocument(); + +$libxml_options = libxml_options_to_int(getenv('LOAD_OPTIONS')); +$result = $doc->loadXML(file_get_contents(dirname(__FILE__) . getenv('XML_FILE')), + $libxml_options); + +$expectedResult = (bool) getenv('EXPECTED_RESULT'); +assert('$result === $expectedResult'); + +echo $doc->saveXML(); +?> diff --git a/ext/dom/tests/not_well_formed.xml b/ext/dom/tests/not_well_formed.xml new file mode 100644 index 0000000000..d362e0c4b9 --- /dev/null +++ b/ext/dom/tests/not_well_formed.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<!-- Opening and ending tag mismatch --> +<books> + <book> + <title>The Grapes of Wrath + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/not_well_formed2.xml b/ext/dom/tests/not_well_formed2.xml new file mode 100644 index 0000000000..da6b3bccba --- /dev/null +++ b/ext/dom/tests/not_well_formed2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<!-- AttValue: " or ' expected --> +<books> + <book number=nine> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/not_well_formed3.xml b/ext/dom/tests/not_well_formed3.xml new file mode 100644 index 0000000000..99b2189074 --- /dev/null +++ b/ext/dom/tests/not_well_formed3.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<!-- Opening and ending tag mismatch --> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <boOk> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/not_well_formed4.xml b/ext/dom/tests/not_well_formed4.xml new file mode 100644 index 0000000000..581b8bd962 --- /dev/null +++ b/ext/dom/tests/not_well_formed4.xml @@ -0,0 +1,12 @@ +<?xml version="3.1" ?> +<!-- Unsupported version '3.1' --> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/not_well_formed5.xml b/ext/dom/tests/not_well_formed5.xml new file mode 100644 index 0000000000..f42ead83ab --- /dev/null +++ b/ext/dom/tests/not_well_formed5.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" ?> +<!-- Extra content at the end of the document --> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> diff --git a/ext/dom/tests/wrong_book_with_dtd.xml b/ext/dom/tests/wrong_book_with_dtd.xml new file mode 100644 index 0000000000..3a2d48e355 --- /dev/null +++ b/ext/dom/tests/wrong_book_with_dtd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE books SYSTEM "books.dtd"> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/dom/tests/wrong_book_with_dtd2.xml b/ext/dom/tests/wrong_book_with_dtd2.xml new file mode 100644 index 0000000000..6c49deb1f5 --- /dev/null +++ b/ext/dom/tests/wrong_book_with_dtd2.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE books [ +<!ENTITY entitest "entity is only for test purposes"> +<!ATTLIST title default CDATA "default title"> +<!ELEMENT books (book)*> +<!ELEMENT book (title , author)> +<!ELEMENT title (#PCDATA)> +<!ELEMENT author (#PCDATA)> +]> +<books> + <book> + <title>The Grapes of Wrath</title> + <author>John Steinbeck</author> + <author>John Steinbeck</author> + </book> + <book> + <title>The Pearl</title> + <author>John Steinbeck</author> + </book> +</books> diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4 index cc40d0bd03..db8a69c5d1 100755 --- a/ext/enchant/config.m4 +++ b/ext/enchant/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(enchant,for ENCHANT support, -[ --with-enchant[=DIR] Include enchant support. +[ --with-enchant[=DIR] Include enchant support. GNU Aspell version 1.1.3 or higher required.]) if test "$PHP_ENCHANT" != "no"; then diff --git a/ext/ereg/config0.m4 b/ext/ereg/config0.m4 index f4f8190932..caec39d285 100644 --- a/ext/ereg/config0.m4 +++ b/ext/ereg/config0.m4 @@ -5,7 +5,7 @@ dnl dnl Check for regex library type dnl PHP_ARG_WITH(regex,, -[ --with-regex=TYPE regex library type: system, php. [TYPE=php] +[ --with-regex=TYPE Regex library type: system, php. [TYPE=php] WARNING: Do NOT use unless you know what you are doing!], php, no) case $PHP_REGEX in diff --git a/ext/exif/exif.c b/ext/exif/exif.c index bd646d9adf..ec121a6c32 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -40,16 +40,6 @@ #include "php.h" #include "ext/standard/file.h" -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#endif -#ifdef PHP_WIN32 -# include "win32/php_stdint.h" -#endif - #if HAVE_EXIF /* When EXIF_DEBUG is defined the module generates a lot of debug messages diff --git a/ext/filter/config.m4 b/ext/filter/config.m4 index b4e32a21a4..676f5d99ef 100644 --- a/ext/filter/config.m4 +++ b/ext/filter/config.m4 @@ -5,7 +5,7 @@ PHP_ARG_ENABLE(filter, whether to enable input filter support, [ --disable-filter Disable input filter support], yes) PHP_ARG_WITH(pcre-dir, pcre install prefix, -[ --with-pcre-dir FILTER: pcre install prefix], no, no) +[ --with-pcre-dir FILTER: pcre install prefix], no, no) if test "$PHP_FILTER" != "no"; then diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 50660af6cd..c9e080faab 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -7,11 +7,11 @@ dnl Configure options dnl PHP_ARG_WITH(gd, for GD support, -[ --with-gd[=DIR] Include GD support. DIR is the GD library base +[ --with-gd[=DIR] Include GD support. DIR is the GD library base install directory [BUNDLED]]) if test -z "$PHP_VPX_DIR"; then PHP_ARG_WITH(vpx-dir, for the location of libvpx, - [ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no) + [ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no) fi if test -z "$PHP_JPEG_DIR"; then @@ -39,10 +39,10 @@ PHP_ARG_WITH(t1lib, for T1lib support, [ --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no) PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD, -[ --enable-gd-native-ttf GD: Enable TrueType string function], no, no) +[ --enable-gd-native-ttf GD: Enable TrueType string function], no, no) PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD, -[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no) +[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no) dnl dnl Checks for the configure options diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4 index 02d436c6e7..24dddd3a43 100644 --- a/ext/gettext/config.m4 +++ b/ext/gettext/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(gettext,for GNU gettext support, -[ --with-gettext[=DIR] Include GNU gettext support]) +[ --with-gettext[=DIR] Include GNU gettext support]) if test "$PHP_GETTEXT" != "no"; then for i in $PHP_GETTEXT /usr/local /usr; do diff --git a/ext/gmp/config.m4 b/ext/gmp/config.m4 index 9606b2f56d..2140aaf701 100644 --- a/ext/gmp/config.m4 +++ b/ext/gmp/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(gmp, for GNU MP support, -[ --with-gmp[=DIR] Include GNU MP support]) +[ --with-gmp[=DIR] Include GNU MP support]) if test "$PHP_GMP" != "no"; then diff --git a/ext/hash/config.m4 b/ext/hash/config.m4 index 79ac25e19f..5174db3b71 100644 --- a/ext/hash/config.m4 +++ b/ext/hash/config.m4 @@ -2,7 +2,7 @@ dnl $Id$ dnl config.m4 for extension hash PHP_ARG_WITH(mhash, for mhash support, -[ --with-mhash[=DIR] Include mhash support]) +[ --with-mhash[=DIR] Include mhash support]) PHP_ARG_ENABLE(hash, whether to enable hash support, [ --disable-hash Disable hash support], yes) @@ -31,7 +31,7 @@ if test "$PHP_HASH" != "no"; then EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \ php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \ php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \ - php_hash_fnv.h php_hash_joaat.h php_hash_types.h" + php_hash_fnv.h php_hash_joaat.h" PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared) ifdef([PHP_INSTALL_HEADERS], [ diff --git a/ext/hash/config.w32 b/ext/hash/config.w32 index abe8675f30..8e9d4c3d48 100644 --- a/ext/hash/config.w32 +++ b/ext/hash/config.w32 @@ -19,7 +19,6 @@ if (PHP_HASH != "no") { PHP_INSTALL_HEADERS("ext/hash/", "php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h " + "php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h " + - "php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h " + - "php_hash_types.h"); + "php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h"); } diff --git a/ext/hash/package.xml b/ext/hash/package.xml index 119cdd673d..25a598a4a1 100644 --- a/ext/hash/package.xml +++ b/ext/hash/package.xml @@ -42,7 +42,6 @@ Supported Algorithms: <file role="src" name="config.w32"/> <file role="src" name="hash.c"/> <file role="src" name="php_hash.h"/> - <file role="src" name="php_hash_types.h"/> <file role="src" name="hash_md.c"/> <file role="src" name="php_hash_md.h"/> <file role="src" name="hash_sha.c"/> diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 4bfddbacd9..3f5e7ced3a 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -22,7 +22,6 @@ #define PHP_HASH_H #include "php.h" -#include "php_hash_types.h" #define PHP_HASH_EXTNAME "hash" #define PHP_HASH_EXTVER "1.0" @@ -30,6 +29,12 @@ #define PHP_HASH_HMAC 0x0001 +#define L64 INT64_C +#define php_hash_int32 int32_t +#define php_hash_uint32 uint32_t +#define php_hash_int64 int64_t +#define php_hash_uint64 uint64_t + typedef void (*php_hash_init_func_t)(void *context); typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count); typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context); diff --git a/ext/hash/php_hash_types.h b/ext/hash/php_hash_types.h deleted file mode 100644 index 8793da55d6..0000000000 --- a/ext/hash/php_hash_types.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Michael Wallner <mike@php.net> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef PHP_HASH_TYPES_H -#define PHP_HASH_TYPES_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#else -#ifndef PHP_WIN32 -#include "php_config.h" -#endif -#endif - -#ifndef PHP_WIN32 -#if SIZEOF_LONG == 8 -#define L64(x) x -typedef unsigned long php_hash_uint64; -#if SIZEOF_INT == 4 -typedef unsigned int php_hash_uint32; -#elif SIZEOF_SHORT == 4 -typedef unsigned short php_hash_uint32; -#else -#error "Need a 32bit integer type" -#endif -#elif SIZEOF_LONG_LONG == 8 -#define L64(x) x##LL -typedef unsigned long long php_hash_uint64; -#if SIZEOF_INT == 4 -typedef unsigned int php_hash_uint32; -#elif SIZEOF_LONG == 4 -typedef unsigned long php_hash_uint32; -#else -#error "Need a 32bit integer type" -#endif -#else -#error "Need a 64bit integer type" -#endif -#else -#define L64(x) x##i64 -typedef unsigned __int64 php_hash_uint64; -typedef unsigned __int32 php_hash_uint32; -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4 index d673b0adba..10d21ccc6d 100644 --- a/ext/iconv/config.m4 +++ b/ext/iconv/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(iconv, for iconv support, -[ --without-iconv[=DIR] Exclude iconv support], yes) +[ --without-iconv[=DIR] Exclude iconv support], yes) if test "$PHP_ICONV" != "no"; then diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index 3ad7c107dd..3efc245901 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -95,7 +95,7 @@ AC_DEFUN([PHP_IMAP_SSL_CHK], [ PHP_ARG_WITH(imap,for IMAP support, -[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) +[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) PHP_ARG_WITH(kerberos,for IMAP Kerberos support, [ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix], no, no) diff --git a/ext/interbase/config.m4 b/ext/interbase/config.m4 index 603145ad6c..dfd850b00a 100644 --- a/ext/interbase/config.m4 +++ b/ext/interbase/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(interbase,for InterBase support, -[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base +[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base install directory [/usr/interbase]]) if test "$PHP_INTERBASE" != "no"; then diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index 58d994c10e..3c8e23ea8e 100644 --- a/ext/ldap/config.m4 +++ b/ext/ldap/config.m4 @@ -63,7 +63,7 @@ AC_DEFUN([PHP_LDAP_SASL_CHECKS], [ ]) PHP_ARG_WITH(ldap,for LDAP support, -[ --with-ldap[=DIR] Include LDAP support]) +[ --with-ldap[=DIR] Include LDAP support]) PHP_ARG_WITH(ldap-sasl,for LDAP Cyrus SASL support, [ --with-ldap-sasl[=DIR] LDAP: Include Cyrus SASL support], no, no) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 9ee4de25b7..05b8df4d0d 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -44,6 +44,7 @@ #include <libxml/xmlsave.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/relaxng.h> +#include <libxml/xmlschemas.h> #endif #include "php_libxml.h" @@ -799,6 +800,11 @@ static PHP_MINIT_FUNCTION(libxml) #endif REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); + /* Schema validation options */ +#if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 + REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); +#endif + /* Additional constants for use with loading html */ #if LIBXML_VERSION >= 20707 REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4 index 5d70d45b80..25bf238761 100644 --- a/ext/mbstring/config.m4 +++ b/ext/mbstring/config.m4 @@ -344,19 +344,19 @@ PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, [ --enable-mbstring Enable multibyte string support]) PHP_ARG_ENABLE([mbregex], [whether to enable multibyte regex support], -[ --disable-mbregex MBSTRING: Disable multibyte regex support], yes, no) +[ --disable-mbregex MBSTRING: Disable multibyte regex support], yes, no) PHP_ARG_ENABLE([mbregex_backtrack], [whether to check multibyte regex backtrack], [ --disable-mbregex-backtrack - MBSTRING: Disable multibyte regex backtrack check], yes, no) + MBSTRING: Disable multibyte regex backtrack check], yes, no) PHP_ARG_WITH(libmbfl, [for external libmbfl], [ --with-libmbfl[=DIR] MBSTRING: Use external libmbfl. DIR is the libmbfl base - install directory [BUNDLED]], no, no) + install directory [BUNDLED]], no, no) PHP_ARG_WITH(onig, [for external oniguruma], [ --with-onig[=DIR] MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix. - If DIR is not set, the bundled oniguruma will be used], no, no) + If DIR is not set, the bundled oniguruma will be used], no, no) if test "$PHP_MBSTRING" != "no"; then AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support]) diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4 index cc68d8627b..ab954e649e 100644 --- a/ext/mcrypt/config.m4 +++ b/ext/mcrypt/config.m4 @@ -21,7 +21,7 @@ AC_DEFUN([PHP_MCRYPT_CHECK_VERSION],[ PHP_ARG_WITH(mcrypt, for mcrypt support, -[ --with-mcrypt[=DIR] Include mcrypt support]) +[ --with-mcrypt[=DIR] Include mcrypt support]) if test "$PHP_MCRYPT" != "no"; then for i in $PHP_MCRYPT /usr/local /usr; do diff --git a/ext/mssql/config.m4 b/ext/mssql/config.m4 index 4231bb360a..2a298af734 100644 --- a/ext/mssql/config.m4 +++ b/ext/mssql/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(mssql,for MSSQL support via FreeTDS, -[ --with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home +[ --with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home directory [/usr/local/freetds]]) if test "$PHP_MSSQL" != "no"; then diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4 index 998323d7c4..fd7f52ef3a 100644 --- a/ext/mysql/config.m4 +++ b/ext/mysql/config.m4 @@ -40,13 +40,14 @@ AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [ PHP_ARG_WITH(mysql, for MySQL support, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory, if no DIR is passed or the value is mysqlnd the MySQL native driver will be used]) PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket, -[ --with-mysql-sock[=SOCKPATH] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. - If unspecified, the default locations are searched], no, no) +[ --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 PHP_ARG_WITH(zlib-dir, for the location of libz, diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4 index 687b422898..f6c86e762b 100644 --- a/ext/mysqli/config.m4 +++ b/ext/mysqli/config.m4 @@ -3,13 +3,14 @@ dnl $Id$ dnl config.m4 for extension mysqli PHP_ARG_WITH(mysqli, for MySQLi support, -[ --with-mysqli[=FILE] Include MySQLi support. FILE is the path +[ --with-mysqli[=FILE] Include MySQLi support. FILE is the path to mysql_config. If no value or mysqlnd is passed as FILE, the MySQL native driver will be used]) PHP_ARG_ENABLE(embedded_mysqli, whether to enable embedded MySQLi support, -[ --enable-embedded-mysqli MYSQLi: Enable embedded support - Note: Does not work with MySQL native driver!], no, no) +[ --enable-embedded-mysqli + MYSQLi: Enable embedded support + Note: Does not work with MySQL native driver!], no, no) if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then dnl This needs to be set in any extension which wishes to use mysqlnd diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 3fc767b231..0e08b977af 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -8,11 +8,11 @@ PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd, PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed protocol support in mysqlnd, [ --disable-mysqlnd-compression-support - Disable support for the MySQL compressed protocol in mysqlnd], yes, no) + Disable support for the MySQL compressed protocol in mysqlnd], yes, no) if test -z "$PHP_ZLIB_DIR"; then PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] mysqlnd: Set the path to libz install prefix], no, no) + [ --with-zlib-dir[=DIR] mysqlnd: Set the path to libz install prefix], no, no) fi dnl If some extension uses mysqlnd it will get compiled in PHP core @@ -48,16 +48,4 @@ fi if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then PHP_ADD_BUILD_DIR([ext/mysqlnd], 1) - - dnl This creates a file so it has to be after above macros - PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [ - ext/mysqlnd/php_mysqlnd_config.h - ],[ -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif - ]) fi diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 1a898690e3..b41e5424f5 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -1225,6 +1225,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC #include "php_network.h" +/* {{{ mysqlnd_stream_array_to_fd_set */ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS_DC) { int cnt = 0; @@ -1255,14 +1256,17 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS } return ret; } +/* }}} */ -/* {{{ stream_select mysqlnd_stream_array_to_fd_set functions */ +/* {{{ mysqlnd_stream_array_to_fd_set */ 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; - int cnt = 0; + php_stream *stream = NULL; + unsigned int cnt = 0; MYSQLND **p = conn_array; + DBG_ENTER("mysqlnd_stream_array_to_fd_set"); while (*p) { /* get the fd. @@ -1270,7 +1274,9 @@ 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->data->m.get_stream((*p)->data->net TSRMLS_CC), PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, + stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC); + DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, 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); @@ -1282,20 +1288,25 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p } p++; } - return cnt ? 1 : 0; + DBG_RETURN(cnt ? 1 : 0); } +/* }}} */ + +/* {{{ mysqlnd_stream_array_from_fd_set */ 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; - - MYSQLND **fwd = conn_array, **bckwd = conn_array; + DBG_ENTER("mysqlnd_stream_array_from_fd_set"); while (*fwd) { - if (SUCCESS == php_stream_cast((*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC), PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, + stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC); + DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, 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) { @@ -1312,7 +1323,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds } *bckwd = NULL;/* NULL-terminate the list */ - return ret; + DBG_RETURN(ret); } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index b9479150ae..72a156a795 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -36,8 +36,6 @@ This file is public domain and comes with NO WARRANTY of any kind */ #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) # include "ext/mysqlnd/config-win.h" -#else -# include <ext/mysqlnd/php_mysqlnd_config.h> #endif /* _WIN32... */ #if __STDC_VERSION__ < 199901L && !defined(atoll) @@ -45,14 +43,7 @@ This file is public domain and comes with NO WARRANTY of any kind */ #define atoll atol #endif - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif +#include "php_stdint.h" #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) #define _LONG_LONG 1 /* For AIX string library */ @@ -70,102 +61,6 @@ This file is public domain and comes with NO WARRANTY of any kind */ #define HAVE_LONG_LONG 1 #endif - -/* Typdefs for easyier portability */ -#ifndef HAVE_INT8_T -#ifndef HAVE_INT8 -typedef signed char int8_t; /* Signed integer >= 8 bits */ -#else -typedef int8 int8_t; /* Signed integer >= 8 bits */ -#endif -#endif - -#ifndef HAVE_UINT8_T -#ifndef HAVE_UINT8 -typedef unsigned char uint8_t; /* Unsigned integer >= 8 bits */ -#else -typedef uint8 uint8_t; /* Signed integer >= 8 bits */ -#endif -#endif - -#ifndef HAVE_INT16_T -#ifndef HAVE_INT16 -typedef signed short int16_t; /* Signed integer >= 16 bits */ -#else -typedef int16 int16_t; /* Signed integer >= 16 bits */ -#endif -#endif - -#ifndef HAVE_UINT16_T -#ifndef HAVE_UINT16 -typedef unsigned short uint16_t; /* Signed integer >= 16 bits */ -#else -typedef uint16 uint16_t; /* Signed integer >= 16 bits */ -#endif -#endif - - -#ifndef HAVE_INT32_T -#ifdef HAVE_INT32 -typedef int32 int32_t; -#elif SIZEOF_INT == 4 -typedef signed int int32_t; -#elif SIZEOF_LONG == 4 -typedef signed long int32_t; -#else -error "Neither int nor long is of 4 bytes width" -#endif -#endif /* HAVE_INT32_T */ - -#ifndef HAVE_UINT32_T -#ifdef HAVE_UINT32 -typedef uint32 uint32_t; -#elif SIZEOF_INT == 4 -typedef unsigned int uint32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32_t; -#else -#error "Neither int nor long is of 4 bytes width" -#endif -#endif /* HAVE_UINT32_T */ - -#ifndef HAVE_INT64_T -#ifdef HAVE_INT64 -typedef int64 int64_t; -#elif SIZEOF_INT == 8 -typedef signed int int64_t; -#elif SIZEOF_LONG == 8 -typedef signed long int64_t; -#elif SIZEOF_LONG_LONG == 8 -#ifdef PHP_WIN32 -typedef __int64 int64_t; -#else -typedef signed long long int64_t; -#endif -#else -#error "Neither int nor long nor long long is of 8 bytes width" -#endif -#endif /* HAVE_INT64_T */ - -#ifndef HAVE_UINT64_T -#ifdef HAVE_UINT64 -typedef uint64 uint64_t; -#elif SIZEOF_INT == 8 -typedef unsigned int uint64_t; -#elif SIZEOF_LONG == 8 -typedef unsigned long uint64_t; -#elif SIZEOF_LONG_LONG == 8 -#ifdef PHP_WIN32 -typedef unsigned __int64 uint64_t; -#else -typedef unsigned long long uint64_t; -#endif -#else -#error "Neither int nor long nor long long is of 8 bytes width" -#endif -#endif /* HAVE_INT64_T */ - - #ifdef PHP_WIN32 #define MYSQLND_LLU_SPEC "%I64u" #define MYSQLND_LL_SPEC "%I64d" diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index eee4b4ec80..b76db64638 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -103,7 +103,7 @@ dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib dnl or dnl --with-oci8=shared,/path/to/oracle/home PHP_ARG_WITH(oci8, for Oracle Database OCI8 support, -[ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME. +[ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME. Use --with-oci8=instantclient,/path/to/instant/client/lib to use an Oracle Instant Client installation]) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index cd1b0a0860..ad00c02d72 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | + | Authors: Stig S�ther Bakken <ssb@php.net> | | Thies C. Arntzen <thies@thieso.net> | | Maxim Maletsky <maxim@maxim.cx> | | | @@ -37,13 +37,6 @@ #include "php_ini.h" #include "ext/standard/php_smart_str.h" -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef PHP_WIN32 -#include "win32/php_stdint.h" -#endif - #if HAVE_OCI8 #if PHP_MAJOR_VERSION > 5 diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4 index 5be3288f30..14ec97bf36 100644 --- a/ext/odbc/config.m4 +++ b/ext/odbc/config.m4 @@ -101,7 +101,7 @@ dnl configure options dnl if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(adabas,, -[ --with-adabas[=DIR] Include Adabas D support [/usr/local]]) +[ --with-adabas[=DIR] Include Adabas D support [/usr/local]]) if test "$PHP_ADABAS" != "no"; then AC_MSG_CHECKING([for Adabas support]) @@ -128,7 +128,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(sapdb,, -[ --with-sapdb[=DIR] Include SAP DB support [/usr/local]]) +[ --with-sapdb[=DIR] Include SAP DB support [/usr/local]]) if test "$PHP_SAPDB" != "no"; then AC_MSG_CHECKING([for SAP DB support]) @@ -146,7 +146,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(solid,, -[ --with-solid[=DIR] Include Solid support [/usr/local/solid]]) +[ --with-solid[=DIR] Include Solid support [/usr/local/solid]]) if test "$PHP_SOLID" != "no"; then AC_MSG_CHECKING(for Solid support) @@ -171,7 +171,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(ibm-db2,, -[ --with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]]) +[ --with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]]) if test "$PHP_IBM_DB2" != "no"; then AC_MSG_CHECKING(for IBM DB2 support) @@ -208,7 +208,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(ODBCRouter,, -[ --with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]]) +[ --with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]]) if test "$PHP_ODBCROUTER" != "no"; then AC_MSG_CHECKING(for ODBCRouter.com support) @@ -228,7 +228,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(empress,, -[ --with-empress[=DIR] Include Empress support [\$EMPRESSPATH] +[ --with-empress[=DIR] Include Empress support [\$EMPRESSPATH] (Empress Version >= 8.60 required)]) if test "$PHP_EMPRESS" != "no"; then @@ -291,7 +291,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(birdstep,, -[ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) +[ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) if test "$PHP_BIRDSTEP" != "no"; then AC_MSG_CHECKING(for Birdstep support) @@ -338,15 +338,14 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(custom-odbc,, -[ --with-custom-odbc[=DIR] - Include user defined ODBC support. DIR is ODBC install base +[ --with-custom-odbc[=DIR] Include user defined ODBC support. DIR is ODBC install base directory [/usr/local]. Make sure to define CUSTOM_ODBC_LIBS and have some odbc.h in your include dirs. f.e. you should define following for Sybase SQL Anywhere 5.5.00 on QNX, prior to running this configure script: - CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\" - LDFLAGS=-lunix - CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\"]) + CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\" + LDFLAGS=-lunix + CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\"]) if test "$PHP_CUSTOM_ODBC" != "no"; then AC_MSG_CHECKING(for a custom ODBC support) @@ -366,7 +365,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(iodbc,, -[ --with-iodbc[=DIR] Include iODBC support [/usr/local]]) +[ --with-iodbc[=DIR] Include iODBC support [/usr/local]]) if test "$PHP_IODBC" != "no"; then AC_MSG_CHECKING(for iODBC support) @@ -387,7 +386,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(esoob,, -[ --with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]]) +[ --with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]]) if test "$PHP_ESOOB" != "no"; then AC_MSG_CHECKING(for Easysoft ODBC-ODBC Bridge support) @@ -407,7 +406,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(unixODBC,, -[ --with-unixODBC[=DIR] Include unixODBC support [/usr/local]]) +[ --with-unixODBC[=DIR] Include unixODBC support [/usr/local]]) if test "$PHP_UNIXODBC" != "no"; then AC_MSG_CHECKING(for unixODBC support) @@ -428,7 +427,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(dbmaker,, -[ --with-dbmaker[=DIR] Include DBMaker support]) +[ --with-dbmaker[=DIR] Include DBMaker support]) if test "$PHP_DBMAKER" != "no"; then AC_MSG_CHECKING(for DBMaker support) diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index ec5a786577..8c8253757e 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -438,6 +438,58 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { #endif collect_constants = 0; break; + +#if ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO + case ZEND_FETCH_R: + case ZEND_FETCH_W: + case ZEND_FETCH_RW: + case ZEND_FETCH_FUNC_ARG: + case ZEND_FETCH_IS: + case ZEND_FETCH_UNSET: + if (opline != op_array->opcodes && + (opline-1)->opcode == ZEND_BEGIN_SILENCE && + (opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_LOCAL && + opline->op1_type == IS_CONST && + opline->op2_type == IS_UNUSED && + Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && + (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || + memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this")) != 0)) { + + int var = opline->result.var; + int level = 0; + zend_op *op = opline + 1; + + while (op < end) { + if (op->opcode == ZEND_BEGIN_SILENCE) { + level++; + } else if (op->opcode == ZEND_END_SILENCE) { + if (level == 0) { + break; + } else { + level--; + } + } + if (op->op1_type == IS_VAR && op->op1.var == var) { + op->op1_type = IS_CV; + op->op1.var = zend_optimizer_lookup_cv(op_array, + Z_STRVAL(ZEND_OP1_LITERAL(opline)), + Z_STRLEN(ZEND_OP1_LITERAL(opline))); + MAKE_NOP(opline); + break; + } else if (op->op2_type == IS_VAR && op->op2.var == var) { + op->op2_type = IS_CV; + op->op2.var = zend_optimizer_lookup_cv(op_array, + Z_STRVAL(ZEND_OP1_LITERAL(opline)), + Z_STRLEN(ZEND_OP1_LITERAL(opline))); + MAKE_NOP(opline); + break; + } + op++; + } + } + break; +#endif + } opline++; i++; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index f3fbabcf81..a058bd73cb 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -59,6 +59,35 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam return 0;
}
+#if ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO
+static int zend_optimizer_lookup_cv(zend_op_array *op_array, char* name, int name_len)
+{
+ int i = 0;
+ ulong hash_value = zend_inline_hash_func(name, name_len+1);
+
+ while (i < op_array->last_var) {
+ if (op_array->vars[i].name == name ||
+ (op_array->vars[i].hash_value == hash_value &&
+ op_array->vars[i].name_len == name_len &&
+ memcmp(op_array->vars[i].name, name, name_len) == 0)) {
+ return i;
+ }
+ i++;
+ }
+ i = op_array->last_var;
+ op_array->last_var++;
+ op_array->vars = erealloc(op_array->vars, op_array->last_var * sizeof(zend_compiled_variable));
+ if (IS_INTERNED(name)) {
+ op_array->vars[i].name = name;
+ } else {
+ op_array->vars[i].name = estrndup(name, name_len);
+ }
+ op_array->vars[i].name_len = name_len;
+ op_array->vars[i].hash_value = hash_value;
+ return i;
+}
+#endif
+
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC)
{
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 61c685f4b3..1798fe13fa 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(opcache, whether to enable Zend OPcache support, -[ --enable-opcache Enable Zend OPcache support], yes) +[ --enable-opcache Enable Zend OPcache support], yes) if test "$PHP_OPCACHE" != "no"; then diff --git a/ext/openssl/config0.m4 b/ext/openssl/config0.m4 index 2c7f4fb691..a97114f808 100644 --- a/ext/openssl/config0.m4 +++ b/ext/openssl/config0.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(openssl, for OpenSSL support, -[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)]) +[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)]) PHP_ARG_WITH(kerberos, for Kerberos support, [ --with-kerberos[=DIR] OPENSSL: Include Kerberos support], no, no) diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 index 7b6f669a50..a89ab2aea5 100644 --- a/ext/pdo_firebird/config.m4 +++ b/ext/pdo_firebird/config.m4 @@ -4,7 +4,7 @@ dnl PHP_ARG_WITH(pdo-firebird,for Firebird support for PDO, [ --with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base - install directory [/opt/firebird]]) + install directory [/opt/firebird]]) if test "$PHP_PDO_FIREBIRD" != "no"; then diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index a2ba2fdbdd..f237f413be 100755 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -4,12 +4,12 @@ dnl vim: se ts=2 sw=2 et: PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO, [ --with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directory - If no value or mysqlnd is passed as DIR, the - MySQL native driver will be used]) + If no value or mysqlnd is passed as DIR, the + MySQL native driver will be used]) if test -z "$PHP_ZLIB_DIR"; then PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix], no, no) + [ --with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix], no, no) fi if test "$PHP_PDO_MYSQL" != "no"; then diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4 index 0e42d1f9a9..e3795db0ea 100755 --- a/ext/pdo_oci/config.m4 +++ b/ext/pdo_oci/config.m4 @@ -42,11 +42,11 @@ AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[ PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO, [ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME. - Use --with-pdo-oci=instantclient,prefix,version - for an Oracle Instant Client SDK. - For example on Linux with 11.2 RPMs use: + Use --with-pdo-oci=instantclient,prefix,version + for an Oracle Instant Client SDK. + For example on Linux with 11.2 RPMs use: --with-pdo-oci=instantclient,/usr,11.2 - With 10.2 RPMs use: + With 10.2 RPMs use: --with-pdo-oci=instantclient,/usr,10.2.0.4]) if test "$PHP_PDO_OCI" != "no"; then diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 index b70dc9d539..74734c4d63 100755 --- a/ext/pdo_odbc/config.m4 +++ b/ext/pdo_odbc/config.m4 @@ -3,25 +3,25 @@ dnl config.m4 for extension pdo_odbc dnl vim:et:sw=2:ts=2: define([PDO_ODBC_HELP_TEXT],[[ - include and lib dirs are looked for under 'dir'. - - 'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic - If ',dir' part is omitted, default for the flavour - you have selected will used. e.g.: - - --with-pdo-odbc=unixODBC - - will check for unixODBC under /usr/local. You may attempt - to use an otherwise unsupported driver using the \"generic\" - flavour. The syntax for generic ODBC support is: - - --with-pdo-odbc=generic,dir,libname,ldflags,cflags - - When build as shared the extension filename is always pdo_odbc.so]]) + include and lib dirs are looked for under 'dir'. + + 'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic + If ',dir' part is omitted, default for the flavour + you have selected will be used. e.g.: + + --with-pdo-odbc=unixODBC + + will check for unixODBC under /usr/local. You may attempt + to use an otherwise unsupported driver using the \"generic\" + flavour. The syntax for generic ODBC support is: + + --with-pdo-odbc=generic,dir,libname,ldflags,cflags + + When built as 'shared' the extension filename is always pdo_odbc.so]]) PHP_ARG_WITH(pdo-odbc, for ODBC v3 support for PDO, [ --with-pdo-odbc=flavour,dir - PDO: Support for 'flavour' ODBC driver.]PDO_ODBC_HELP_TEXT) + PDO: Support for 'flavour' ODBC driver.]PDO_ODBC_HELP_TEXT) AC_DEFUN([PDO_ODBC_CHECK_HEADER],[ diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4 index f9254a8fd9..afe42e06a5 100644 --- a/ext/pdo_pgsql/config.m4 +++ b/ext/pdo_pgsql/config.m4 @@ -4,7 +4,7 @@ dnl vim:et:sw=2:ts=2: PHP_ARG_WITH(pdo-pgsql,for PostgreSQL support for PDO, [ --with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL base - install directory or the path to pg_config]) + install directory or the path to pg_config]) if test "$PHP_PDO_PGSQL" != "no"; then diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 index b2b70a5038..0a7d0fe826 100644 --- a/ext/pdo_sqlite/config.m4 +++ b/ext/pdo_sqlite/config.m4 @@ -4,8 +4,8 @@ dnl vim:et:sw=2:ts=2: PHP_ARG_WITH(pdo-sqlite, for sqlite 3 support for PDO, [ --without-pdo-sqlite[=DIR] - PDO: sqlite 3 support. DIR is the sqlite base - install directory [BUNDLED]], $PHP_PDO) + PDO: sqlite 3 support. DIR is the sqlite base + install directory [BUNDLED]], $PHP_PDO) if test "$PHP_PDO_SQLITE" != "no"; then diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index bddb77a151..13837bd832 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pgsql,for PostgreSQL support, -[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL +[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL base install directory or the path to pg_config]) if test "$PHP_PGSQL" != "no"; then diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index de8bfc880d..f0e1780a79 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -914,6 +914,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() @@ -4274,7 +4350,6 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l char *from = NULL, *to = NULL, *tmp = NULL; zval *pgsql_link = NULL; PGconn *pgsql; - int to_len; int from_len; int id = -1; @@ -5016,8 +5091,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; @@ -5039,20 +5115,29 @@ 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 + 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 + 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); @@ -5275,6 +5360,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, '\''); @@ -5315,7 +5401,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); @@ -5328,6 +5414,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); @@ -5540,15 +5628,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); } @@ -5834,6 +5922,7 @@ 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); #else @@ -5845,7 +5934,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; @@ -5930,11 +6023,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); @@ -6009,6 +6113,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) @@ -6028,7 +6171,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; @@ -6043,11 +6186,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_EXISTENT) { @@ -6234,7 +6377,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)) @@ -6335,7 +6478,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)) @@ -6471,7 +6614,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/00version.phpt b/ext/pgsql/tests/00version.phpt new file mode 100644 index 0000000000..d72d9e1f21 --- /dev/null +++ b/ext/pgsql/tests/00version.phpt @@ -0,0 +1,30 @@ +--TEST-- +PostgreSQL version +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php +// Get postgresql version for easier debugging. +// Execute run-test.php with --keep-all to get version string in 00version.log or 00version.out +include('config.inc'); + +$db = pg_connect($conn_str); +var_dump(pg_version($db)); +pg_close($db); + +// Get environment vars for debugging +var_dump(serialize($_ENV)); + +echo "OK"; +?> +--EXPECTF-- +array(3) { + ["client"]=> + string(%d) "%s" + ["protocol"]=> + int(%d) + ["server"]=> + string(%d) "%s" +} +string(%d) "%s" +OK 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..c33f1afbd6 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -1,5 +1,5 @@ --TEST-- -PostgreSQL pg_update() (9.0) +PostgreSQL pg_update() (9.0+) --SKIPIF-- <?php include("skipif.inc"); @@ -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_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index a736f34c90..cb54aa8dfb 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #14383 (using postgres with DBA causes DBA not to be able to find any keys) +Bug #14383 (8.0+) (using postgres with DBA causes DBA not to be able to find any keys) --SKIPIF-- <?php require_once(dirname(__FILE__).'/../../dba/tests/skipif.inc'); diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt index 32e789de8d..86875ce39e 100644 --- a/ext/pgsql/tests/80_bug24499.phpt +++ b/ext/pgsql/tests/80_bug24499.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #24499 (Notice: Undefined property: stdClass::) +Bug #24499 (8.0+) (Notice: Undefined property: stdClass::) --SKIPIF-- <?php require_once('skipif.inc'); diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt index 573742c6e4..bf76959772 100644 --- a/ext/pgsql/tests/80_bug32223.phpt +++ b/ext/pgsql/tests/80_bug32223.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #32223 (weird behaviour of pg_last_notice) +Bug #32223 (8.0+) (weird behaviour of pg_last_notice) --SKIPIF-- <?php require_once('skipif.inc'); @@ -15,6 +15,8 @@ end; ' LANGUAGE plpgsql;"); if (!$res) die('skip PLPGSQL not available'); ?> +--INI-- +pgsql.ignore_notice=0 --FILE-- <?php @@ -37,6 +39,7 @@ end; $res = pg_query($dbh, 'SELECT test_notice()'); +var_dump($res); $row = pg_fetch_row($res, 0); var_dump($row); pg_free_result($res); @@ -50,6 +53,7 @@ pg_close($dbh); ?> ===DONE=== --EXPECTF-- +resource(%d) of type (pgsql result) array(1) { [0]=> string(1) "f" diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt index aada3f01ba..6e1a073b99 100644 --- a/ext/pgsql/tests/80_bug32223b.phpt +++ b/ext/pgsql/tests/80_bug32223b.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #32223 (weird behaviour of pg_last_notice using define) +Bug #32223 (8.0+) (weird behaviour of pg_last_notice using define) --SKIPIF-- <?php require_once('skipif.inc'); @@ -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_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt index 9cc8a1d4fd..e1b7fa1b50 100644 --- a/ext/pgsql/tests/80_bug36625.phpt +++ b/ext/pgsql/tests/80_bug36625.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #36625 (pg_trace() does not work) +Bug #36625 (8.0+) (pg_trace() does not work) --SKIPIF-- <?php require_once('skipif.inc'); diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt index 45d26319d3..49f370b88d 100644 --- a/ext/pgsql/tests/80_bug39971.phpt +++ b/ext/pgsql/tests/80_bug39971.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #39971 (pg_insert/pg_update do not allow now() to be used for timestamp fields) +Bug #39971 (8.0+) (pg_insert/pg_update do not allow now() to be used for timestamp fields) --SKIPIF-- <?php require_once('skipif.inc'); diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index 575e527db9..6fb03f387b 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #42783 (pg_insert() does not support an empty value array) +Bug #42783 (8.0+) (pg_insert() does not support an empty value array) --SKIPIF-- <?php require_once('skipif.inc'); 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..ffe31a875e 100644 --- a/ext/pgsql/tests/config.inc +++ b/ext/pgsql/tests/config.inc @@ -2,8 +2,10 @@ // 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 -$table_name = "php_pgsql_test"; // test table that should be exist +// "test" database must be existed. i.e. "createdb test" before testing +// PostgreSQL uses login name as username, user must have access to "test" database. +$conn_str = "host=localhost dbname=test port=5432"; // connection string +$table_name = "php_pgsql_test"; // test table that will be created $num_test_record = 1000; // Number of records to create $table_def = "CREATE TABLE php_pgsql_test (num int, str text, bin bytea);"; // Test table 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_internal.h b/ext/phar/phar_internal.h index 9b8d608207..e0a9faf38f 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -63,9 +63,6 @@ #include "ext/spl/spl_iterators.h" #endif #include "php_phar.h" -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif #ifdef PHAR_HASH_OK #include "ext/hash/php_hash.h" #include "ext/hash/php_hash_sha.h" diff --git a/ext/pspell/config.m4 b/ext/pspell/config.m4 index 67e5b27605..481a9ae891 100644 --- a/ext/pspell/config.m4 +++ b/ext/pspell/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pspell,for PSPELL support, -[ --with-pspell[=DIR] Include PSPELL support. +[ --with-pspell[=DIR] Include PSPELL support. GNU Aspell version 0.50.0 or higher required]) if test "$PHP_PSPELL" != "no"; then diff --git a/ext/readline/config.m4 b/ext/readline/config.m4 index b1cb0b67e8..0a00370fce 100644 --- a/ext/readline/config.m4 +++ b/ext/readline/config.m4 @@ -3,11 +3,11 @@ dnl $Id$ dnl PHP_ARG_WITH(libedit,for libedit readline replacement, -[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)]) +[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)]) if test "$PHP_LIBEDIT" = "no"; then PHP_ARG_WITH(readline,for readline support, - [ --with-readline[=DIR] Include readline support (CLI/CGI only)]) + [ --with-readline[=DIR] Include readline support (CLI/CGI only)]) else dnl "register" the --with-readline option to preven invalid "unknown configure option" warning php_with_readline=no diff --git a/ext/recode/config.m4 b/ext/recode/config.m4 index 8df4cfc41a..7f394d0465 100644 --- a/ext/recode/config.m4 +++ b/ext/recode/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(recode,for recode support, -[ --with-recode[=DIR] Include recode support]) +[ --with-recode[=DIR] Include recode support]) if test "$PHP_RECODE" != "no"; then RECODE_LIST="$PHP_RECODE /usr/local /usr /opt" diff --git a/ext/session/php_session.h b/ext/session/php_session.h index e8e79f0fa6..4307e6afc5 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -180,6 +180,7 @@ typedef struct _php_ps_globals { double rfc1867_min_freq; /* session.upload_progress.min_freq */ zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */ + unsigned char session_data_hash[16]; /* binary MD5 hash length */ } php_ps_globals; typedef php_ps_globals zend_ps_globals; diff --git a/ext/session/session.c b/ext/session/session.c index c02a10d7bf..606c334161 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -346,7 +346,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: @@ -505,8 +505,17 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */ */ } if (val) { + PHP_MD5_CTX context; + + /* Store read data's MD5 hash */ + PHP_MD5Init(&context); + PHP_MD5Update(&context, val, vallen); + PHP_MD5Final(PS(session_data_hash), &context); + php_session_decode(val, vallen TSRMLS_CC); efree(val); + } else { + memset(PS(session_data_hash),'\0', 16); } if (!PS(use_cookies) && PS(send_cookie)) { @@ -529,7 +538,19 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */ val = php_session_encode(&vallen TSRMLS_CC); if (val) { - ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); + PHP_MD5_CTX context; + unsigned char digest[16]; + + /* Generate data's MD5 hash */ + PHP_MD5Init(&context); + PHP_MD5Update(&context, val, vallen); + PHP_MD5Final(digest, &context); + /* Write only when save is required */ + if (memcmp(digest, PS(session_data_hash), 16)) { + ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); + } else { + ret = SUCCESS; + } efree(val); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), "", 0 TSRMLS_CC); @@ -727,6 +748,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ } #endif /* HAVE_HASH_EXT }}} */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value); return FAILURE; } /* }}} */ @@ -776,7 +798,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) @@ -1528,6 +1550,26 @@ static void php_session_flush(TSRMLS_D) /* {{{ */ } /* }}} */ +static void php_session_abort(TSRMLS_D) /* {{{ */ +{ + if (PS(session_status) == php_session_active) { + PS(session_status) = php_session_none; + if (PS(mod_data) || PS(mod_user_implemented)) { + PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); + } + } +} +/* }}} */ + +static void php_session_reset(TSRMLS_D) /* {{{ */ +{ + if (PS(session_status) == php_session_active) { + php_session_initialize(TSRMLS_C); + } +} +/* }}} */ + + PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen TSRMLS_DC) /* {{{ */ { if (PS(apply_trans_sid) && (PS(session_status) == php_session_active)) { @@ -1646,6 +1688,31 @@ static PHP_FUNCTION(session_module_name) } /* }}} */ +/* {{{ proto mixed session_serializer_name([string newname]) + Return the current serializer name used for encode/decode session data. If newname is given, the serialzer name is replaced with newname and return bool */ +static PHP_FUNCTION(session_serializer_name) +{ + char *name = NULL; + int name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { + return; + } + + /* Return serializer name */ + if (!name) { + RETURN_STRING(zend_ini_string("session.serialize_handler", sizeof("session.serialize_handler"), 0), 1); + } + + /* Set serializer name */ + if (zend_alter_ini_entry("session.serialize_handler", sizeof("session.serialize_handler"), name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + /* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid) Sets user-level functions */ static PHP_FUNCTION(session_set_save_handler) @@ -2009,6 +2076,22 @@ static PHP_FUNCTION(session_write_close) } /* }}} */ +/* {{{ proto void session_abort(void) + Abort session and end session. Session data will not be written */ +static PHP_FUNCTION(session_abort) +{ + php_session_abort(TSRMLS_C); +} +/* }}} */ + +/* {{{ proto void session_reset(void) + Reset session data from saved session data */ +static PHP_FUNCTION(session_reset) +{ + php_session_reset(TSRMLS_C); +} +/* }}} */ + /* {{{ proto int session_status(void) Returns the current session status */ static PHP_FUNCTION(session_status) @@ -2021,6 +2104,39 @@ static PHP_FUNCTION(session_status) } /* }}} */ +/* {{{ proto int session_gc([int maxlifetime]) + Execute garbage collection returns number of deleted data */ +static PHP_FUNCTION(session_gc) +{ + int nrdels = -1; + long maxlifetime = PS(gc_maxlifetime); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &maxlifetime) == FAILURE) { + return; + } + + /* Session must be active to have PS(mod) */ + if (PS(session_status) != php_session_active) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to garbage collect without active session"); + RETURN_FALSE; + } + + if (!PS(mod) || !PS(mod)->s_gc) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session save handler does not have gc()"); + RETURN_FALSE; + } + PS(mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC); + + if (nrdels < 0) { + /* Files save handler return -1 if there is not a permission to remove. + Save handlder should return negative nrdels when something wrong. */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session gc failed. Check permission or session storage"); + RETURN_FALSE; + } + RETURN_LONG((long)nrdels); +} +/* }}} */ + /* {{{ proto void session_register_shutdown(void) Registers session_write_close() as a shutdown function */ static PHP_FUNCTION(session_register_shutdown) @@ -2067,6 +2183,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0) ZEND_ARG_INFO(0, module) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_session_serializer_name, 0, 0, 0) + ZEND_ARG_INFO(0, module) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO() @@ -2112,6 +2232,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_cookie_params, 0, 0, 1) ZEND_ARG_INFO(0, httponly) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_session_gc, 0) + ZEND_ARG_INFO(0, maxlifetime) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0) ZEND_ARG_INFO(0, save_path) ZEND_ARG_INFO(0, session_name) @@ -2146,6 +2270,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry session_functions[] = { PHP_FE(session_name, arginfo_session_name) PHP_FE(session_module_name, arginfo_session_module_name) + PHP_FE(session_serializer_name, arginfo_session_serializer_name) PHP_FE(session_save_path, arginfo_session_save_path) PHP_FE(session_id, arginfo_session_id) PHP_FE(session_regenerate_id, arginfo_session_regenerate_id) @@ -2160,7 +2285,10 @@ static const zend_function_entry session_functions[] = { PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params) PHP_FE(session_get_cookie_params, arginfo_session_void) PHP_FE(session_write_close, arginfo_session_void) + PHP_FE(session_abort, arginfo_session_void) + PHP_FE(session_reset, arginfo_session_void) PHP_FE(session_status, arginfo_session_void) + PHP_FE(session_gc, arginfo_session_gc) PHP_FE(session_register_shutdown, arginfo_session_void) PHP_FALIAS(session_commit, session_write_close, arginfo_session_void) PHP_FE_END diff --git a/ext/session/tests/session_abort_basic.phpt b/ext/session/tests/session_abort_basic.phpt new file mode 100644 index 0000000000..4a6702f0dc --- /dev/null +++ b/ext/session/tests/session_abort_basic.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test session_abort() function : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.save_path= +session.name=PHPSESSID +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : void session_abort(void) + * Description : Should abort session. Session data should not be written. + * Source code : ext/session/session.c + */ + +echo "*** Testing session_abort() : basic functionality ***\n"; + +session_start(); +$session_id = session_id(); +$_SESSION['foo'] = 123; +session_commit(); + +session_id($session_id); +session_start(); +$_SESSION['bar'] = 456; +var_dump($_SESSION); +session_abort(); + +session_id($session_id); +session_start(); +var_dump($_SESSION); // Should only have 'foo' + +echo "Done".PHP_EOL; + +?> +--EXPECTF-- +*** Testing session_abort() : basic functionality *** +array(2) { + ["foo"]=> + int(123) + ["bar"]=> + int(456) +} +array(1) { + ["foo"]=> + int(123) +} +Done diff --git a/ext/session/tests/session_gc_basic.phpt b/ext/session/tests/session_gc_basic.phpt new file mode 100644 index 0000000000..f0726ce93b --- /dev/null +++ b/ext/session/tests/session_gc_basic.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test session_gc() function : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.serialize_handler=php +session.save_handler=files +session.maxlifetime=782000 +--FILE-- +<?php +error_reporting(E_ALL); + +ob_start(); + +/* + * Prototype : int session_gc([int maxlifetime]) + * Description : Execute gc and return number of deleted data + * Source code : ext/session/session.c + */ + +echo "*** Testing session_gc() : basic functionality ***\n"; + +// Should fail. It requires active session. +var_dump(session_gc()); + +session_start(); +// Should succeed with some number +var_dump(session_gc()); +// Secound time must be int(0) +var_dump(session_gc()); +session_write_close(); + +// Start&stop session to generate +session_start(); +session_write_close(); +session_start(); +session_write_close(); +session_start(); +session_write_close(); + +session_start(); +$ndeleted = session_gc(0); // Delete all +var_dump($ndeleted >= 3); + +echo "Done".PHP_EOL; + +?> +--EXPECTF-- +*** Testing session_gc() : basic functionality *** + +Warning: session_gc(): Trying to garbage collect without active session in %s on line 15 +bool(false) +int(%d) +int(0) +bool(true) +Done diff --git a/ext/session/tests/session_hash_function_basic.phpt b/ext/session/tests/session_hash_function_basic.phpt new file mode 100644 index 0000000000..45b8bc0710 --- /dev/null +++ b/ext/session/tests/session_hash_function_basic.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test session.hash_function ini setting : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +echo "*** Testing session.hash_function : basic functionality ***\n"; + +var_dump(ini_set('session.hash_function', 'md5')); +var_dump(session_start()); +var_dump(!empty(session_id()), session_id()); +var_dump(session_destroy()); + +var_dump(ini_set('session.hash_function', 'sha1')); +var_dump(session_start()); +var_dump(!empty(session_id()), session_id()); +var_dump(session_destroy()); + +var_dump(ini_set('session.hash_function', 'none')); // Should fail +var_dump(session_start()); +var_dump(!empty(session_id()), session_id()); +var_dump(session_destroy()); + + +echo "Done"; +ob_end_flush(); +?> +--EXPECTF-- +*** Testing session.hash_function : basic functionality *** +string(1) "0" +bool(true) +bool(true) +string(32) "%s" +bool(true) +string(3) "md5" +bool(true) +bool(true) +string(40) "%s" +bool(true) + +Warning: ini_set(): session.configuration 'session.hash_function' must be existing hash function. none does not exist. in %s/session_hash_function_basic.php on line 17 +bool(false) +bool(true) +bool(true) +string(40) "%s" +bool(true) +Done diff --git a/ext/session/tests/session_reset_basic.phpt b/ext/session/tests/session_reset_basic.phpt new file mode 100644 index 0000000000..75c6a04119 --- /dev/null +++ b/ext/session/tests/session_reset_basic.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test session_reset() function : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.save_path= +session.name=PHPSESSID +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : void session_reset(void) + * Description : Should abort session. Session data should not be written. + * Source code : ext/session/session.c + */ + +echo "*** Testing session_abort() : basic functionality ***\n"; + +session_start(); +$session_id = session_id(); +$_SESSION['foo'] = 123; +session_commit(); + +session_id($session_id); +session_start(); +$_SESSION['bar'] = 456; +var_dump($_SESSION); +session_reset(); + +var_dump($_SESSION); // Should only have 'foo' + +echo "Done".PHP_EOL; + +?> +--EXPECTF-- +*** Testing session_abort() : basic functionality *** +array(2) { + ["foo"]=> + int(123) + ["bar"]=> + int(456) +} +array(1) { + ["foo"]=> + int(123) +} +Done diff --git a/ext/session/tests/session_serializer_name_basic.phpt b/ext/session/tests/session_serializer_name_basic.phpt new file mode 100644 index 0000000000..ca292dd36f --- /dev/null +++ b/ext/session/tests/session_serializer_name_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test session_serializer_name() function : basic functionality +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : mixed session_serializer_name([string name]) + * Description : Change/get serialize handler name + * Source code : ext/session/session.c + */ + +echo "*** Testing session_serializer_name() : basic functionality ***\n"; + +var_dump(session_serializer_name()); +var_dump(session_serializer_name('php')); +var_dump(session_serializer_name('php_binary')); +var_dump(session_serializer_name('none')); +var_dump(session_serializer_name()); + +echo "Done"; +ob_end_flush(); +?> +--EXPECTF-- +*** Testing session_serializer_name() : basic functionality *** +string(3) "php" +bool(true) +bool(true) + +Warning: session_serializer_name(): Cannot find serialization handler 'none' in %s/session_serializer_name_basic.php on line 16 +bool(false) +string(10) "php_binary" +Done + diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt index 3897ba9a92..e8496e8afb 100644 --- a/ext/session/tests/session_set_save_handler_basic.phpt +++ b/ext/session/tests/session_set_save_handler_basic.phpt @@ -43,6 +43,7 @@ session_id($session_id); session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); session_start(); var_dump($_SESSION); +$_SESSION['Bar'] = 'Foo'; session_write_close(); ob_end_flush(); @@ -91,5 +92,5 @@ array(3) { ["Guff"]=> int(1234567890) } -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_set_save_handler_class_003.phpt b/ext/session/tests/session_set_save_handler_class_003.phpt index e9a3cc2feb..29b3846851 100644 --- a/ext/session/tests/session_set_save_handler_class_003.phpt +++ b/ext/session/tests/session_set_save_handler_class_003.phpt @@ -58,6 +58,7 @@ session_set_save_handler($handler); session_start(); +$_SESSION['bar'] = 'hello'; session_write_close(); session_unset(); @@ -71,8 +72,10 @@ array(1) { } int(4) string(%d) "%s" -array(1) { +array(2) { ["foo"]=> string(5) "hello" + ["bar"]=> + string(5) "hello" } string(3) "hai" diff --git a/ext/session/tests/session_set_save_handler_class_007.phpt b/ext/session/tests/session_set_save_handler_class_007.phpt index 7344ae1ef3..55f722515e 100644 --- a/ext/session/tests/session_set_save_handler_class_007.phpt +++ b/ext/session/tests/session_set_save_handler_class_007.phpt @@ -56,6 +56,7 @@ $handler = new MySession(2); session_set_save_handler($handler); session_start(); +$_SESSION['abc'] = 'xyz'; // implicit close (called by shutdown function) echo "done\n"; ob_end_flush(); @@ -69,6 +70,6 @@ ob_end_flush(); (#2) constructor called (#1) destructor called done -(#2) writing %s = foo|s:3:"bar"; +(#2) writing %s = foo|s:3:"bar";abc|s:3:"xyz"; (#2) closing %s (#2) destructor called diff --git a/ext/session/tests/session_set_save_handler_closures.phpt b/ext/session/tests/session_set_save_handler_closures.phpt index 21b2c68737..1251886b01 100644 --- a/ext/session/tests/session_set_save_handler_closures.phpt +++ b/ext/session/tests/session_set_save_handler_closures.phpt @@ -42,6 +42,7 @@ echo "Starting session again..!\n"; session_id($session_id); session_set_save_handler($open_closure, $close_closure, $read_closure, $write_closure, $destroy_closure, $gc_closure); session_start(); +$_SESSION['Bar'] = 'Foo'; var_dump($_SESSION); session_write_close(); @@ -83,13 +84,15 @@ array(3) { Starting session again..! Open [%s,PHPSESSID] Read [%s,%s] -array(3) { +array(4) { ["Blah"]=> string(12) "Hello World!" ["Foo"]=> bool(false) ["Guff"]=> int(1234567890) + ["Bar"]=> + string(3) "Foo" } -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_set_save_handler_write_short_circuit.phpt b/ext/session/tests/session_set_save_handler_write_short_circuit.phpt new file mode 100644 index 0000000000..02ca182ec6 --- /dev/null +++ b/ext/session/tests/session_set_save_handler_write_short_circuit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test session_set_save_handler() function : test write short circuit +--INI-- +session.save_path= +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc) + * Description : Sets user-level session storage functions + * Source code : ext/session/session.c + */ + +echo "*** Testing session_set_save_handler() : test write short circuit ***\n"; + +require_once "save_handler.inc"; +$path = dirname(__FILE__); +session_save_path($path); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); + +session_start(); +$session_id = session_id(); +$_SESSION["Blah"] = "Hello World!"; +$_SESSION["Foo"] = FALSE; +$_SESSION["Guff"] = 1234567890; +var_dump($_SESSION); + +session_write_close(); +session_unset(); +var_dump($_SESSION); + +echo "Starting session again..!\n"; +session_id($session_id); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); +session_start(); +var_dump($_SESSION); +$_SESSION['Bar'] = 'Foo'; +session_write_close(); + +echo "Starting session again..!\n"; +session_id($session_id); +session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); +session_start(); +var_dump($_SESSION); +// $_SESSION should be the same and should skip write() +session_write_close(); + +ob_end_flush(); +?> +--EXPECTF-- +*** Testing session_set_save_handler() : test write short circuit *** + +Open [%s,PHPSESSID] +Read [%s,%s] +array(3) { + ["Blah"]=> + string(12) "Hello World!" + ["Foo"]=> + bool(false) + ["Guff"]=> + int(1234567890) +} +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] +Close [%s,PHPSESSID] +array(3) { + ["Blah"]=> + string(12) "Hello World!" + ["Foo"]=> + bool(false) + ["Guff"]=> + int(1234567890) +} +Starting session again..! +Open [%s,PHPSESSID] +Read [%s,%s] +array(3) { + ["Blah"]=> + string(12) "Hello World!" + ["Foo"]=> + bool(false) + ["Guff"]=> + int(1234567890) +} +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] +Close [%s,PHPSESSID] +Starting session again..! +Open [%s,PHPSESSID] +Read [%s,%s] +array(4) { + ["Blah"]=> + string(12) "Hello World!" + ["Foo"]=> + bool(false) + ["Guff"]=> + int(1234567890) + ["Bar"]=> + string(3) "Foo" +} +Close [%s,PHPSESSID]
\ No newline at end of file diff --git a/ext/simplexml/config.m4 b/ext/simplexml/config.m4 index 5b8c11d59f..b06f5b00f0 100644 --- a/ext/simplexml/config.m4 +++ b/ext/simplexml/config.m4 @@ -6,7 +6,7 @@ PHP_ARG_ENABLE(simplexml, whether to enable SimpleXML support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR SimpleXML: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR SimpleXML: libxml2 install prefix], no, no) fi if test "$PHP_SIMPLEXML" != "no"; then diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index 9c0b82f778..dd7a3bf68d 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(snmp,for SNMP support, -[ --with-snmp[=DIR] Include SNMP support]) +[ --with-snmp[=DIR] Include SNMP support]) PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP, [ --with-openssl-dir[=DIR] SNMP: openssl install prefix], no, no) diff --git a/ext/soap/config.m4 b/ext/soap/config.m4 index 8acad8dee3..7fa8c6f0ec 100644 --- a/ext/soap/config.m4 +++ b/ext/soap/config.m4 @@ -6,7 +6,7 @@ PHP_ARG_ENABLE(soap, whether to enable SOAP support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR SOAP: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR SOAP: libxml2 install prefix], no, no) fi if test "$PHP_SOAP" != "no"; then diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index 4794f12443..28aa19def3 100644 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -20,11 +20,6 @@ #define PHP_SPL_H #include "php.h" -#if defined(PHP_WIN32) -# include "win32/php_stdint.h" -#elif defined(HAVE_STDINT_H) -# include <stdint.h> -#endif #include <stdarg.h> #if 0 diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 1365def033..6959a6f916 100644 --- a/ext/sqlite3/config0.m4 +++ b/ext/sqlite3/config0.m4 @@ -3,7 +3,7 @@ dnl config.m4 for extension sqlite3 dnl vim:et:ts=2:sw=2 PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension, -[ --without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to +[ --without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to SQLite3 installation directory.], yes) if test $PHP_SQLITE3 != "no"; then diff --git a/ext/standard/crypt_freesec.h b/ext/standard/crypt_freesec.h index a87663d4fe..860462a2dd 100644 --- a/ext/standard/crypt_freesec.h +++ b/ext/standard/crypt_freesec.h @@ -4,26 +4,13 @@ #define _CRYPT_FREESEC_H #if PHP_WIN32 -# include "win32/php_stdint.h" # ifndef inline # define inline __inline # endif -#else -# include "php_config.h" -# if HAVE_INTTYPES_H -# include <inttypes.h> -# elif HAVE_STDINT_H -# include <stdint.h> -# endif -# ifndef HAVE_UINT32_T -# if SIZEOF_INT == 4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG == 4 -typedef unsigned long int uint32_t; -# endif -# endif #endif +#include "php_stdint.h" + #define MD5_HASH_MAX_LEN 120 struct php_crypt_extended_data { diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index d334e3d477..ccfa66bd60 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -9,15 +9,9 @@ #include <limits.h> #ifdef PHP_WIN32 -# include "win32/php_stdint.h" # define __alignof__ __alignof # define alloca _alloca #else -# if HAVE_INTTYPES_H -# include <inttypes.h> -# elif HAVE_STDINT_H -# include <stdint.h> -# endif # ifndef HAVE_ALIGNOF # include <stddef.h> # define __alignof__(type) offsetof (struct { char c; type member;}, member) diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index 0955532131..ebabed9d24 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -8,15 +8,9 @@ #include <errno.h> #include <limits.h> #ifdef PHP_WIN32 -# include "win32/php_stdint.h" # define __alignof__ __alignof # define alloca _alloca #else -# if HAVE_INTTYPES_H -# include <inttypes.h> -# elif HAVE_STDINT_H -# include <stdint.h> -# endif # ifndef HAVE_ALIGNOF # include <stddef.h> # define __alignof__(type) offsetof (struct { char c; type member;}, member) diff --git a/ext/standard/string.c b/ext/standard/string.c index 6a67efbd7e..5ae729af0f 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf <rasmus@php.net> | - | Stig Sæther Bakken <ssb@php.net> | + | Stig S�ther Bakken <ssb@php.net> | | Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ @@ -23,11 +23,6 @@ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ #include <stdio.h> -#ifdef PHP_WIN32 -# include "win32/php_stdint.h" -#else -# include <stdint.h> -#endif #include "php.h" #include "php_rand.h" #include "php_string.h" diff --git a/ext/sybase_ct/config.m4 b/ext/sybase_ct/config.m4 index 81df1f3126..276fe12675 100644 --- a/ext/sybase_ct/config.m4 +++ b/ext/sybase_ct/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(sybase-ct, for Sybase-CT support, -[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home +[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home directory [/home/sybase]]) if test "$PHP_SYBASE_CT" != "no"; then diff --git a/ext/tidy/config.m4 b/ext/tidy/config.m4 index 675498c8ce..102f6a827e 100644 --- a/ext/tidy/config.m4 +++ b/ext/tidy/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(tidy,for TIDY support, -[ --with-tidy[=DIR] Include TIDY support]) +[ --with-tidy[=DIR] Include TIDY support]) if test "$PHP_TIDY" != "no"; then diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4 index 2b02a92aa9..8f933d490a 100644 --- a/ext/wddx/config.m4 +++ b/ext/wddx/config.m4 @@ -7,11 +7,11 @@ PHP_ARG_ENABLE(wddx,whether to enable WDDX support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR WDDX: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR WDDX: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat dir for WDDX, -[ --with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)],no,no) +[ --with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)],no,no) if test "$PHP_WDDX" != "no"; then diff --git a/ext/xml/config.m4 b/ext/xml/config.m4 index 65f22915b9..ebfc0471e0 100644 --- a/ext/xml/config.m4 +++ b/ext/xml/config.m4 @@ -7,11 +7,11 @@ PHP_ARG_ENABLE(xml,whether to enable XML support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XML: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XML: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat install dir, -[ --with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)], no, no) +[ --with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)], no, no) if test "$PHP_XML" != "no"; then diff --git a/ext/xmlreader/config.m4 b/ext/xmlreader/config.m4 index 3614996fb4..d346b58eea 100644 --- a/ext/xmlreader/config.m4 +++ b/ext/xmlreader/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_ENABLE(xmlreader, whether to enable XMLReader support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLReader: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLReader: libxml2 install prefix], no, no) fi if test "$PHP_XMLREADER" != "no"; then diff --git a/ext/xmlrpc/config.m4 b/ext/xmlrpc/config.m4 index 389d4adaf0..f82016edcb 100644 --- a/ext/xmlrpc/config.m4 +++ b/ext/xmlrpc/config.m4 @@ -8,18 +8,18 @@ sinclude(libxmlrpc/acinclude.m4) sinclude(libxmlrpc/xmlrpc.m4) PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support, -[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support]) +[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support]) if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat dir for XMLRPC-EPI, -[ --with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)],no,no) +[ --with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)],no,no) PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI, -[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI],no,no) +[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI],no,no) if test "$PHP_XMLRPC" != "no"; then diff --git a/ext/xmlwriter/config.m4 b/ext/xmlwriter/config.m4 index 0a5d079430..b3b98012f8 100644 --- a/ext/xmlwriter/config.m4 +++ b/ext/xmlwriter/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_ENABLE(xmlwriter, whether to enable XMLWriter support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLWriter: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLWriter: libxml2 install prefix], no, no) fi if test "$PHP_XMLWRITER" != "no"; then diff --git a/ext/xsl/config.m4 b/ext/xsl/config.m4 index a2b16d24f0..9b6f8aaa49 100644 --- a/ext/xsl/config.m4 +++ b/ext/xsl/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(xsl, for XSL support, -[ --with-xsl[=DIR] Include XSL support. DIR is the libxslt base +[ --with-xsl[=DIR] Include XSL support. DIR is the libxslt base install directory (libxslt >= 1.1.0 required)]) if test "$PHP_XSL" != "no"; then diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index 85f9119f5a..805d92442e 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -11,7 +11,7 @@ if test -z "$PHP_ZLIB_DIR"; then fi PHP_ARG_WITH(pcre-dir, pcre install prefix, -[ --with-pcre-dir ZIP: pcre install prefix], no, no) +[ --with-pcre-dir ZIP: pcre install prefix], no, no) if test "$PHP_ZIP" != "no"; then diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h index 2b4340c861..646c0bde53 100644 --- a/ext/zip/lib/zipconf.h +++ b/ext/zip/lib/zipconf.h @@ -13,11 +13,7 @@ #define LIBZIP_VERSION_MINOR 10 #define LIBZIP_VERSION_MICRO 0 -#ifdef PHP_WIN32 -#include <win32/php_stdint.h> -#else -#include <inttypes.h> -#endif +#include <php_stdint.h> typedef int8_t zip_int8_t; #define ZIP_INT8_MIN INT8_MIN diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4 index 25c7f4f420..ebf67cc001 100644 --- a/ext/zlib/config0.m4 +++ b/ext/zlib/config0.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(zlib,for ZLIB support, -[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)]) +[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)]) PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined, [ --with-zlib-dir=<DIR> Define the location of zlib install directory], no, no) diff --git a/ext/zlib/tests/bug65391.phpt b/ext/zlib/tests/bug65391.phpt new file mode 100644 index 0000000000..439473fc5d --- /dev/null +++ b/ext/zlib/tests/bug65391.phpt @@ -0,0 +1,27 @@ +--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/php.h b/main/php.h index 7c1f8fd0c7..17ac8b4fd2 100644 --- a/main/php.h +++ b/main/php.h @@ -180,6 +180,8 @@ typedef unsigned int socklen_t; # endif #endif +#include "php_stdint.h" + #include "zend_hash.h" #include "zend_alloc.h" #include "zend_stack.h" diff --git a/main/php_stdint.h b/main/php_stdint.h new file mode 100644 index 0000000000..87edb0fde0 --- /dev/null +++ b/main/php_stdint.h @@ -0,0 +1,206 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Michael Wallner <mike@php.net> | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_STDINT_H +#define PHP_STDINT_H + +#if defined(_MSC_VER) +/* Make sure the regular stdint.h wasn't included already and prevent it to be + included afterwards. Though if some other library needs some stuff from + stdint.h included afterwards and misses it, we'd have to extend ours. On + the other hand, if stdint.h was included before, some conflicts might + happen so we'd likewise have to fix ours. */ +# if !defined(_STDINT) +# define _STDINT +# include "win32/php_stdint.h" +# endif +# define HAVE_INT8_T 1 +# define HAVE_UINT8_T 1 +# define HAVE_INT16_T 1 +# define HAVE_UINT16_T 1 +# define HAVE_INT32_T 1 +# define HAVE_UINT32_T 1 +# define HAVE_INT64_T 1 +# define HAVE_UINT64_T 1 +#else + +#include "php_config.h" + +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif + +#if HAVE_STDINT_H +# include <stdint.h> +#endif + +#ifndef HAVE_INT8_T +# ifdef HAVE_INT8 +typedef int8 int8_t; +# else +typedef signed char int8_t; +# endif +#endif + +#ifndef INT8_C +# define INT8_C(c) c +#endif + +#ifndef HAVE_UINT8_T +# ifdef HAVE_UINT8 +typedef uint8 uint8_t +# elif HAVE_U_INT8_T +typedef u_int8_t uint8_t; +# else +typedef unsigned char uint8_t; +# endif +#endif + +#ifndef UINT8_C +# define UINT8_C(c) c +#endif + +#ifndef HAVE_INT16_T +# ifdef HAVE_INT16 +typedef int16 int16_t; +# elif SIZEOF_SHORT >= 2 +typedef signed short int16_t; +# else +# error "No suitable 16bit integer type found" +# endif +#endif + +#ifndef INT16_C +# define INT16_C(c) c +#endif + +#ifndef HAVE_UINT16_T +# ifdef HAVE_UINT16 +typedef uint16 uint16_t +# elif HAVE_U_INT16_T +typedef u_int16_t uint16_t; +# elif SIZEOF_SHORT >= 2 +typedef unsigned short uint16_t; +# else +# error "No suitable 16bit integer type found" +# endif +#endif + +#ifndef UINT16_C +# define UINT16_C(c) c +#endif + +#ifndef HAVE_INT32_T +# ifdef HAVE_INT32 +typedef int32 int32_t; +# elif SIZEOF_INT >= 4 +typedef int int32_t; +# elif SIZEOF_LONG >= 4 +typedef long int32_t; +# else +# error "No suitable 32bit integer type found" +# endif +#endif + +#ifndef INT32_C +# define INT32_C(c) c +#endif + +#ifndef HAVE_UINT32_T +# ifdef HAVE_UINT32 +typedef uint32 uint32_t +# elif HAVE_U_INT32_T +typedef u_int32_t uint32_t; +# elif SIZEOF_INT >= 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG >= 4 +typedef unsigned long uint32_t; +# else +# error "No suitable 32bit integer type found" +# endif +#endif + +#ifndef UINT32_C +# define UINT32_C(c) c ## U +#endif + +#ifndef HAVE_INT64_T +# ifdef HAVE_INT64 +typedef int64 int64_t; +# elif SIZEOF_INT >= 8 +typedef int int64_t; +# elif SIZEOF_LONG >= 8 +typedef long int64_t; +# elif SIZEOF_LONG_LONG >= 8 +typedef long long int64_t; +# else +# error "No suitable 64bit integer type found" +# endif +#endif + +#ifndef INT64_C +# if SIZEOF_INT >= 8 +# define INT64_C(c) c +# elif SIZEOF_LONG >= 8 +# define INT64_C(c) c ## L +# elif SIZEOF_LONG_LONG >= 8 +# define INT64_C(c) c ## LL +# endif +#endif + +#ifndef HAVE_UINT64_T +# ifdef HAVE_UINT64 +typedef uint64 uint64_t +# elif HAVE_U_INT64_T +typedef u_int64_t uint64_t; +# elif SIZEOF_INT >= 8 +typedef unsigned int uint64_t; +# elif SIZEOF_LONG >= 8 +typedef unsigned long uint64_t; +# elif SIZEOF_LONG_LONG >= 8 +typedef unsigned long long uint64_t; +# else +# error "No suitable 64bit integer type found" +# endif +#endif + +#ifndef UINT64_C +# if SIZEOF_INT >= 8 +# define UINT64_C(c) c ## U +# elif SIZEOF_LONG >= 8 +# define UINT64_C(c) c ## UL +# elif SIZEOF_LONG_LONG >= 8 +# define UINT64_C(c) c ## ULL +# endif +#endif + +#endif /* !PHP_WIN32 */ +#endif /* PHP_STDINT_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/php.ini-development b/php.ini-development index 3c53ffd500..5d4c54510c 100644 --- a/php.ini-development +++ b/php.ini-development @@ -909,7 +909,6 @@ default_socket_timeout = 60 ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll -;extension=php_zip.dll ;;;;;;;;;;;;;;;;;;; ; Module Settings ; diff --git a/php.ini-production b/php.ini-production index 91b55d614c..817dd5cc4d 100644 --- a/php.ini-production +++ b/php.ini-production @@ -910,7 +910,6 @@ default_socket_timeout = 60 ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll -;extension=php_zip.dll ;;;;;;;;;;;;;;;;;;; ; Module Settings ; diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4 index 1961289de0..7b0ee562eb 100644 --- a/sapi/apache/config.m4 +++ b/sapi/apache/config.m4 @@ -20,7 +20,7 @@ fi dnl Apache 1.x shared module PHP_ARG_WITH(apxs,, -[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional +[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional pathname to the Apache apxs tool [apxs]], no, no) AC_MSG_CHECKING([for Apache 1.x module support via DSO through APXS]) @@ -123,7 +123,7 @@ fi dnl Apache 1.x static module PHP_ARG_WITH(apache,, -[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache +[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache build directory [/usr/local/apache]], no, no) AC_MSG_CHECKING([for Apache 1.x module support]) @@ -237,7 +237,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then fi PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option, -[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no) +[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no) if test "$PHP_MOD_CHARSET" = "yes"; then AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ]) diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 753de10ba8..02f8a0b3ad 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(apxs2,, -[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional +[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional pathname to the Apache apxs tool [apxs]], no, no) AC_MSG_CHECKING([for Apache 2.0 handler-module support via DSO through APXS]) diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4 index 672f298084..e2c71b4274 100644 --- a/sapi/apache_hooks/config.m4 +++ b/sapi/apache_hooks/config.m4 @@ -239,7 +239,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then fi PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option, -[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no) +[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no) if test "$PHP_MOD_CHARSET" = "yes"; then AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ]) diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4 index 8aba33e23d..5ce55f3f01 100644 --- a/sapi/caudium/config.m4 +++ b/sapi/caudium/config.m4 @@ -4,7 +4,7 @@ dnl RESULT=no PHP_ARG_WITH(caudium,, -[ --with-caudium[=DIR] Build PHP as a Pike module for use with Caudium. +[ --with-caudium[=DIR] Build PHP as a Pike module for use with Caudium. DIR is the Caudium server dir [/usr/local/caudium/server]], no, no) AC_MSG_CHECKING([for Caudium support]) 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_http_parser.h b/sapi/cli/php_http_parser.h index 2bf2356725..31502e213a 100644 --- a/sapi/cli/php_http_parser.h +++ b/sapi/cli/php_http_parser.h @@ -29,15 +29,13 @@ extern "C" { #include <sys/types.h> #if defined(_WIN32) && !defined(__MINGW32__) # include <windows.h> -# include "win32/php_stdint.h" # include "config.w32.h" #else # include "php_config.h" -# ifdef HAVE_STDINT_H -# include <stdint.h> -# endif #endif +#include "php_stdint.h" + /* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run * faster */ diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index c7ae5c62bb..fe13d90007 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -17,7 +17,7 @@ if ($f = fopen("/proc/meminfo","r")) { } } } - + if (empty($enough_free_ram)) { die("need +3G free RAM"); } @@ -29,7 +29,7 @@ echo "Test\n"; include "php_cli_server.inc"; -php_cli_server_start("var_dump(\$_FILES);", false, +php_cli_server_start("var_dump(\$_FILES);", false, "-d post_max_size=3G -d upload_max_filesize=3G"); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4 index 3a61b458f0..5ffb9b39bd 100644 --- a/sapi/embed/config.m4 +++ b/sapi/embed/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(embed,, -[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library +[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library TYPE is either 'shared' or 'static'. [TYPE=shared]], no, no) AC_MSG_CHECKING([for embedded SAPI library support]) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 3d34c79588..bd6d64930b 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(fpm,, -[ --enable-fpm Enable building of the fpm SAPI executable], no, no) +[ --enable-fpm Enable building of the fpm SAPI executable], no, no) dnl configure checks {{{ AC_DEFUN([AC_FPM_STDLIBS], @@ -557,11 +557,11 @@ if test "$PHP_FPM" != "no"; then AC_FPM_SELECT PHP_ARG_WITH(fpm-user,, - [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no) + [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no) PHP_ARG_WITH(fpm-group,, - [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this - should usually be set to match the fpm username (default: nobody)], nobody, no) + [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this + should usually be set to match the fpm username (default: nobody)], nobody, no) PHP_ARG_WITH(fpm-systemd,, [ --with-fpm-systemd Activate systemd integration], no, no) diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4 index 7c7dcf0c21..6014bab09f 100644 --- a/sapi/isapi/config.m4 +++ b/sapi/isapi/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(isapi, for Zeus ISAPI support, -[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no) +[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no) if test "$PHP_ISAPI" != "no"; then if test "$PHP_ISAPI" = "yes"; then diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4 index 48c7a5d804..4bcad80bb4 100644 --- a/sapi/milter/config.m4 +++ b/sapi/milter/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(milter, for Milter support, -[ --with-milter[=DIR] Build PHP as Milter application], no, no) +[ --with-milter[=DIR] Build PHP as Milter application], no, no) if test "$PHP_MILTER" != "no"; then if test "$PHP_MILTER" = "yes"; then diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4 index 7859481508..347a74ca06 100644 --- a/sapi/pi3web/config.m4 +++ b/sapi/pi3web/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pi3web, for Pi3Web support, -[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no) +[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no) if test "$PHP_PI3WEB" != "no"; then if test "$PHP_PI3WEB" = "yes"; then diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4 index 9b0bb90c35..7601b0c1ed 100644 --- a/sapi/roxen/config.m4 +++ b/sapi/roxen/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_WITH(roxen,, directory, normally /usr/local/roxen/server], no, no) PHP_ARG_ENABLE(roxen-zts, whether Roxen module is build using ZTS, -[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no) +[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no) RESULT= AC_MSG_CHECKING([for Roxen/Pike support]) diff --git a/travis/compile.sh b/travis/compile.sh index b48bfe8e24..a56db63c12 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,9 +1,9 @@ #!/bin/bash ./buildconf ./configure --quiet \ ---with-pdo-mysql \ ---with-mysql \ ---with-mysqli \ +--with-pdo-mysql=mysqlnd \ +--with-mysql=mysqlnd \ +--with-mysqli=mysqlnd \ --with-pgsql \ --with-pdo-pgsql \ --with-pdo-sqlite \ |
