diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-10-21 08:52:46 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-10-21 08:52:46 +0200 |
| commit | 01fcdff3849c3691d9aaeaab735846ab6d8895ca (patch) | |
| tree | 6460876d356113fa7053df36f2aa00baa7db24a9 /ext/standard | |
| parent | 855a09f4eded707941180c9d90acd17c25e29447 (diff) | |
| download | php-upstream/5.3.3.tar.gz | |
Imported Upstream version 5.3.3upstream/5.3.3
Diffstat (limited to 'ext/standard')
83 files changed, 1007 insertions, 2020 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index e4156e89d..dd3ed25d9 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c 293982 2010-01-25 14:11:32Z johannes $ */ +/* $Id: array.c 300371 2010-06-11 08:53:31Z dmitry $ */ #include "php.h" #include "php_ini.h" @@ -640,7 +640,7 @@ PHP_FUNCTION(usort) } /* Clear the is_ref flag, so the attemts to modify the array in user - * comaprison function will create a copy of array and won't affect the + * comparison function will create a copy of array and won't affect the * original array. The fact of modification is detected using refcount * comparison. The result of sorting in such case is undefined and the * function returns FALSE. @@ -1057,6 +1057,9 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive /* Set up known arguments */ args[1] = &key; args[2] = userdata; + if (userdata) { + Z_ADDREF_PP(userdata); + } zend_hash_internal_pointer_reset_ex(target_hash, &pos); @@ -1076,6 +1079,9 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive thash = Z_ARRVAL_PP(args[0]); if (thash->nApplyCount > 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); + if (userdata) { + zval_ptr_dtor(userdata); + } return 0; } @@ -1126,6 +1132,9 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive zend_hash_move_forward_ex(target_hash, &pos); } + if (userdata) { + zval_ptr_dtor(userdata); + } return 0; } /* }}} */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index cd722db29..690c4a3a6 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c 294503 2010-02-04 09:08:57Z pajoye $ */ +/* $Id: basic_functions.c 299320 2010-05-13 02:13:30Z felipe $ */ #include "php.h" #include "php_streams.h" @@ -2100,6 +2100,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_stream_set_timeout, 0) ZEND_END_ARG_INFO() #endif +ZEND_BEGIN_ARG_INFO(arginfo_stream_set_read_buffer, 0) + ZEND_ARG_INFO(0, fp) + ZEND_ARG_INFO(0, buffer) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0) ZEND_ARG_INFO(0, fp) ZEND_ARG_INFO(0, buffer) @@ -3104,6 +3109,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(fputcsv, arginfo_fputcsv) PHP_FE(flock, arginfo_flock) PHP_FE(get_meta_tags, arginfo_get_meta_tags) + PHP_FE(stream_set_read_buffer, arginfo_stream_set_read_buffer) PHP_FE(stream_set_write_buffer, arginfo_stream_set_write_buffer) PHP_FALIAS(set_file_buffer, stream_set_write_buffer, arginfo_stream_set_write_buffer) @@ -3820,7 +3826,7 @@ PHP_FUNCTION(constant) return; } - if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, 0 TSRMLS_CC)) { + if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", const_name); RETURN_NULL(); } diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 98912a165..f9bb1052f 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -1,4 +1,4 @@ -dnl $Id: config.m4 295350 2010-02-22 00:34:22Z pajoye $ -*- autoconf -*- +dnl $Id: config.m4 300511 2010-06-17 10:22:03Z pajoye $ -*- autoconf -*- divert(3)dnl @@ -306,6 +306,15 @@ else fi AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt]) + if test "$ac_cv_crypt_md5" = "yes"; then + ac_result=1 + ac_crypt_md5=1 + else + ac_result=0 + ac_crypt_md5=0 + fi + AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt]) + if test "$ac_cv_crypt_sha512" = "yes"; then ac_result=1 ac_crypt_sha512=1 @@ -313,7 +322,7 @@ else ac_result=0 ac_crypt_sha512=0 fi - AC_DEFINE_UNQUOTED(PHP_EXT_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt]) + AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt]) if test "$ac_cv_crypt_sha256" = "yes"; then ac_result=1 @@ -322,7 +331,7 @@ else ac_result=0 ac_crypt_sha256=0 fi - AC_DEFINE_UNQUOTED(PHP_EXT_SHA256_CRYPT, $ac_result, [Whether the system supports SHA256 salt]) + AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, $ac_result, [Whether the system supports SHA256 salt]) AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des]) fi @@ -558,6 +567,11 @@ if test "$ac_cv_type_mbstate_t" = "yes"; then fi dnl +dnl Check for atomic operation API availability in Solaris +dnl +AC_CHECK_HEADERS([atomic.h]) + +dnl dnl Setup extension sources dnl PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \ diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h index 56004e508..9cc7e6e22 100644 --- a/ext/standard/credits_sapi.h +++ b/ext/standard/credits_sapi.h @@ -20,6 +20,7 @@ CREDIT_LINE("CGI / FastCGI", "Rasmus Lerdorf, Stig Bakken, Shane Caraveo, Dmitry CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger, Johannes Schlueter"); CREDIT_LINE("Continuity", "Alex Leigh (based on nsapi code)"); CREDIT_LINE("Embed", "Edin Kadribasic"); +CREDIT_LINE("FastCGI Process Manager", "Andrei Nigmatulin, dreamcat4, Antony Dovgal, Jerome Loyet"); CREDIT_LINE("ISAPI", "Andi Gutmans, Zeev Suraski"); CREDIT_LINE("litespeed", "George Wang"); CREDIT_LINE("NSAPI", "Jayakumar Muthukumarasamy, Uwe Schindler"); diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index b4a5167b9..d2476ce7e 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: crypt.c 295421 2010-02-23 17:49:00Z pajoye $ */ +/* $Id: crypt.c 300429 2010-06-14 09:56:50Z pajoye $ */ #include <stdlib.h> @@ -29,7 +29,7 @@ #if HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef PHP_USE_PHP_CRYPT_R +#if PHP_USE_PHP_CRYPT_R # include "php_crypt_r.h" # include "crypt_freesec.h" #else @@ -107,11 +107,16 @@ PHP_MINIT_FUNCTION(crypt) /* {{{ */ REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); +#ifdef PHP_SHA256_CRYPT + REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); +#endif + +#ifdef PHP_SHA512_CRYPT + REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); +#endif -#ifdef PHP_USE_PHP_CRYPT_R +#if PHP_USE_PHP_CRYPT_R php_init_crypt_r(); #endif @@ -121,7 +126,7 @@ PHP_MINIT_FUNCTION(crypt) /* {{{ */ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ { -#ifdef PHP_USE_PHP_CRYPT_R +#if PHP_USE_PHP_CRYPT_R php_shutdown_crypt_r(); #endif diff --git a/ext/standard/crypt_blowfish.c b/ext/standard/crypt_blowfish.c index c88c699c5..37160842e 100644 --- a/ext/standard/crypt_blowfish.c +++ b/ext/standard/crypt_blowfish.c @@ -1,5 +1,5 @@ /* - $Id: crypt_blowfish.c 295350 2010-02-22 00:34:22Z pajoye $ + $Id: crypt_blowfish.c 295339 2010-02-21 23:47:14Z pajoye $ */ /* * This code comes from John the Ripper password cracker, with reentrant diff --git a/ext/standard/crypt_freesec.c b/ext/standard/crypt_freesec.c index bb9c032c0..37eb538f4 100644 --- a/ext/standard/crypt_freesec.c +++ b/ext/standard/crypt_freesec.c @@ -1,5 +1,5 @@ /* - $Id: crypt_freesec.c 295350 2010-02-22 00:34:22Z pajoye $ + $Id: crypt_freesec.c 295340 2010-02-22 00:05:02Z pajoye $ */ /* * This version is derived from the original implementation of FreeSec @@ -41,7 +41,7 @@ * SUCH DAMAGE. * * $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.4 2005/11/16 13:08:32 solar Exp $ - * $Id: crypt_freesec.c 295350 2010-02-22 00:34:22Z pajoye $ + * $Id: crypt_freesec.c 295340 2010-02-22 00:05:02Z pajoye $ * * This is an original implementation of the DES and the crypt(3) interfaces * by David Burren <davidb at werj.com.au>. diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index 3e234cee9..f9daed909 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -38,7 +38,6 @@ # include <sys/param.h> # include <sys/types.h> # if HAVE_STRING_H -//# define __USE_GNU 1 # include <string.h> # else # include <strings.h> diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index ba9a63918..f78ff0398 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -53,6 +53,11 @@ extern char * __php_stpncpy(char *dst, const char *src, size_t len); # define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif +/* See #51582 */ +#ifndef UINT64_C +# define UINT64_C(value) __CONCAT(value, ULL) +#endif + /* Structure to save state of computation between the single steps. */ struct sha512_ctx { diff --git a/ext/standard/dir.c b/ext/standard/dir.c index fcaf1f0b2..ddf651a11 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: dir.c 300764 2010-06-26 16:03:39Z felipe $ */ /* {{{ includes/startup/misc */ @@ -94,11 +94,17 @@ static zend_class_entry *dir_class_entry_ptr; if (!dirp) \ RETURN_FALSE; \ } + +/* {{{ arginfo */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0) + ZEND_ARG_INFO(0, dir_handle) +ZEND_END_ARG_INFO() +/* }}} */ static const zend_function_entry php_dir_class_functions[] = { - PHP_FALIAS(close, closedir, NULL) - PHP_FALIAS(rewind, rewinddir, NULL) - PHP_NAMED_FE(read, php_if_readdir, NULL) + PHP_FALIAS(close, closedir, arginfo_dir) + PHP_FALIAS(rewind, rewinddir, arginfo_dir) + PHP_NAMED_FE(read, php_if_readdir, arginfo_dir) {NULL, NULL, NULL} }; diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 96d6fb77b..5ed906824 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dns.c 292413 2009-12-21 15:22:40Z jani $ */ +/* $Id: dns.c 293211 2010-01-07 11:02:39Z sebastian $ */ /* {{{ includes */ #include "php.h" diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index 8c94f27f4..bd12c4ade 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -122,7 +122,7 @@ PHP_FUNCTION(dns_check_record) } } - status = DnsQuery_A(hostname, DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &pResult, NULL); + status = DnsQuery_A(hostname, type, DNS_QUERY_STANDARD, NULL, &pResult, NULL); if (status) { RETURN_FALSE; @@ -274,6 +274,12 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, zval **s } } + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + add_assoc_string(*subarray, "type", "AAAA", 1); add_assoc_string(*subarray, "ipv6", buf, 1); } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 54c25f2ef..713a8a09b 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -16,7 +16,7 @@ | Ilia Alshanetsky <iliaa@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: exec.c 294429 2010-02-03 18:11:24Z pajoye $ */ +/* $Id: exec.c 296107 2010-03-12 10:28:59Z jani $ */ #include <stdio.h> #include "php.h" diff --git a/ext/standard/file.c b/ext/standard/file.c index 0bfe060f2..fc16ab98b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c 294896 2010-02-11 18:03:57Z johannes $ */ +/* $Id: file.c 298882 2010-05-02 20:11:22Z felipe $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -136,7 +136,7 @@ php_file_globals file_globals; /* {{{ ZTS-stuff / Globals / Prototypes */ -/* sharing globals is *evil* */ +/* sharing globals is *evil* */ static int le_stream_context = FAILURE; PHPAPI int php_le_stream_context(void) @@ -2521,6 +2521,10 @@ PHP_FUNCTION(fnmatch) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN); RETURN_FALSE; } + if (pattern_len >= MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN); + RETURN_FALSE; + } RETURN_BOOL( ! fnmatch( pattern, filename, flags )); } diff --git a/ext/standard/filters.c b/ext/standard/filters.c index c534cc4b4..13ce8bf8b 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filters.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: filters.c 298700 2010-04-28 14:10:01Z pajoye $ */ #include "php.h" #include "php_globals.h" @@ -1914,7 +1914,7 @@ typedef enum _php_chunked_filter_state { typedef struct _php_chunked_filter_data { php_chunked_filter_state state; - int chunk_size; + size_t chunk_size; int persistent; } php_chunked_filter_data; @@ -1991,7 +1991,7 @@ static int php_dechunk(char *buf, int len, php_chunked_filter_data *data) continue; } case CHUNK_BODY: - if (end - p >= data->chunk_size) { + if ((size_t) (end - p) >= data->chunk_size) { if (p != out) { memmove(out, p, data->chunk_size); } diff --git a/ext/standard/head.c b/ext/standard/head.c index 807d30b10..01dbe57c4 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: head.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: head.c 296107 2010-03-12 10:28:59Z jani $ */ #include <stdio.h> #include "php.h" diff --git a/ext/standard/html.c b/ext/standard/html.c index c9c7a7555..ef6f96043 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: html.c 296121 2010-03-12 16:19:25Z moriyoshi $ */ /* * HTML entity resources: @@ -741,8 +741,8 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) return cs_eucjp; case mbfl_no_encoding_sjis: - case mbfl_no_encoding_sjis_win: - case mbfl_no_encoding_sjis_mac: + case mbfl_no_encoding_sjis_open: + case mbfl_no_encoding_cp932: return cs_sjis; case mbfl_no_encoding_cp1252: diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 5a30d7fa2..09de024b4 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -19,7 +19,7 @@ | Sara Golemon <pollita@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: http_fopen_wrapper.c 294506 2010-02-04 09:17:20Z pajoye $ */ +/* $Id: http_fopen_wrapper.c 293998 2010-01-25 16:28:13Z jani $ */ #include "php.h" #include "php_globals.h" diff --git a/ext/standard/image.c b/ext/standard/image.c index 689f4a85a..85b5cd067 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: image.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: image.c 300881 2010-06-30 12:21:35Z iliaa $ */ #include "php.h" #include <stdio.h> @@ -402,12 +402,7 @@ static unsigned int php_next_marker(php_stream * stream, int last_marker, int co last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */ } } - if (++a > 25) - { - /* who knows the maxim amount of 0xff? though 7 */ - /* but found other implementations */ - return M_EOI; - } + a++; } while (marker == 0xff); if (a < 2) { diff --git a/ext/standard/info.c b/ext/standard/info.c index 7746d0658..631ab3487 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: info.c 299960 2010-05-30 07:46:45Z pajoye $ */ #include "php.h" #include "php_ini.h" @@ -281,11 +281,22 @@ char* php_get_windows_name() } if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) { - if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 ) { - if (osvi.wProductType == VER_NT_WORKSTATION) { - major = "Windows Vista"; + if (osvi.dwMajorVersion == 6) { + if( osvi.dwMinorVersion == 0 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows Vista"; + } else { + major = "Windows Server 2008"; + } + } else + if ( osvi.dwMinorVersion == 2 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 7"; + } else { + major = "Windows Server 2008 R2"; + } } else { - major = "Windows Server 2008"; + major = "Unknow Windows version"; } pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo"); diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index ae94f48e5..9a48ff2ae 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: lcg.c 294448 2010-02-03 20:10:35Z pajoye $ */ +/* $Id: lcg.c 293253 2010-01-08 09:43:14Z rasmus $ */ #include "php.h" #include "php_lcg.h" diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 09fa2ef94..57f69919e 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mail.c 294548 2010-02-05 00:19:32Z pajoye $ */ +/* $Id: mail.c 301396 2010-07-19 13:38:53Z aharvey $ */ #include <stdlib.h> #include <ctype.h> @@ -41,6 +41,7 @@ #include "php_mail.h" #include "php_ini.h" +#include "php_string.h" #include "safe_mode.h" #include "exec.h" @@ -97,7 +98,7 @@ PHP_FUNCTION(ezmlm_hash) Send an email message */ PHP_FUNCTION(mail) { - char *to=NULL, *message=NULL, *headers=NULL; + char *to=NULL, *message=NULL, *headers=NULL, *headers_trimmed=NULL; char *subject=NULL, *extra_cmd=NULL; int to_len, message_len, headers_len = 0; int subject_len, extra_cmd_len = 0, i; @@ -122,6 +123,7 @@ PHP_FUNCTION(mail) MAIL_ASCIIZ_CHECK(message, message_len); if (headers) { MAIL_ASCIIZ_CHECK(headers, headers_len); + headers_trimmed = php_trim(headers, headers_len, NULL, 0, NULL, 2 TSRMLS_CC); } if (extra_cmd) { MAIL_ASCIIZ_CHECK(extra_cmd, extra_cmd_len); @@ -173,12 +175,16 @@ PHP_FUNCTION(mail) extra_cmd = php_escape_shell_cmd(extra_cmd); } - if (php_mail(to_r, subject_r, message, headers, extra_cmd TSRMLS_CC)) { + if (php_mail(to_r, subject_r, message, headers_trimmed, extra_cmd TSRMLS_CC)) { RETVAL_TRUE; } else { RETVAL_FALSE; } + if (headers_trimmed) { + efree(headers_trimmed); + } + if (extra_cmd) { efree (extra_cmd); } @@ -215,7 +221,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char } \ return val; \ - if (mail_log) { + if (mail_log && *mail_log) { char *tmp; int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); php_stream *stream = php_stream_open_wrapper(mail_log, "a", IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 0723ece75..602d298e4 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -15,7 +15,7 @@ | Author: Chris Schneider <cschneid@relog.ch> | +----------------------------------------------------------------------+ */ -/* $Id: pack.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: pack.c 299279 2010-05-12 11:04:57Z dmitry $ */ #include "php.h" @@ -121,6 +121,9 @@ PHP_FUNCTION(pack) return; } + if (Z_ISREF_PP(argv[0])) { + SEPARATE_ZVAL(argv[0]); + } convert_to_string_ex(argv[0]); format = Z_STRVAL_PP(argv[0]); @@ -179,6 +182,9 @@ PHP_FUNCTION(pack) } if (arg < 0) { + if (Z_ISREF_PP(argv[currentarg])) { + SEPARATE_ZVAL(argv[currentarg]); + } convert_to_string_ex(argv[currentarg]); arg = Z_STRLEN_PP(argv[currentarg]); } @@ -312,6 +318,9 @@ PHP_FUNCTION(pack) case 'A': memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg); val = argv[currentarg++]; + if (Z_ISREF_PP(val)) { + SEPARATE_ZVAL(val); + } convert_to_string_ex(val); memcpy(&output[outputpos], Z_STRVAL_PP(val), (Z_STRLEN_PP(val) < arg) ? Z_STRLEN_PP(val) : arg); @@ -325,6 +334,9 @@ PHP_FUNCTION(pack) char *v; val = argv[currentarg++]; + if (Z_ISREF_PP(val)) { + SEPARATE_ZVAL(val); + } convert_to_string_ex(val); v = Z_STRVAL_PP(val); outputpos--; diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index 3d9d0229d..5e2d851de 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -1,4 +1,4 @@ -/* $Id: php_crypt_r.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_crypt_r.c 300511 2010-06-17 10:22:03Z pajoye $ */ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -42,7 +42,11 @@ # include <Wincrypt.h> #endif -#include <signal.h> +#ifdef HAVE_ATOMIC_H /* Solaris 10 defines atomic API within */ +# include <atomic.h> +#else +# include <signal.h> +#endif #include "php_crypt_r.h" #include "crypt_freesec.h" @@ -75,17 +79,28 @@ void php_shutdown_crypt_r() void _crypt_extended_init_r(void) { +#ifdef PHP_WIN32 + LONG volatile initialized = 0; +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + volatile unsigned int initialized = 0; +#else static volatile sig_atomic_t initialized = 0; +#endif #ifdef ZTS tsrm_mutex_lock(php_crypt_extended_init_lock); #endif - if (initialized) { - return; - } else { + if (!initialized) { +#ifdef PHP_WIN32 + InterlockedIncrement(&initialized); +#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) + __sync_fetch_and_add(&initialized, 1); +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + membar_producer(); + atomic_add_int(&initialized, 1); +#endif _crypt_extended_init(); - initialized = 1; } #ifdef ZTS tsrm_mutex_unlock(php_crypt_extended_init_lock); @@ -212,9 +227,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) { strcat_s(passwd, MD5_HASH_MAX_LEN, "$"); #else /* VC6 version doesn't have strcat_s or strncpy_s */ - if (strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1) < sl) { - goto _destroyCtx1; - } + strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1); strcat(passwd, "$"); #endif dwHashLen = 16; diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h index 95900ae64..c5b84274b 100644 --- a/ext/standard/php_dns.h +++ b/ext/standard/php_dns.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | + | Copyright (c) 1997-2010 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dns.h 289691 2009-10-16 02:10:52Z scottmac $ */ +/* $Id: php_dns.h 293211 2010-01-07 11:02:39Z sebastian $ */ #ifndef PHP_DNS_H #define PHP_DNS_H diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 76546f3bf..3dc23e164 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_var.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_var.h 301144 2010-07-09 21:19:27Z scottmac $ */ #ifndef PHP_VAR_H #define PHP_VAR_H @@ -33,6 +33,8 @@ PHP_FUNCTION(memory_get_peak_usage); PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC); PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC); +PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC); + PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC); /* typdef HashTable php_serialize_data_t; */ @@ -60,6 +62,7 @@ PHPAPI int php_var_unserialize(zval **rval, const unsigned char **p, const unsig var_destroy(&(var_hash)) PHPAPI void var_replace(php_unserialize_data_t *var_hash, zval *ozval, zval **nzval); +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hash, zval **val); PHPAPI void var_destroy(php_unserialize_data_t *var_hash); #define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash, ozval, nzval) \ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 81a49e42b..dbfe83d59 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: scanf.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: scanf.c 299484 2010-05-19 11:28:08Z mike $ */ /* scanf.c -- @@ -581,7 +581,8 @@ PHPAPI int php_sscanf_internal( char *string, char *format, int varStart, zval **return_value TSRMLS_DC) { int numVars, nconversions, totalVars = -1; - int i, value, result; + int i, result; + long value; int objIndex; char *end, *baseString; zval **current; @@ -1059,9 +1060,9 @@ addToInt: */ if (!(flags & SCAN_SUPPRESS)) { *end = '\0'; - value = (int) (*fn)(buf, NULL, base); + value = (long) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { - snprintf(buf, sizeof(buf), "%u", value); /* INTL: ISO digit */ + snprintf(buf, sizeof(buf), "%lu", value); /* INTL: ISO digit */ if (numVars && objIndex >= argCount) { break; } else if (numVars) { diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index a0300606f..6285a337f 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c 293995 2010-01-25 15:57:24Z johannes $ */ +/* $Id: streamsfuncs.c 297895 2010-04-12 13:10:05Z pajoye $ */ #include "php.h" #include "php_globals.h" @@ -70,7 +70,7 @@ PHP_FUNCTION(stream_socket_pair) s1 = php_stream_sock_open_from_socket(pair[0], 0); s2 = php_stream_sock_open_from_socket(pair[1], 0); - /* set the __exposed flag. + /* set the __exposed flag. * php_stream_to_zval() does, add_next_index_resource() does not */ php_stream_auto_cleanup(s1); php_stream_auto_cleanup(s2); @@ -99,11 +99,11 @@ PHP_FUNCTION(stream_socket_client) php_stream_context *context = NULL; RETVAL_FALSE; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } - + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); if (context) { @@ -113,7 +113,7 @@ PHP_FUNCTION(stream_socket_client) if (flags & PHP_STREAM_CLIENT_PERSISTENT) { spprintf(&hashkey, 0, "stream_socket_client__%s", host); } - + /* prepare the timeout value for use */ conv = (php_timeout_ull) (timeout * 1000000.0); tv.tv_sec = conv / 1000000; @@ -132,12 +132,12 @@ PHP_FUNCTION(stream_socket_client) STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) | (flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0), hashkey, &tv, context, &errstr, &err); - + if (stream == NULL) { /* host might contain binary characters */ char *quoted_host = php_addslashes(host, host_len, NULL, 0 TSRMLS_CC); - + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", quoted_host, errstr == NULL ? "Unknown error" : errstr); efree(quoted_host); } @@ -145,7 +145,7 @@ PHP_FUNCTION(stream_socket_client) if (hashkey) { efree(hashkey); } - + if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); @@ -160,13 +160,13 @@ PHP_FUNCTION(stream_socket_client) } RETURN_FALSE; } - + if (errstr) { efree(errstr); } - + php_stream_to_zval(stream, return_value); - + } /* }}} */ @@ -184,13 +184,13 @@ PHP_FUNCTION(stream_socket_server) php_stream_context *context = NULL; RETVAL_FALSE; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } - + context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); - + if (context) { zend_list_addref(context->rsrc_id); } @@ -207,11 +207,11 @@ PHP_FUNCTION(stream_socket_server) stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS, STREAM_XPORT_SERVER | flags, NULL, NULL, context, &errstr, &err); - + if (stream == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : errstr); } - + if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); @@ -226,11 +226,11 @@ PHP_FUNCTION(stream_socket_server) } RETURN_FALSE; } - + if (errstr) { efree(errstr); } - + php_stream_to_zval(stream, return_value); } /* }}} */ @@ -249,13 +249,13 @@ PHP_FUNCTION(stream_socket_accept) zval *zstream; char *errstr = NULL; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|dz", &zstream, &timeout, &zpeername) == FAILURE) { RETURN_FALSE; } - + php_stream_from_zval(stream, &zstream); - + /* prepare the timeout value for use */ conv = (php_timeout_ull) (timeout * 1000000.0); tv.tv_sec = conv / 1000000; @@ -272,7 +272,7 @@ PHP_FUNCTION(stream_socket_accept) NULL, NULL, &tv, &errstr TSRMLS_CC) && clistream) { - + if (peername) { ZVAL_STRINGL(zpeername, peername, peername_len, 0); } @@ -297,11 +297,11 @@ PHP_FUNCTION(stream_socket_get_name) zend_bool want_peer; char *name = NULL; int name_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) { RETURN_FALSE; } - + php_stream_from_zval(stream, &zstream); if (0 != php_stream_xport_get_name(stream, want_peer, @@ -327,7 +327,7 @@ PHP_FUNCTION(stream_socket_sendto) int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } @@ -357,11 +357,11 @@ PHP_FUNCTION(stream_socket_recvfrom) char *read_buf; long flags = 0; int recvd; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz", &zstream, &to_read, &flags, &zremote) == FAILURE) { RETURN_FALSE; } - + php_stream_from_zval(stream, &zstream); if (zremote) { @@ -373,9 +373,9 @@ PHP_FUNCTION(stream_socket_recvfrom) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } - + read_buf = safe_emalloc(1, to_read, 1); - + recvd = php_stream_xport_recvfrom(stream, read_buf, to_read, flags, NULL, NULL, zremote ? &remote_addr : NULL, zremote ? &remote_addr_len : NULL @@ -423,7 +423,7 @@ PHP_FUNCTION(stream_get_contents) } len = php_stream_copy_to_mem(stream, &contents, maxlen, 0); - + if (contents) { if (len && PG(magic_quotes_runtime)) { contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */ @@ -481,7 +481,7 @@ PHP_FUNCTION(stream_get_meta_data) php_stream_from_zval(stream, &arg1); array_init(return_value); - + if (stream->wrapperdata) { MAKE_STD_ZVAL(newval); MAKE_COPY_ZVAL(&stream->wrapperdata, newval); @@ -494,14 +494,14 @@ PHP_FUNCTION(stream_get_meta_data) add_assoc_string(return_value, "stream_type", (char *)stream->ops->label, 1); add_assoc_string(return_value, "mode", stream->mode, 1); - + #if 0 /* TODO: needs updating for new filter API */ if (stream->filterhead) { php_stream_filter *filter; - + MAKE_STD_ZVAL(newval); array_init(newval); - + for (filter = stream->filterhead; filter != NULL; filter = filter->next) { add_next_index_string(newval, (char *)filter->fops->label, 1); } @@ -509,7 +509,7 @@ PHP_FUNCTION(stream_get_meta_data) add_assoc_zval(return_value, "filters", newval); } #endif - + add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); @@ -610,7 +610,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t * is not displayed. * */ if (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); if (this_fd > *max_fd) { @@ -635,7 +635,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) } ALLOC_HASHTABLE(new_hash); zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); - + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array)); zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { @@ -644,7 +644,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) if (stream == NULL) { continue; } - /* get the fd + /* get the fd * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag * when casting. It is only used here so that the buffered data warning * is not displayed. @@ -667,7 +667,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) zend_hash_internal_pointer_reset(new_hash); Z_ARRVAL_P(stream_array) = new_hash; - + return ret; } @@ -683,7 +683,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC) } ALLOC_HASHTABLE(new_hash); zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); - + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array)); zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(stream_array))) { @@ -719,7 +719,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC) zend_hash_destroy(new_hash); FREE_HASHTABLE(new_hash); } - + return ret; } /* }}} */ @@ -750,7 +750,7 @@ PHP_FUNCTION(stream_select) max_set_count = set_count; sets += set_count; } - + if (w_array != NULL) { set_count = stream_array_to_fd_set(w_array, &wfds, &max_fd TSRMLS_CC); if (set_count > max_set_count) @@ -787,7 +787,7 @@ PHP_FUNCTION(stream_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { tv.tv_sec = Z_LVAL_PP(sec) + (usec / 1000000); - tv.tv_usec = usec % 1000000; + tv.tv_usec = usec % 1000000; } else { tv.tv_sec = Z_LVAL_PP(sec); tv.tv_usec = usec; @@ -812,7 +812,7 @@ PHP_FUNCTION(stream_select) RETURN_LONG(retval); } } - + retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p); if (retval == -1) { @@ -839,14 +839,14 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco zval *ps[6]; zval **ptps[6]; int i; - + for (i = 0; i < 6; i++) { INIT_ZVAL(zvs[i]); ps[i] = &zvs[i]; ptps[i] = &ps[i]; MAKE_STD_ZVAL(ps[i]); } - + ZVAL_LONG(ps[0], notifycode); ZVAL_LONG(ps[1], severity); if (xmsg) { @@ -885,7 +885,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM int wkey_len, okey_len; int ret = SUCCESS; ulong num_key; - + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos); while (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(options), (void**)&wval, &pos)) { if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &wkey_len, &num_key, 0, &pos) @@ -915,7 +915,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS zval **tmp; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) { - + if (context->notifier) { php_stream_notification_free(context->notifier); context->notifier = NULL; @@ -934,7 +934,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); } } - + return ret; } @@ -1082,7 +1082,7 @@ PHP_FUNCTION(stream_context_get_default) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", ¶ms) == FAILURE) { RETURN_FALSE; } - + if (FG(default_context) == NULL) { FG(default_context) = php_stream_context_alloc(); } @@ -1091,7 +1091,7 @@ PHP_FUNCTION(stream_context_get_default) if (params) { parse_context_options(context, params TSRMLS_CC); } - + php_stream_context_to_zval(context, return_value); } /* }}} */ @@ -1128,9 +1128,9 @@ PHP_FUNCTION(stream_context_create) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &options, ¶ms) == FAILURE) { RETURN_FALSE; } - + context = php_stream_context_alloc(); - + if (options) { parse_context_options(context, options TSRMLS_CC); } @@ -1138,7 +1138,7 @@ PHP_FUNCTION(stream_context_create) if (params) { parse_context_params(context, params TSRMLS_CC); } - + RETURN_RESOURCE(context->rsrc_id); } /* }}} */ @@ -1166,7 +1166,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) /* Chain not specified. * Examine stream->mode to determine which filters are needed * There's no harm in attaching a filter to an unused chain, - * but why waste the memory and clock cycles? + * but why waste the memory and clock cycles? */ if (strchr(stream->mode, 'r') || strchr(stream->mode, '+')) { read_write |= PHP_STREAM_FILTER_READ; @@ -1182,7 +1182,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (append) { + if (append) { ret = php_stream_filter_append_ex(&stream->readfilters, filter TSRMLS_CC); } else { ret = php_stream_filter_prepend_ex(&stream->readfilters, filter TSRMLS_CC); @@ -1199,7 +1199,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (append) { + if (append) { ret = php_stream_filter_append_ex(&stream->writefilters, filter TSRMLS_CC); } else { ret = php_stream_filter_prepend_ex(&stream->writefilters, filter TSRMLS_CC); @@ -1277,7 +1277,7 @@ PHP_FUNCTION(stream_get_line) char *buf; size_t buf_size; php_stream *stream; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1372,18 +1372,10 @@ PHP_FUNCTION(stream_set_write_buffer) size_t buff; php_stream *stream; - switch (ZEND_NUM_ARGS()) { - case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { - RETURN_FALSE; - } - break; - default: - WRONG_PARAM_COUNT; - /* NOTREACHED */ - break; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + RETURN_FALSE; } - + php_stream_from_zval(stream, &arg1); buff = arg2; @@ -1399,6 +1391,35 @@ PHP_FUNCTION(stream_set_write_buffer) } /* }}} */ +/* {{{ proto int stream_set_read_buffer(resource fp, int buffer) + Set file read buffer */ +PHP_FUNCTION(stream_set_read_buffer) +{ + zval *arg1; + int ret; + long arg2; + size_t buff; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, &arg1); + + buff = arg2; + + /* if buff is 0 then set to non-buffered */ + if (buff == 0) { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_NONE, NULL); + } else { + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); + } + + RETURN_LONG(ret == 0 ? 0 : EOF); +} +/* }}} */ + /* {{{ proto int stream_socket_enable_crypto(resource stream, bool enable [, int cryptokind [, resource sessionstream]]) Enable or disable a specific kind of crypto on the stream */ PHP_FUNCTION(stream_socket_enable_crypto) @@ -1408,18 +1429,18 @@ PHP_FUNCTION(stream_socket_enable_crypto) php_stream *stream, *sessstream = NULL; zend_bool enable; int ret; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|lr", &zstream, &enable, &cryptokind, &zsessstream) == FAILURE) { RETURN_FALSE; } - + php_stream_from_zval(stream, &zstream); if (ZEND_NUM_ARGS() >= 3) { if (zsessstream) { php_stream_from_zval(sessstream, &zsessstream); } - + if (php_stream_xport_crypto_setup(stream, cryptokind, sessstream TSRMLS_CC) < 0) { RETURN_FALSE; } @@ -1435,7 +1456,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) case 0: RETURN_LONG(0); - + default: RETURN_TRUE; } @@ -1446,7 +1467,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) { - char *filename, *resolved_path; + char *filename, *resolved_path; int filename_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { @@ -1482,7 +1503,7 @@ PHP_FUNCTION(stream_is_local) wrapper = stream->wrapper; } else { convert_to_string_ex(zstream); - + wrapper = php_stream_locate_url_wrapper(Z_STRVAL_PP(zstream), NULL, 0 TSRMLS_CC); } @@ -1526,11 +1547,11 @@ PHP_FUNCTION(stream_socket_shutdown) long how; zval *zstream; php_stream *stream; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) { RETURN_FALSE; } - + if (how != STREAM_SHUT_RD && how != STREAM_SHUT_WR && how != STREAM_SHUT_RDWR) { diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h index e4e20e123..912efb33b 100644 --- a/ext/standard/streamsfuncs.h +++ b/ext/standard/streamsfuncs.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.h 293995 2010-01-25 15:57:24Z johannes $ */ +/* $Id: streamsfuncs.h 297895 2010-04-12 13:10:05Z pajoye $ */ /* Flags for stream_socket_client */ #define PHP_STREAM_CLIENT_PERSISTENT 1 @@ -36,6 +36,7 @@ PHP_FUNCTION(stream_get_contents); PHP_FUNCTION(stream_set_blocking); PHP_FUNCTION(stream_select); PHP_FUNCTION(stream_set_timeout); +PHP_FUNCTION(stream_set_read_buffer); PHP_FUNCTION(stream_set_write_buffer); PHP_FUNCTION(stream_get_transports); PHP_FUNCTION(stream_get_wrappers); diff --git a/ext/standard/string.c b/ext/standard/string.c index 2ebd18a04..3187310e6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c 294517 2010-02-04 09:44:16Z pajoye $ */ +/* $Id: string.c 300105 2010-06-02 19:26:10Z rasmus $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -36,8 +36,19 @@ #ifdef HAVE_MONETARY_H # include <monetary.h> #endif +/* + * This define is here because some versions of libintl redefine setlocale + * to point to libintl_setlocale. That's a ridiculous thing to do as far + * as I am concerned, but with this define and the subsequent undef we + * limit the damage to just the actual setlocale() call in this file + * without turning zif_setlocale into zif_libintl_setlocale. -Rasmus + */ +#define php_my_setlocale setlocale #ifdef HAVE_LIBINTL # include <libintl.h> /* For LC_MESSAGES */ + #ifdef setlocale + # undef setlocale + #endif #endif #include "scanf.h" @@ -2219,12 +2230,21 @@ PHP_FUNCTION(substr_replace) } if (Z_TYPE_PP(str) != IS_ARRAY) { + if (Z_ISREF_PP(str)) { + SEPARATE_ZVAL(str); + } convert_to_string_ex(str); } if (Z_TYPE_PP(repl) != IS_ARRAY) { + if (Z_ISREF_PP(repl)) { + SEPARATE_ZVAL(repl); + } convert_to_string_ex(repl); } if (Z_TYPE_PP(from) != IS_ARRAY) { + if (Z_ISREF_PP(from)) { + SEPARATE_ZVAL(from); + } convert_to_long_ex(from); } @@ -4083,7 +4103,7 @@ PHP_FUNCTION(setlocale) } } - retval = setlocale(cat, loc); + retval = php_my_setlocale(cat, loc); zend_update_current_locale(); if (retval) { /* Remember if locale was changed */ @@ -4137,11 +4157,14 @@ PHP_FUNCTION(parse_str) Z_ARRVAL(tmp) = EG(active_symbol_table); sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC); } else { + zval ret; + + array_init(&ret); + sapi_module.treat_data(PARSE_STRING, res, &ret TSRMLS_CC); /* Clear out the array that was passed in. */ zval_dtor(arrayArg); - array_init(arrayArg); - - sapi_module.treat_data(PARSE_STRING, res, arrayArg TSRMLS_CC); + arrayArg->type = ret.type; + arrayArg->value = ret.value; } } /* }}} */ diff --git a/ext/standard/tests/array/array_map_variation2.phpt b/ext/standard/tests/array/array_map_variation2.phpt index e9608438f..16561abff 100644 --- a/ext/standard/tests/array/array_map_variation2.phpt +++ b/ext/standard/tests/array/array_map_variation2.phpt @@ -47,16 +47,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } array(4) { @@ -94,16 +85,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } } @@ -127,16 +109,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } array(4) { @@ -166,16 +139,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } } @@ -195,16 +159,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } array(4) { @@ -240,16 +195,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } [1]=> &array(4) { @@ -260,16 +206,7 @@ array(4) { [0]=> &string(2) "v1" [1]=> - &array(4) { - ["k1"]=> - &string(2) "v1" - ["k2"]=> - string(2) "v2" - [0]=> - &string(2) "v1" - [1]=> - *RECURSION* - } + *RECURSION* } } } diff --git a/ext/standard/tests/array/array_push_variation4.phpt b/ext/standard/tests/array/array_push_variation4.phpt index ed339204f..f8f89042a 100644 --- a/ext/standard/tests/array/array_push_variation4.phpt +++ b/ext/standard/tests/array/array_push_variation4.phpt @@ -104,28 +104,7 @@ array(10) { [8]=> &string(1) "z" [9]=> - &array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - &string(1) "a" - [4]=> - &string(1) "b" - [5]=> - &string(1) "c" - [6]=> - &string(1) "x" - [7]=> - &string(1) "y" - [8]=> - &string(1) "z" - [9]=> - *RECURSION* - } + *RECURSION* } } Done diff --git a/ext/standard/tests/array/array_values_variation4.phpt b/ext/standard/tests/array/array_values_variation4.phpt index 25980663e..9c35331fd 100644 --- a/ext/standard/tests/array/array_values_variation4.phpt +++ b/ext/standard/tests/array/array_values_variation4.phpt @@ -93,23 +93,7 @@ array(4) { int(3) } [0]=> - &array(4) { - ["zero"]=> - string(4) "zero" - ["un"]=> - string(3) "one" - ["sub"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - *RECURSION* - } + *RECURSION* } } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/bug51552.phpt b/ext/standard/tests/array/bug51552.phpt new file mode 100644 index 000000000..fb61f489b --- /dev/null +++ b/ext/standard/tests/array/bug51552.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues) +--FILE-- +<?php +function walk($element, $key, $p) { + $backtrace = debug_backtrace(); + echo "$element\n"; +} + +$a = array(1,2,3,4,5,6,7,8,9,10); +array_walk($a, 'walk', 'testthis'); +?> +--EXPECT-- +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/ext/standard/tests/array/current_variation5.phpt b/ext/standard/tests/array/current_variation5.phpt new file mode 100644 index 000000000..b9bf4a995 --- /dev/null +++ b/ext/standard/tests/array/current_variation5.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test current() function : usage variations - reference +--FILE-- +<?php +/* Prototype : mixed current(array $array_arg) + * Description: Return the element currently pointed to by the internal array pointer + * Source code: ext/standard/array.c + * Alias to functions: pos + */ + +echo "*** Testing current() : usage variations ***\n"; + +echo "\n-- Function: reference parameter --\n"; + +function current_variation5_ref(&$a) +{ + var_dump(current($a)); + var_dump(next($a)); +} + +$a = array('yes', 'maybe', 'no'); + +var_dump(current($a)); +var_dump(next($a)); +current_variation5($a); + +echo "\n-- Function: normal parameter --\n"; + +function current_variation5($a) +{ + var_dump(current($a)); + var_dump(next($a)); +} + +$a = array('yes', 'maybe', 'no'); + +var_dump(current($a)); +var_dump(next($a)); +current_variation5($a); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +*** Testing current() : usage variations *** + +-- Function: reference parameter -- +string(3) "yes" +string(5) "maybe" +string(5) "maybe" +string(2) "no" + +-- Function: normal parameter -- +string(3) "yes" +string(5) "maybe" +string(5) "maybe" +string(2) "no" +===DONE=== diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt index c038f7d1c..91be7e262 100644 --- a/ext/standard/tests/array/natcasesort_variation7.phpt +++ b/ext/standard/tests/array/natcasesort_variation7.phpt @@ -44,18 +44,7 @@ array(5) { [3]=> string(1) "2" [4]=> - &array(5) { - [0]=> - int(1) - [1]=> - float(3) - [2]=> - string(4) "zero" - [3]=> - string(1) "2" - [4]=> - *RECURSION* - } + *RECURSION* } } bool(true) @@ -75,22 +64,11 @@ array(5) { [1]=> float(3) [4]=> - &array(5) { - [0]=> - int(1) - [3]=> - string(1) "2" - [1]=> - float(3) - [4]=> - *RECURSION* - [2]=> - string(4) "zero" - } + *RECURSION* [2]=> string(4) "zero" } [2]=> string(4) "zero" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt index e8ffd5752..0accb2c85 100644 --- a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt @@ -35,13 +35,25 @@ Class [ <internal%s> class Directory ] { } - Methods [3] { - Method [ <internal%s> public method close ] { + Method [ <internal:standard> public method close ] { + + - Parameters [1] { + Parameter #0 [ <optional> $dir_handle ] + } } - Method [ <internal%s> public method rewind ] { + Method [ <internal:standard> public method rewind ] { + + - Parameters [1] { + Parameter #0 [ <optional> $dir_handle ] + } } - Method [ <internal%s> public method read ] { + Method [ <internal:standard> public method read ] { + + - Parameters [1] { + Parameter #0 [ <optional> $dir_handle ] + } } } } @@ -50,4 +62,4 @@ object(Directory)#%d (0) { } Warning: Directory::read(): Unable to find my handle property in %s on line 15 -bool(false)
\ No newline at end of file +bool(false) diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt new file mode 100644 index 000000000..520a46412 --- /dev/null +++ b/ext/standard/tests/file/bug39863.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #39863 (file_exists() silently truncates after a null byte) +--CREDITS-- +Andrew van der Stock, vanderaj @ owasp.org +--FILE-- +<?php + +$filename = __FILE__ . chr(0). ".ridiculous"; + +if (file_exists($filename)) { + echo "FAIL\n"; +} +else { + echo "PASS\n"; +} +?> +===DONE=== +<?php exit(0); ?> +--XFAIL-- +Needs bug #39863 fixed +--EXPECT-- +PASS +===DONE=== + diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt index 567f0e2c7..a476063d6 100644 --- a/ext/standard/tests/file/realpath_cache.phpt +++ b/ext/standard/tests/file/realpath_cache.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(4) { ["key"]=> - int(%d) + int(%i) ["is_dir"]=> bool(true) ["realpath"]=> diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt index 8895202d0..6312d03c0 100644 --- a/ext/standard/tests/general_functions/bug49847.phpt +++ b/ext/standard/tests/general_functions/bug49847.phpt @@ -23,3 +23,4 @@ array(1) { [0]=> string(4098) "%s 1" } + diff --git a/ext/standard/tests/general_functions/bug52138.data b/ext/standard/tests/general_functions/bug52138.data new file mode 100644 index 000000000..4ce82e097 --- /dev/null +++ b/ext/standard/tests/general_functions/bug52138.data @@ -0,0 +1,11 @@ +[MYCONST] +MYCONST = MYCONST + +[M_PI] +FOO=M_PI " test" + +[foo::bar] +A=1 +B=A "A" A + +[MYCONST M_PI] diff --git a/ext/standard/tests/general_functions/bug52138.phpt b/ext/standard/tests/general_functions/bug52138.phpt new file mode 100644 index 000000000..d4f38735a --- /dev/null +++ b/ext/standard/tests/general_functions/bug52138.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #52138 (Constants are parsed into the ini file for section names) +--FILE-- +<?php + +define('MYCONST', 1); +define('A', 'B'); + +$ini_file = dirname(__FILE__)."/bug52138.data"; + +$ret = parse_ini_file($ini_file, true); +var_dump($ret); + +?> +--EXPECTF-- +array(4) { + ["MYCONST"]=> + array(1) { + ["MYCONST"]=> + string(1) "1" + } + ["M_PI"]=> + array(1) { + ["FOO"]=> + string(%d) "3.%d test" + } + ["foo::bar"]=> + array(2) { + ["A"]=> + string(1) "1" + ["B"]=> + string(3) "BAB" + } + ["MYCONST M_PI"]=> + array(0) { + } +} diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt index 164e71afd..adaa7afb4 100755 --- a/ext/standard/tests/general_functions/getservbyname_basic.phpt +++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -Test function getservbyport() by calling it more than or less than its expected arguments +Test function getservbyname() --CREDITS-- Italian PHP TestFest 2009 Cesena 19-20-21 june Fabio Fabbrucci (fabbrucci@grupporetina.com) diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index 1a525c53b..09e9f3b99 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -573,7 +573,7 @@ array(2) { *** Testing var_dump() on object variables *** -- Iteration 1 -- -object(object_class)#%d (7) { +object(object_class)#6 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -590,14 +590,14 @@ object(object_class)#%d (7) { int(11) } -- Iteration 2 -- -object(no_member_class)#%d (0) { +object(no_member_class)#7 (0) { } -- Iteration 3 -- -object(contains_object_class)#%d (7) { +object(contains_object_class)#8 (7) { ["p"]=> int(30) ["class_object1"]=> - object(object_class)#%d (7) { + object(object_class)#9 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -614,7 +614,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object2"]=> - object(object_class)#%d (7) { + object(object_class)#10 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -631,7 +631,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { + object(object_class)#9 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -648,7 +648,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object4":protected]=> - object(object_class)#%d (7) { + object(object_class)#10 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -665,93 +665,17 @@ object(contains_object_class)#%d (7) { int(11) } ["no_member_class_object"]=> - object(no_member_class)#%d (0) { + object(no_member_class)#11 (0) { } ["class_object5"]=> - object(contains_object_class)#%d (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#%d (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 4 -- -object(contains_object_class)#%d (7) { +object(contains_object_class)#1 (7) { ["p"]=> int(30) ["class_object1"]=> - object(object_class)#%d (7) { + object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -768,7 +692,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object2"]=> - object(object_class)#%d (7) { + object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -785,7 +709,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { + object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -802,7 +726,7 @@ object(contains_object_class)#%d (7) { int(11) } ["class_object4":protected]=> - object(object_class)#%d (7) { + object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -819,89 +743,13 @@ object(contains_object_class)#%d (7) { int(11) } ["no_member_class_object"]=> - object(no_member_class)#%d (0) { + object(no_member_class)#4 (0) { } ["class_object5"]=> - object(contains_object_class)#%d (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#%d (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 5 -- -object(object_class)#%d (7) { +object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -918,7 +766,7 @@ object(object_class)#%d (7) { int(11) } -- Iteration 6 -- -object(object_class)#%d (7) { +object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -935,10 +783,10 @@ object(object_class)#%d (7) { int(11) } -- Iteration 7 -- -object(no_member_class)#%d (0) { +object(no_member_class)#4 (0) { } -- Iteration 8 -- -object(object_class)#%d (7) { +object(object_class)#5 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -958,7 +806,7 @@ object(object_class)#%d (7) { NULL ** Testing var_dump() on objects having circular reference ** -object(object_class)#%d (8) { +object(object_class)#13 (8) { ["value"]=> int(50) ["public_var1"]=> @@ -974,7 +822,7 @@ object(object_class)#%d (8) { ["public_var2"]=> int(11) ["obj"]=> - &object(object_class)#%d (8) { + &object(object_class)#12 (8) { ["value"]=> int(50) ["public_var1"]=> @@ -990,49 +838,15 @@ object(object_class)#%d (8) { ["public_var2"]=> int(11) ["obj"]=> - &object(object_class)#%d (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - &object(object_class)#%d (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - *RECURSION* - } - } + *RECURSION* } } *** Testing var_dump() on resources *** -- Iteration 1 -- -resource(%d) of type (stream) +resource(5) of type (stream) -- Iteration 2 -- -resource(%d) of type (stream) +resource(6) of type (stream) *** Testing var_dump() on different combinations of scalar and non-scalar variables *** @@ -1066,7 +880,7 @@ array(4) { -- Iteration 3 -- array(4) { [0]=> - object(no_member_class)#%d (0) { + object(no_member_class)#14 (0) { } [1]=> array(0) { @@ -1413,13 +1227,13 @@ array(4) { } array(2) { [0]=> - resource(%d) of type (stream) + resource(5) of type (stream) [1]=> - resource(%d) of type (stream) + resource(6) of type (stream) } array(9) { [0]=> - object(object_class)#%d (7) { + object(object_class)#6 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1436,14 +1250,14 @@ array(9) { int(11) } [1]=> - object(no_member_class)#%d (0) { + object(no_member_class)#7 (0) { } [2]=> - object(contains_object_class)#%d (7) { + object(contains_object_class)#8 (7) { ["p"]=> int(30) ["class_object1"]=> - object(object_class)#%d (7) { + object(object_class)#9 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1460,7 +1274,7 @@ array(9) { int(11) } ["class_object2"]=> - object(object_class)#%d (7) { + object(object_class)#10 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1477,7 +1291,7 @@ array(9) { int(11) } ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { + object(object_class)#9 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1494,7 +1308,7 @@ array(9) { int(11) } ["class_object4":protected]=> - object(object_class)#%d (7) { + object(object_class)#10 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1511,93 +1325,17 @@ array(9) { int(11) } ["no_member_class_object"]=> - object(no_member_class)#%d (0) { + object(no_member_class)#11 (0) { } ["class_object5"]=> - object(contains_object_class)#%d (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#%d (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } [3]=> - object(contains_object_class)#%d (7) { + object(contains_object_class)#1 (7) { ["p"]=> int(30) ["class_object1"]=> - object(object_class)#%d (7) { + object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1614,7 +1352,7 @@ array(9) { int(11) } ["class_object2"]=> - object(object_class)#%d (7) { + object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1631,7 +1369,7 @@ array(9) { int(11) } ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { + object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1648,7 +1386,7 @@ array(9) { int(11) } ["class_object4":protected]=> - object(object_class)#%d (7) { + object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1665,89 +1403,13 @@ array(9) { int(11) } ["no_member_class_object"]=> - object(no_member_class)#%d (0) { + object(no_member_class)#4 (0) { } ["class_object5"]=> - object(contains_object_class)#%d (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#%d (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#%d (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } [4]=> - object(object_class)#%d (7) { + object(object_class)#2 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1764,7 +1426,7 @@ array(9) { int(11) } [5]=> - object(object_class)#%d (7) { + object(object_class)#3 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1781,10 +1443,10 @@ array(9) { int(11) } [6]=> - object(no_member_class)#%d (0) { + object(no_member_class)#4 (0) { } [7]=> - object(object_class)#%d (7) { + object(object_class)#5 (7) { ["value"]=> int(50) ["public_var1"]=> @@ -1844,7 +1506,7 @@ array(6) { [2]=> array(4) { [0]=> - object(no_member_class)#%d (0) { + object(no_member_class)#14 (0) { } [1]=> array(0) { @@ -1907,5 +1569,6 @@ string(9) " *** Testing error conditions *** -Warning: var_dump() expects at least %d parameter, %d given in %s on line %d +Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done + diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index 3772536cf..a81980c02 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -462,8 +462,7 @@ string(34) "abcd -- Iteration 14 -- string(22) "1234 5678 - 9100 -abcda" + 9100
abcda" *** Testing var_dump() on boolean variables *** -- Iteration 1 -- @@ -669,83 +668,7 @@ object(contains_object_class)#8 (7) { object(no_member_class)#11 (0) { } ["class_object5"]=> - object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 4 -- object(contains_object_class)#1 (7) { @@ -823,83 +746,7 @@ object(contains_object_class)#1 (7) { object(no_member_class)#4 (0) { } ["class_object5"]=> - object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 5 -- object(object_class)#2 (7) { @@ -991,41 +838,7 @@ object(object_class)#13 (8) { ["public_var2"]=> int(11) ["obj"]=> - &object(object_class)#13 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - &object(object_class)#12 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - *RECURSION* - } - } + *RECURSION* } } @@ -1303,8 +1116,7 @@ array(14) { [13]=> string(22) "1234 5678 - 9100 -abcda" + 9100
abcda" } array(15) { [0]=> @@ -1516,83 +1328,7 @@ array(9) { object(no_member_class)#11 (0) { } ["class_object5"]=> - object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } [3]=> object(contains_object_class)#1 (7) { @@ -1670,83 +1406,7 @@ array(9) { object(no_member_class)#4 (0) { } ["class_object5"]=> - object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } [4]=> object(object_class)#2 (7) { @@ -1911,3 +1571,4 @@ string(9) " Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done + diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt index 93d0dc164..2b306696a 100644 --- a/ext/standard/tests/general_functions/var_export_error2.phpt +++ b/ext/standard/tests/general_functions/var_export_error2.phpt @@ -14,12 +14,5 @@ var_export($obj, true); ?> ===DONE=== --EXPECTF-- -stdClass::__set_state(array( - 'p' => - stdClass::__set_state(array( - 'p' => - stdClass::__set_state(array( - 'p' => - stdClass::__set_state(array( Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt index 4ad512168..03ed496ac 100644 --- a/ext/standard/tests/general_functions/var_export_error3.phpt +++ b/ext/standard/tests/general_functions/var_export_error3.phpt @@ -14,14 +14,5 @@ var_export($a, true); ?> ===DONE=== --EXPECTF-- -array ( - 0 => - array ( - 0 => - array ( - 0 => - array ( - 0 => - array ( Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
\ No newline at end of file diff --git a/ext/standard/tests/mail/bug51604.phpt b/ext/standard/tests/mail/bug51604.phpt new file mode 100644 index 000000000..a65702102 --- /dev/null +++ b/ext/standard/tests/mail/bug51604.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #51604 (newline in end of header is shown in start of message) +--INI-- +sendmail_path=tee mail_bug51604.out >/dev/null +mail.add_x_header = Off +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) == "WIN") + die("skip Won't run on Windows"); +?> +--FILE-- +<?php +// Initialise all required variables +$to = 'user@company.com'; +$subject = 'Test Subject'; +$message = 'A Message'; +$additional_headers = "KHeaders\n\n\n\n\n"; +$outFile = "mail_bug51604.out"; +@unlink($outFile); + +// Calling mail() with all additional headers +var_dump( mail($to, $subject, $message, $additional_headers) ); +echo file_get_contents($outFile); +unlink($outFile); + +?> +===DONE=== +--EXPECT-- +bool(true) +To: user@company.com +Subject: Test Subject +KHeaders + +A Message +===DONE=== diff --git a/ext/standard/tests/misc/time_sleep_until_basic.phpt b/ext/standard/tests/misc/time_sleep_until_basic.phpt index 7f2f32d24..956985a62 100644 --- a/ext/standard/tests/misc/time_sleep_until_basic.phpt +++ b/ext/standard/tests/misc/time_sleep_until_basic.phpt @@ -1,5 +1,7 @@ --TEST-- time_sleep_until() function - basic test for time_sleep_until() +--SKIPIF-- +<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?> --CREDITS-- Manuel Baldassarri mb@ideato.it Michele Orselli mo@ideato.it diff --git a/ext/standard/tests/misc/time_sleep_until_error1.phpt b/ext/standard/tests/misc/time_sleep_until_error1.phpt index 9752fd70e..2a409a38b 100644 --- a/ext/standard/tests/misc/time_sleep_until_error1.phpt +++ b/ext/standard/tests/misc/time_sleep_until_error1.phpt @@ -1,5 +1,7 @@ --TEST-- time_sleep_until() function - error test for time_sleep_until() +--SKIPIF-- +<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?> --CREDITS-- Fabio Fabbrucci fabbrucci@grupporetina.com Danilo Sanchi sanchi@grupporetina.com diff --git a/ext/standard/tests/misc/time_sleep_until_error2.phpt b/ext/standard/tests/misc/time_sleep_until_error2.phpt index d20c8ab65..bbfef1b76 100644 --- a/ext/standard/tests/misc/time_sleep_until_error2.phpt +++ b/ext/standard/tests/misc/time_sleep_until_error2.phpt @@ -1,9 +1,7 @@ --TEST-- time_sleep_until() function - error test for time_sleep_until() --SKIPIF-- -<?php - function_exists('time_sleep_until') or die('skip time_sleep_until() is not supported in this build.'); -?> +<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?> --CREDITS-- Filippo De Santis fd@ideato.it #PHPTestFest Cesena Italia on 2009-06-20 diff --git a/ext/standard/tests/misc/time_sleep_until_error3.phpt b/ext/standard/tests/misc/time_sleep_until_error3.phpt index 64489618a..f18e5b302 100644 --- a/ext/standard/tests/misc/time_sleep_until_error3.phpt +++ b/ext/standard/tests/misc/time_sleep_until_error3.phpt @@ -1,5 +1,7 @@ --TEST-- time_sleep_until() function - error test for time_sleep_until() +--SKIPIF-- +<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?> --CREDITS-- Francesco Fullone ff@ideato.it #PHPTestFest Cesena Italia on 2009-06-20 diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt index 5dc3560d0..b6753f0d6 100644 --- a/ext/standard/tests/network/getmxrr.phpt +++ b/ext/standard/tests/network/getmxrr.phpt @@ -8,7 +8,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { ?> --FILE-- <?php -$domains = array( 'php.net', 'ez.no' ); +$domains = array( 'php.net', 'lists.php.net' ); foreach ( $domains as $domain ) { if ( getmxrr( $domain, $hosts, $weights ) ) diff --git a/ext/standard/tests/serialize/bug28325.phpt b/ext/standard/tests/serialize/bug28325.phpt index 7f2bd6637..ee0e60e1a 100644 --- a/ext/standard/tests/serialize/bug28325.phpt +++ b/ext/standard/tests/serialize/bug28325.phpt @@ -24,16 +24,7 @@ object(a)#%d (1) { ["c"]=> object(c)#%d (1) { ["d"]=> - object(a)#%d (1) { - ["b"]=> - object(b)#%d (1) { - ["c"]=> - object(c)#%d (1) { - ["d"]=> - *RECURSION* - } - } - } + *RECURSION* } } } diff --git a/ext/standard/tests/serialize/serialization_arrays_001.phpt b/ext/standard/tests/serialize/serialization_arrays_001.phpt index f62f69855..ff5f34c5b 100644 --- a/ext/standard/tests/serialize/serialization_arrays_001.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_001.phpt @@ -34,7 +34,6 @@ var_dump($arr_asso); echo "\nDone"; ?> --EXPECTF-- - --- Testing Circular reference of an array --- -- Normal array -- string(238) "a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;R:8;}}" @@ -68,23 +67,7 @@ array(7) { array(0) { } [6]=> - &array(7) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(-2) - [3]=> - float(3.333333) - [4]=> - string(1) "a" - [5]=> - array(0) { - } - [6]=> - *RECURSION* - } + *RECURSION* } } @@ -103,4 +86,4 @@ array(2) { &string(4) "test" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt index 942afdfb9..55d849c97 100644 --- a/ext/standard/tests/serialize/serialization_arrays_004.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt @@ -52,21 +52,12 @@ check($a); echo "Done"; ?> --EXPECTF-- - - --- 1 refs container: array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - int(1) - [2]=> - int(1) - } + *RECURSION* [1]=> int(1) [2]=> @@ -82,14 +73,7 @@ array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - int(1) - [2]=> - int(1) - } + *RECURSION* [1]=> int(1) [2]=> @@ -102,7 +86,7 @@ array(3) { } array(3) { [0]=> - %string(10) "b0.changed" + string(10) "b0.changed" [1]=> int(1) [2]=> @@ -110,7 +94,7 @@ array(3) { } array(3) { [0]=> - %string(10) "b0.changed" + string(10) "b0.changed" [1]=> string(10) "b1.changed" [2]=> @@ -118,7 +102,7 @@ array(3) { } array(3) { [0]=> - %string(10) "b0.changed" + string(10) "b0.changed" [1]=> string(10) "b1.changed" [2]=> @@ -131,46 +115,18 @@ array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [2]=> int(1) } [1]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [2]=> int(1) } @@ -182,46 +138,18 @@ array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [2]=> int(1) } [1]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - int(1) - } + *RECURSION* [2]=> int(1) } @@ -259,92 +187,29 @@ array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } [1]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } [2]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } } string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}" @@ -352,92 +217,29 @@ array(3) { [0]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } [1]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } [2]=> &array(3) { [0]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [1]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* [2]=> - &array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } + *RECURSION* } } array(3) { @@ -464,4 +266,4 @@ array(3) { [2]=> &string(10) "b2.changed" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt index dd3e436ed..10e33129f 100644 --- a/ext/standard/tests/serialize/serialization_arrays_005.phpt +++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt @@ -79,8 +79,6 @@ check($c); ?> --EXPECTF-- - - --- Nested array references 1 element in containing array: array(3) { [0]=> @@ -443,19 +441,7 @@ array(3) { [1]=> int(1) [2]=> - &array(2) { - [0]=> - int(1) - [1]=> - &array(3) { - [0]=> - int(1) - [1]=> - int(1) - [2]=> - *RECURSION* - } - } + *RECURSION* } } } @@ -476,19 +462,7 @@ array(3) { [1]=> int(1) [2]=> - &array(2) { - [0]=> - int(1) - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(1) - [2]=> - *RECURSION* - } - } + *RECURSION* } } } @@ -508,19 +482,7 @@ array(3) { [1]=> int(1) [2]=> - &array(2) { - [0]=> - int(1) - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(1) - [2]=> - *RECURSION* - } - } + *RECURSION* } } } @@ -540,19 +502,7 @@ array(3) { [1]=> int(1) [2]=> - &array(2) { - [0]=> - string(12) "b2.0.changed" - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(1) - [2]=> - *RECURSION* - } - } + *RECURSION* } } } diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt index 02e8279c4..2265caba9 100644 --- a/ext/standard/tests/serialize/serialization_objects_015.phpt +++ b/ext/standard/tests/serialize/serialization_objects_015.phpt @@ -74,14 +74,7 @@ echo "Done"; --- a refs container: object(stdClass)#%d (3) { ["a"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - int(1) - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> int(1) ["c"]=> @@ -90,14 +83,7 @@ object(stdClass)#%d (3) { string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";i:1;s:1:"c";i:1;}" object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - int(1) - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> int(1) ["c"]=> @@ -132,14 +118,7 @@ object(stdClass)#%d (3) { --- a eqs container: object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - int(1) - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> int(1) ["c"]=> @@ -148,14 +127,7 @@ object(stdClass)#%d (3) { string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";i:1;s:1:"c";i:1;}" object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - int(1) - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> int(1) ["c"]=> @@ -190,46 +162,18 @@ object(stdClass)#%d (3) { --- a,b ref container: object(stdClass)#%d (3) { ["a"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["c"]=> int(1) } string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";i:1;}" object(stdClass)#%d (3) { ["a"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["c"]=> int(1) } @@ -262,46 +206,18 @@ object(stdClass)#%d (3) { --- a,b eq container: object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["c"]=> int(1) } string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";i:1;}" object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["c"]=> int(1) } @@ -309,14 +225,7 @@ object(stdClass)#%d (3) { ["a"]=> string(14) "obj->a.changed" ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - string(14) "obj->a.changed" - ["b"]=> - *RECURSION* - ["c"]=> - int(1) - } + *RECURSION* ["c"]=> int(1) } @@ -341,62 +250,20 @@ object(stdClass)#%d (3) { --- a,b,c ref container: object(stdClass)#%d (3) { ["a"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["b"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["c"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* } string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";R:1;}" object(stdClass)#%d (3) { ["a"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["b"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["c"]=> - &object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* } object(stdClass)#%d (3) { ["a"]=> @@ -427,84 +294,28 @@ object(stdClass)#%d (3) { --- a,b,c eq container: object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["c"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* } string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";r:1;}" object(stdClass)#%d (3) { ["a"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["c"]=> - object(stdClass)#%d (3) { - ["a"]=> - *RECURSION* - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* } object(stdClass)#%d (3) { ["a"]=> string(14) "obj->a.changed" ["b"]=> - object(stdClass)#%d (3) { - ["a"]=> - string(14) "obj->a.changed" - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* ["c"]=> - object(stdClass)#%d (3) { - ["a"]=> - string(14) "obj->a.changed" - ["b"]=> - *RECURSION* - ["c"]=> - *RECURSION* - } + *RECURSION* } object(stdClass)#%d (3) { ["a"]=> @@ -512,14 +323,7 @@ object(stdClass)#%d (3) { ["b"]=> string(14) "obj->b.changed" ["c"]=> - object(stdClass)#%d (3) { - ["a"]=> - string(14) "obj->a.changed" - ["b"]=> - string(14) "obj->b.changed" - ["c"]=> - *RECURSION* - } + *RECURSION* } object(stdClass)#%d (3) { ["a"]=> @@ -529,4 +333,4 @@ object(stdClass)#%d (3) { ["c"]=> string(14) "obj->c.changed" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/strings/bug47842.phpt b/ext/standard/tests/strings/bug47842.phpt new file mode 100644 index 000000000..4ac9da6d8 --- /dev/null +++ b/ext/standard/tests/strings/bug47842.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #47842 sscanf() does not support 64-bit values +--SKIPIF-- +<?php +if (PHP_INT_MAX < pow(2,31)) die("skip PHP_INT_MAX < 32b\n"); +?> +--FILE-- +<?php +echo "-Test\n"; + +sscanf("2147483647", '%d', $int); +echo "sscanf 32-bit signed int '2147483647' (2^31)-1 = ",$int,"\n"; +sscanf("4294967295", '%u', $int); +echo "sscanf 32-bit unsign int '4294967295' (2^32)-1 = ",$int,"\n"; + +sscanf("9223372036854775807", '%d', $int); +echo "sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = ",$int,"\n"; +sscanf("18446744073709551615", '%u', $int); +echo "sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = ",$int,"\n"; + +printf("printf 64-bit signed int '9223372036854775807' (2^63)-1 = %d\n", 9223372036854775807); +printf("printf 64-bit signed int '18446744073709551615' (2^64)-1 = %u\n", 18446744073709551615); + +echo "Done\n"; +?> +--EXPECTF-- +%aTest +sscanf 32-bit signed int '2147483647' (2^31)-1 = 2147483647 +sscanf 32-bit unsign int '4294967295' (2^32)-1 = 4294967295 +sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807 +sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615 +printf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807 +printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0 +Done diff --git a/ext/standard/tests/strings/bug51059.phpt b/ext/standard/tests/strings/bug51059.phpt index f2cbe9def..bdc56f176 100644 --- a/ext/standard/tests/strings/bug51059.phpt +++ b/ext/standard/tests/strings/bug51059.phpt @@ -2,8 +2,8 @@ Bug #51059 crypt() segfaults on certain salts --FILE-- <?php -$res = crypt('a', '_'); -if ($res == '*0' || $res == '*1') echo 'OK'; +$res = crypt(b'a', b'_'); +if ($res === b'*0' || $res === b'*1') echo 'OK'; else echo 'Not OK'; ?> diff --git a/ext/standard/tests/strings/bug51899.phpt b/ext/standard/tests/strings/bug51899.phpt new file mode 100644 index 000000000..fb430cf30 --- /dev/null +++ b/ext/standard/tests/strings/bug51899.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline) +--FILE-- +<?php + +var_dump(parse_ini_string('a=')); +var_dump(parse_ini_string('a= ')); +var_dump(parse_ini_string('a='.PHP_EOL)); +var_dump(parse_ini_string('a=b ')); +var_dump(parse_ini_string('')); +var_dump(parse_ini_string(NULL)); +var_dump(parse_ini_string("\0")); + +?> +--EXPECT-- +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(2) "b " +} +array(0) { +} +array(0) { +} +array(0) { +} diff --git a/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt b/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt deleted file mode 100644 index 6d40b0770..000000000 --- a/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test Blowfish crypt() with invalid rounds ---FILE-- -<?php - -foreach(range(32, 38) as $i) { - if (crypt('U*U', '$2a$'.$i.'$CCCCCCCCCCCCCCCCCCCCCC$') === FALSE) { - echo "$i. OK\n"; - } else { - echo "$i. Not OK\n"; - } -} - -?> ---EXPECT-- -32. OK -33. OK -34. OK -35. OK -36. OK -37. OK -38. OK diff --git a/ext/standard/tests/strings/crypt_blowfish_variation1.phpt b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt new file mode 100644 index 000000000..1592cfe87 --- /dev/null +++ b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test Blowfish crypt() with invalid rounds +--SKIPIF-- +<?php +if (!function_exists('crypt') || !defined("CRYPT_BLOWFISH")) { + die("SKIP crypt()-blowfish is not available"); +} +?> +--FILE-- +<?php + +$salts = array(b'32' => b'$2a$32$CCCCCCCCCCCCCCCCCCCCCC$', + b'33' => b'$2a$33$CCCCCCCCCCCCCCCCCCCCCC$', + b'34' => b'$2a$34$CCCCCCCCCCCCCCCCCCCCCC$', + b'35' => b'$2a$35$CCCCCCCCCCCCCCCCCCCCCC$', + b'36' => b'$2a$36$CCCCCCCCCCCCCCCCCCCCCC$', + b'37' => b'$2a$37$CCCCCCCCCCCCCCCCCCCCCC$', + b'38' => b'$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',); + +foreach($salts as $i=>$salt) { + $crypt = crypt(b'U*U', $salt); + if ($crypt === b'*0' || $crypt === b'*1') { + echo "$i. OK\n"; + } else { + echo "$i. Not OK\n"; + } +} + +?> +--EXPECT-- +32. OK +33. OK +34. OK +35. OK +36. OK +37. OK +38. OK diff --git a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt new file mode 100644 index 000000000..21bedc10c --- /dev/null +++ b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test Blowfish crypt() falls back to DES when rounds are not specified, +or Blowfish is not available. +--FILE-- +<?php +$crypt = crypt(b'U*U', b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW'); +if ($crypt===b'$2SHYF.wPGyfE') { + echo "OK\n"; +} else { + echo "Not OK\n"; +} +?> +--EXPECT-- +OK diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex d11f697e5..f498a95f7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex f7036a812..2890c02cc 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt index 3d50689a4..7b9d51399 100644 --- a/ext/standard/tests/url/parse_url_basic_001.phpt +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -845,55 +845,29 @@ echo "Done"; string(1) "/" } ---> http:///blah.com: -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com: bool(false) ---> http://:80: -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) +--> http://:80: bool(false) ---> http://user@:80: -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) +--> http://user@:80: bool(false) ---> http://user:pass@:80: -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) +--> http://user:pass@:80: bool(false) ---> http://:: -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) +--> http://:: bool(false) ---> http://@/: -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) +--> http://@/: bool(false) ---> http://@:/: -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) +--> http://@:/: bool(false) ---> http://:/: -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) +--> http://:/: bool(false) ---> http://?: -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) +--> http://?: bool(false) ---> http://?:: -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) +--> http://?:: bool(false) ---> http://:?: -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) +--> http://:?: bool(false) ---> http://blah.com:123456: -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) +--> http://blah.com:123456: bool(false) ---> http://blah.com:abcdef: -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http://blah.com:abcdef: bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt index e25ab8dcd..f3ac770f0 100644 --- a/ext/standard/tests/url/parse_url_basic_002.phpt +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -109,43 +109,17 @@ echo "Done"; --> http://[x:80]/ : string(4) "http" --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt index e34dc2d19..dbd92088a 100644 --- a/ext/standard/tests/url/parse_url_basic_003.phpt +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : string(6) "[x:80]" --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt index af3279547..387907f0e 100644 --- a/ext/standard/tests/url/parse_url_basic_004.phpt +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : NULL --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt index 5eb2541c1..d44dcfef3 100644 --- a/ext/standard/tests/url/parse_url_basic_005.phpt +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : NULL --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt index 926200a1a..bd6d03efd 100644 --- a/ext/standard/tests/url/parse_url_basic_006.phpt +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : NULL --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt index d99ccb667..aa9f88ba5 100644 --- a/ext/standard/tests/url/parse_url_basic_007.phpt +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : string(1) "/" --> : string(0) "" --> / : string(1) "/" ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt index d2d2ebb59..7b166127f 100644 --- a/ext/standard/tests/url/parse_url_basic_008.phpt +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : NULL --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt index b23a30edf..a814546c5 100644 --- a/ext/standard/tests/url/parse_url_basic_009.phpt +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -108,43 +108,17 @@ echo "Done"; --> http://[x:80]/ : NULL --> : NULL --> / : NULL ---> http:///blah.com : -Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 -bool(false) ---> http://:80 : -Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user@:80 : -Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://user:pass@:80 : -Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 -bool(false) ---> http://: : -Warning: parse_url(http://:): Unable to parse URL in %s on line 15 -bool(false) ---> http://@/ : -Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 -bool(false) ---> http://@:/ : -Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://:/ : -Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 -bool(false) ---> http://? : -Warning: parse_url(http://?): Unable to parse URL in %s on line 15 -bool(false) ---> http://?: : -Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 -bool(false) ---> http://:? : -Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:123456 : -Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 -bool(false) ---> http://blah.com:abcdef : -Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 -bool(false) +--> http:///blah.com : bool(false) +--> http://:80 : bool(false) +--> http://user@:80 : bool(false) +--> http://user:pass@:80 : bool(false) +--> http://: : bool(false) +--> http://@/ : bool(false) +--> http://@:/ : bool(false) +--> http://:/ : bool(false) +--> http://? : bool(false) +--> http://?: : bool(false) +--> http://:? : bool(false) +--> http://blah.com:123456 : bool(false) +--> http://blah.com:abcdef : bool(false) Done
\ No newline at end of file diff --git a/ext/standard/url.c b/ext/standard/url.c index eebcdd05f..dc94655dc 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -15,7 +15,7 @@ | Author: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: url.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: url.c 300501 2010-06-16 18:56:24Z pajoye $ */ #include <stdlib.h> #include <string.h> @@ -355,7 +355,7 @@ PHP_FUNCTION(parse_url) resource = php_url_parse_ex(str, str_len); if (resource == NULL) { - php_error_docref1(NULL TSRMLS_CC, str, E_WARNING, "Unable to parse URL"); + /* @todo Find a method to determine why php_url_parse_ex() failed */ RETURN_FALSE; } diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index e6a357a47..7c2731dd3 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.c 286380 2009-07-26 23:22:27Z jani $ */ +/* $Id: url_scanner_ex.c 296107 2010-03-12 10:28:59Z jani $ */ #include "php.h" diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig index 35fa61e1a..57f273deb 100644 --- a/ext/standard/url_scanner_ex.c.orig +++ b/ext/standard/url_scanner_ex.c.orig @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.c 286380 2009-07-26 23:22:27Z jani $ */ +/* $Id: url_scanner_ex.c 296107 2010-03-12 10:28:59Z jani $ */ #include "php.h" diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 91ba878aa..7609bd59a 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.re 286379 2009-07-26 23:20:34Z jani $ */ +/* $Id: url_scanner_ex.re 296107 2010-03-12 10:28:59Z jani $ */ #include "php.h" diff --git a/ext/standard/var.c b/ext/standard/var.c index 6d2614f4c..90e9250f7 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: var.c 301144 2010-07-09 21:19:27Z scottmac $ */ /* {{{ includes */ @@ -116,8 +116,9 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); - if (myht->nApplyCount > 1) { + if (++myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); + --myht->nApplyCount; return; } php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht)); @@ -126,8 +127,9 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ goto head_done; case IS_OBJECT: myht = Z_OBJDEBUG_PP(struc, is_temp); - if (myht && myht->nApplyCount > 1) { + if (myht && ++myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); + --myht->nApplyCount; return; } @@ -138,6 +140,7 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ head_done: if (myht) { zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_element_dump_func, 1, level); + --myht->nApplyCount; if (is_temp) { zend_hash_destroy(myht); efree(myht); @@ -331,27 +334,47 @@ PHP_FUNCTION(debug_zval_dump) } /* }}} */ +#define buffer_append_spaces(buf, num_spaces) \ + do { \ + char *tmp_spaces; \ + int tmp_spaces_len; \ + tmp_spaces_len = spprintf(&tmp_spaces, 0,"%*c", num_spaces, ' '); \ + smart_str_appendl(buf, tmp_spaces, tmp_spaces_len); \ + efree(tmp_spaces); \ + } while(0); + static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { int level; + smart_str *buf; level = va_arg(args, int); + buf = va_arg(args, smart_str *); if (hash_key->nKeyLength == 0) { /* numeric key */ - php_printf("%*c%ld => ", level + 1, ' ', hash_key->h); + buffer_append_spaces(buf, level+1); + smart_str_append_long(buf, hash_key->h); + smart_str_appendl(buf, " => ", 4); } else { /* string key */ char *key, *tmp_str; int key_len, tmp_len; key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); - php_printf("%*c'", level + 1, ' '); - PHPWRITE(tmp_str, tmp_len); - php_printf("' => "); + + buffer_append_spaces(buf, level + 1); + + smart_str_appendc(buf, '\''); + smart_str_appendl(buf, tmp_str, tmp_len); + smart_str_appendl(buf, "' => ", 5); + efree(key); efree(tmp_str); } - php_var_export(zv, level + 2 TSRMLS_CC); - PUTS (",\n"); + php_var_export_ex(zv, level + 2, buf TSRMLS_CC); + + smart_str_appendc(buf, ','); + smart_str_appendc(buf, '\n'); + return 0; } /* }}} */ @@ -359,24 +382,33 @@ static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list a static int php_object_element_export(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { int level; + smart_str *buf; char *prop_name, *class_name; level = va_arg(args, int); + buf = va_arg(args, smart_str *); - php_printf("%*c", level + 1, ' '); + buffer_append_spaces(buf, level + 2); if (hash_key->nKeyLength != 0) { zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); - php_printf(" '%s' => ", prop_name); + + smart_str_appendc(buf, '\''); + smart_str_appends(buf, prop_name); + smart_str_appendc(buf, '\''); } else { - php_printf(" %ld => ", hash_key->h); + smart_str_append_long(buf, hash_key->h); } - php_var_export(zv, level + 2 TSRMLS_CC); - PUTS (",\n"); + + smart_str_appendl(buf, " => ", 4); + php_var_export_ex(zv, level + 2, buf TSRMLS_CC); + smart_str_appendc(buf, ','); + smart_str_appendc(buf, '\n'); + return 0; } /* }}} */ -PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) /* {{{ */ +PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) /* {{{ */ { HashTable *myht; char *tmp_str, *tmp_str2; @@ -386,82 +418,109 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) /* {{{ */ switch (Z_TYPE_PP(struc)) { case IS_BOOL: - php_printf("%s", Z_LVAL_PP(struc) ? "true" : "false"); + if (Z_LVAL_PP(struc)) { + smart_str_appendl(buf, "true", 4); + } else { + smart_str_appendl(buf, "false", 5); + } break; case IS_NULL: - php_printf("NULL"); + smart_str_appendl(buf, "NULL", 4); break; case IS_LONG: - php_printf("%ld", Z_LVAL_PP(struc)); + smart_str_append_long(buf, Z_LVAL_PP(struc)); break; case IS_DOUBLE: - php_printf("%.*H", (int) EG(precision), Z_DVAL_PP(struc)); + tmp_len = spprintf(&tmp_str, 0,"%.*H", (int) EG(precision), Z_DVAL_PP(struc)); + smart_str_appendl(buf, tmp_str, tmp_len); + efree(tmp_str); break; case IS_STRING: tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL); - PUTS ("'"); - PHPWRITE(tmp_str2, tmp_len2); - PUTS ("'"); + + smart_str_appendc(buf, '\''); + smart_str_appendl(buf, tmp_str2, tmp_len2); + smart_str_appendc(buf, '\''); + efree(tmp_str2); efree(tmp_str); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); if (level > 1) { - php_printf("\n%*c", level - 1, ' '); + smart_str_appendc(buf, '\n'); + buffer_append_spaces(buf, level - 1); } - PUTS ("array (\n"); - zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_array_element_export, 1, level, 0); + smart_str_appendl(buf, "array (\n", 8); + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_array_element_export, 2, level, buf); + if (level > 1) { - php_printf("%*c", level - 1, ' '); + buffer_append_spaces(buf, level - 1); } - PUTS(")"); + smart_str_appendc(buf, ')'); + break; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); if (level > 1) { - php_printf("\n%*c", level - 1, ' '); + smart_str_appendc(buf, '\n'); + buffer_append_spaces(buf, level - 1); } Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); - php_printf ("%s::__set_state(array(\n", class_name); + + smart_str_appendl(buf, class_name, class_name_len); + smart_str_appendl(buf, "::__set_state(array(\n", 21); + efree(class_name); if (myht) { - zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_object_element_export, 1, level); + zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_object_element_export, 2, level, buf); } if (level > 1) { - php_printf("%*c", level - 1, ' '); + buffer_append_spaces(buf, level - 1); } - php_printf ("))"); + smart_str_appendl(buf, "))", 2); + break; default: - PUTS ("NULL"); + smart_str_appendl(buf, "NULL", 4); break; } } /* }}} */ +/* FOR BC reasons, this will always perform and then print */ +PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) /* {{{ */ +{ + smart_str buf = {0}; + php_var_export_ex(struc, level, &buf TSRMLS_CC); + smart_str_0 (&buf); + PHPWRITE(buf.c, buf.len); + smart_str_free(&buf); +} +/* }}} */ + /* {{{ proto mixed var_export(mixed var [, bool return]) Outputs or returns a string representation of a variable */ PHP_FUNCTION(var_export) { zval *var; zend_bool return_output = 0; + smart_str buf = {0}; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &return_output) == FAILURE) { return; } - if (return_output) { - php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); - } - - php_var_export(&var, 1 TSRMLS_CC); + php_var_export_ex(&var, 1, &buf TSRMLS_CC); + smart_str_0 (&buf); if (return_output) { - php_ob_get_buffer (return_value TSRMLS_CC); - php_end_ob_buffer (0, 0 TSRMLS_CC); + RETVAL_STRINGL(buf.c, buf.len, 1); + } else { + PHPWRITE(buf.c, buf.len); } + smart_str_free(&buf); } /* }}} */ @@ -529,7 +588,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, name_len); + smart_str_append_long(buf, (long)name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -636,12 +695,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var if (var_hash && php_add_var_hash(var_hash, struc, (void *) &var_already TSRMLS_CC) == FAILURE) { if (Z_ISREF_P(struc)) { smart_str_appendl(buf, "R:", 2); - smart_str_append_long(buf, *var_already); + smart_str_append_long(buf, (long)*var_already); smart_str_appendc(buf, ';'); return; } else if (Z_TYPE_P(struc) == IS_OBJECT) { smart_str_appendl(buf, "r:", 2); - smart_str_append_long(buf, *var_already); + smart_str_append_long(buf, (long)*var_already); smart_str_appendc(buf, ';'); return; } @@ -695,12 +754,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, Z_OBJCE_P(struc)->name_length); + smart_str_append_long(buf, (long)Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, serialized_length); + smart_str_append_long(buf, (long)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 82c16222a..8c0d86715 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Nov 23 09:26:17 2009 */ +/* Generated by re2c 0.13.5 on Fri Jun 25 15:36:31 2010 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: var_unserializer.c 300843 2010-06-29 00:58:31Z stas $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -55,7 +55,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) var_hash->data[var_hash->used_slots++] = *rval; } -static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) { var_entries *var_hash = var_hashx->first_dtor, *prev = NULL; diff --git a/ext/standard/var_unserializer.c.orig b/ext/standard/var_unserializer.c.orig index 578f593ef..ad474c0dd 100644 --- a/ext/standard/var_unserializer.c.orig +++ b/ext/standard/var_unserializer.c.orig @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Nov 23 09:26:17 2009 */ +/* Generated by re2c 0.13.5 on Fri Jun 25 15:36:31 2010 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: var_unserializer.c 300843 2010-06-29 00:58:31Z stas $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -56,7 +56,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) var_hash->data[var_hash->used_slots++] = *rval; } -static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) { var_entries *var_hash = var_hashx->first_dtor, *prev = NULL; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 6cd6628aa..3312bee51 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.re 293035 2010-01-03 08:22:14Z sebastian $ */ +/* $Id: var_unserializer.re 300843 2010-06-29 00:58:31Z stas $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -54,7 +54,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) var_hash->data[var_hash->used_slots++] = *rval; } -static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) +PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) { var_entries *var_hash = var_hashx->first_dtor, *prev = NULL; |
