Merge branch 'master' of https://github.com/php/php-src into temporary_cleaning

This commit is contained in:
Bob Weinand 2015-07-06 14:54:15 +02:00
commit 521ad9df98
32 changed files with 156 additions and 115 deletions

1
NEWS
View file

@ -9,6 +9,7 @@ PHP NEWS
. Fixed bug #69955 (Segfault when trying to combine [] and assign-op on
ArrayAccess object). (Laruence)
. Fixed bug #69957 (Different ways of handling div/mod/intdiv). (Bob)
. Fixed bug #69900 (Too long timeout on pipes). (Anatol)
- CLI server:
. Fixed bug #69655 (php -S changes MKCALENDAR request method to MKCOL). (cmb)

View file

@ -61,16 +61,21 @@ try {
?>
--EXPECTF--
Warning: Division by zero in %sbug69957.php on line %d
float(INF)
Variable mod
Type: DivisionByZeroError
Message: Modulo by zero
Warning: Division by zero in %sbug69957.php on line %d
float(INF)
Literal mod
Type: DivisionByZeroError
Message: Modulo by zero
Warning: Division by zero in %sbug69957.php on line %d
float(INF)
Double mod

View file

@ -340,7 +340,7 @@ static ZEND_NORETURN void zend_mm_panic(const char *message)
{
fprintf(stderr, "%s\n", message);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)

View file

@ -591,7 +591,7 @@ static void zend_ast_export_qstr(smart_str *str, char quote, zend_string *s)
case '\v':
smart_str_appends(str, "\\v");
break;
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
case VK_ESCAPE:
#else
case '\e':

View file

@ -1754,7 +1754,7 @@ ZEND_API size_t zend_dirname(char *path, size_t len)
register char *end = path + len - 1;
unsigned int len_adjust = 0;
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
/* Note that on Win32 CWD is per drive (heritage from CP/M).
* This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
*/
@ -5079,7 +5079,8 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
name = zend_new_interned_string(name);
lcname = zend_new_interned_string(lcname);
} else {
lcname = name = zend_generate_anon_class_name(decl->lex_pos);
name = zend_generate_anon_class_name(decl->lex_pos);
lcname = zend_string_copy(name); /* this normally is an interned string, except with opcache. We need a proper copy here or opcache will fail with use after free. */
}
ce->type = ZEND_USER_CLASS;
@ -5641,9 +5642,11 @@ static inline zend_bool zend_try_ct_eval_binary_op(zval *result, uint32_t opcode
binary_op_type fn = get_binary_op(opcode);
/* don't evaluate division by zero at compile-time */
if (opcode == ZEND_MOD && zval_get_long(op2) == 0) {
if ((opcode == ZEND_DIV || opcode == ZEND_MOD) &&
zval_get_long(op2) == 0) {
return 0;
} else if ((opcode == ZEND_SL || opcode == ZEND_SR) && zval_get_long(op2) < 0) {
} else if ((opcode == ZEND_SL || opcode == ZEND_SR) &&
zval_get_long(op2) < 0) {
return 0;
}

View file

@ -1955,7 +1955,7 @@ static int zend_check_symbol(zval *pz)
if (Z_TYPE_P(pz) > 10) {
fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
@ -2359,8 +2359,6 @@ static zend_always_inline zend_generator *zend_get_running_generator(zend_execut
static zend_always_inline void i_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num) /* {{{ */
{
int i;
if (EX(func)->op_array.T_liveliness && op_num < EX(func)->op_array.last) {
uint32_t *off = EX(func)->op_array.T_liveliness + EX(func)->op_array.T_liveliness[op_num];
uint32_t *until = EX(func)->op_array.T_liveliness + EX(func)->op_array.T_liveliness[op_num + 1];

View file

@ -355,6 +355,13 @@ void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t
(slot)[1] = (ptr); \
} while (0)
#define SKIP_EXT_OPLINE(opline) do { \
while (UNEXPECTED((opline)->opcode >= ZEND_EXT_STMT \
&& (opline)->opcode <= ZEND_TICKS)) { \
(opline)--; \
} \
} while (0)
END_EXTERN_C()
#endif /* ZEND_EXECUTE_H */

View file

@ -72,7 +72,7 @@ static void zend_handle_sigsegv(int dummy) /* {{{ */
zend_get_executed_filename(),
zend_get_executed_lineno());
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
}

View file

@ -35,12 +35,10 @@ int zend_load_extension(const char *path)
if (!handle) {
#ifndef ZEND_WIN32
fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
fflush(stderr);
#endif
#else
fprintf(stderr, "Failed loading %s\n", path);
/* See http://support.microsoft.com/kb/190351 */
fflush(stderr);
#endif
return FAILURE;
}
@ -56,7 +54,7 @@ int zend_load_extension(const char *path)
if (!extension_version_info || !new_extension) {
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
DL_UNLOAD(handle);
@ -73,7 +71,7 @@ int zend_load_extension(const char *path)
extension_version_info->zend_extension_api_no,
ZEND_EXTENSION_API_NO);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
DL_UNLOAD(handle);
@ -89,7 +87,7 @@ int zend_load_extension(const char *path)
new_extension->URL,
new_extension->name);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
DL_UNLOAD(handle);
@ -100,7 +98,7 @@ int zend_load_extension(const char *path)
fprintf(stderr, "Cannot load %s - it was built with configuration %s, whereas running engine is %s\n",
new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
DL_UNLOAD(handle);
@ -108,7 +106,7 @@ int zend_load_extension(const char *path)
} else if (zend_get_extension(new_extension->name)) {
fprintf(stderr, "Cannot load %s - it was already loaded\n", new_extension->name);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
DL_UNLOAD(handle);
@ -119,7 +117,7 @@ int zend_load_extension(const char *path)
#else
fprintf(stderr, "Extensions are not supported on this platform.\n");
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
fflush(stderr);
#endif
return FAILURE;

View file

@ -29,7 +29,7 @@
#include "zend_ini_scanner.h"
#include "zend_extensions.h"
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
#include "win32/syslog.h"
#endif
@ -179,7 +179,7 @@ static void ini_error(const char *msg)
}
if (CG(ini_parser_unbuffered_errors)) {
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
syslog(LOG_ALERT, "PHP: %s (%s)", error_buf, GetCommandLine());
#endif
fprintf(stderr, "PHP: %s", error_buf);

View file

@ -35,7 +35,7 @@
#include <errno.h>
#include "zend.h"
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
# include <Winuser.h>
#endif
#include "zend_alloc.h"
@ -929,7 +929,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
Z_STRLEN_P(zendlval)--;
break;
case 'e':
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
*t++ = VK_ESCAPE;
#else
*t++ = '\e';

View file

@ -33,7 +33,7 @@
#include <errno.h>
#include "zend.h"
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
# include <Winuser.h>
#endif
#include "zend_alloc.h"
@ -927,7 +927,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
Z_STRLEN_P(zendlval)--;
break;
case 'e':
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
*t++ = VK_ESCAPE;
#else
*t++ = '\e';

View file

@ -61,7 +61,7 @@ typedef int32_t zend_off_t;
# define ZEND_ULONG_FMT "%" PRIu64
# define ZEND_LONG_FMT_SPEC PRId64
# define ZEND_ULONG_FMT_SPEC PRIu64
# ifdef PHP_WIN32
# ifdef ZEND_WIN32
# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10)
# define ZEND_ATOL(i, s) i = _atoi64((s))
# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base))
@ -89,7 +89,7 @@ typedef int32_t zend_off_t;
# define ZEND_ULONG_FMT "%" PRIu32
# define ZEND_LONG_FMT_SPEC PRId32
# define ZEND_ULONG_FMT_SPEC PRIu32
# ifdef PHP_WIN32
# ifdef ZEND_WIN32
# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10)
# define ZEND_ATOL(i, s) i = atol((s))
# else

View file

@ -1111,24 +1111,40 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
case TYPE_PAIR(IS_LONG, IS_LONG):
/* prevent crashes (arithmetic exception) */
if (UNEXPECTED(Z_LVAL_P(op2) == 0 || (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN) || Z_LVAL_P(op1) % Z_LVAL_P(op2) != 0)) {
ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2));
if (Z_LVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1) / (double) Z_LVAL_P(op2)));
return SUCCESS;
} else {
} else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN) {
/* Prevent overflow error/crash */
ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1);
return SUCCESS;
}
if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */
ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
} else {
ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2));
}
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_LONG):
if (Z_LVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
}
ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2));
return SUCCESS;
case TYPE_PAIR(IS_LONG, IS_DOUBLE):
if (Z_DVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
}
ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
if (Z_DVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
}
ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2));
return SUCCESS;

View file

@ -34,7 +34,7 @@
#include "zend_virtual_cwd.h"
#include "tsrm_strtok_r.h"
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
#include <io.h>
#include "tsrm_win32.h"
# ifndef IO_REPARSE_TAG_SYMLINK
@ -67,7 +67,7 @@
#include "TSRM.h"
/* Only need mutex for popen() in Windows and NetWare because it doesn't chdir() on UNIX */
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
#if (defined(ZEND_WIN32) || defined(NETWARE)) && defined(ZTS)
MUTEX_T cwd_mutex;
#endif
@ -79,13 +79,13 @@ virtual_cwd_globals cwd_globals;
cwd_state main_cwd_state; /* True global */
#ifndef TSRM_WIN32
#ifndef ZEND_WIN32
#include <unistd.h>
#else
#include <direct.h>
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
#include <tchar.h>
#define tsrm_strtok_r(a,b,c) _tcstok((a),(b))
#define TOKENIZER_STRING "/\\"
@ -143,7 +143,7 @@ static int php_check_dots(const char *element, int n)
#define CWD_STATE_FREE(s) \
efree((s)->cwd);
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
# define CWD_STATE_FREE_ERR(state) do { \
DWORD last_error = GetLastError(); \
CWD_STATE_FREE(state); \
@ -153,7 +153,7 @@ static int php_check_dots(const char *element, int n)
# define CWD_STATE_FREE_ERR(state) CWD_STATE_FREE(state)
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
#ifdef CTL_CODE
#undef CTL_CODE
@ -466,7 +466,7 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
}
main_cwd_state.cwd_length = (int)strlen(cwd);
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') {
cwd[0] = toupper(cwd[0]);
}
@ -479,7 +479,7 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
cwd_globals_ctor(&cwd_globals);
#endif
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
#if (defined(ZEND_WIN32) || defined(NETWARE)) && defined(ZTS)
cwd_mutex = tsrm_mutex_alloc();
#endif
}
@ -490,7 +490,7 @@ CWD_API void virtual_cwd_shutdown(void) /* {{{ */
#ifndef ZTS
cwd_globals_dtor(&cwd_globals);
#endif
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
#if (defined(ZEND_WIN32) || defined(NETWARE)) && defined(ZTS)
tsrm_mutex_free(cwd_mutex);
#endif
@ -536,7 +536,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length) /* {{{ */
return retval;
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
/* If we have something like C: */
if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
char *retval;
@ -588,7 +588,7 @@ CWD_API char *virtual_getcwd(char *buf, size_t size) /* {{{ */
}
/* }}} */
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {{{ */
{
register zend_ulong h;
@ -622,7 +622,7 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {
return h;
}
/* }}} */
#endif /* defined(PHP_WIN32) */
#endif /* defined(ZEND_WIN32) */
CWD_API void realpath_cache_clean(void) /* {{{ */
{
@ -643,11 +643,7 @@ CWD_API void realpath_cache_clean(void) /* {{{ */
CWD_API void realpath_cache_del(const char *path, int path_len) /* {{{ */
{
#ifdef PHP_WIN32
zend_ulong key = realpath_cache_key(path, path_len);
#else
zend_ulong key = realpath_cache_key(path, path_len);
#endif
zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
@ -692,11 +688,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
return;
}
#ifdef PHP_WIN32
bucket->key = realpath_cache_key(path, path_len);
#else
bucket->key = realpath_cache_key(path, path_len);
#endif
bucket->path = (char*)bucket + sizeof(realpath_cache_bucket);
memcpy(bucket->path, path, path_len+1);
bucket->path_len = path_len;
@ -708,7 +700,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
}
bucket->realpath_len = realpath_len;
bucket->is_dir = is_dir;
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
bucket->is_rvalid = 0;
bucket->is_readable = 0;
bucket->is_wvalid = 0;
@ -725,12 +717,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t) /* {{{ */
{
#ifdef PHP_WIN32
zend_ulong key = realpath_cache_key(path, path_len);
#else
zend_ulong key = realpath_cache_key(path, path_len);
#endif
zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
@ -786,7 +773,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
{
int i, j, save;
int directory = 0;
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
WIN32_FIND_DATA data;
HANDLE hFind;
ALLOCA_FLAG(use_heap_large)
@ -881,7 +868,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
}
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (save && (hFind = FindFirstFile(path, &data)) == INVALID_HANDLE_VALUE) {
if (use_realpath == CWD_REALPATH) {
/* file not found */
@ -1146,7 +1133,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
path[j++] = DEFAULT_SLASH;
}
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (j < 0 || j + len - i >= MAXPATHLEN-1) {
free_alloca(tmp, use_heap);
return -1;
@ -1196,7 +1183,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
void *tmp;
if (path_length == 0 || path_length >= MAXPATHLEN-1) {
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
_set_errno(EINVAL);
#else
errno = EINVAL;
@ -1219,7 +1206,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
} else {
int state_cwd_length = state->cwd_length;
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (IS_SLASH(path[0])) {
if (state->cwd[1] == ':') {
/* Copy only the drive name */
@ -1258,7 +1245,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
}
} else {
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) {
resolved_path[0] = path[0];
resolved_path[1] = ':';
@ -1270,14 +1257,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
memcpy(resolved_path, path, path_length + 1);
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (memchr(resolved_path, '*', path_length) ||
memchr(resolved_path, '?', path_length)) {
return 1;
}
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
if (IS_UNC_PATH(resolved_path, path_length)) {
/* skip UNC name */
resolved_path[0] = DEFAULT_SLASH;
@ -1339,7 +1326,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
resolved_path[path_length] = 0;
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
verify:
#endif
if (verify_path) {
@ -1529,7 +1516,7 @@ CWD_API int virtual_access(const char *pathname, int mode) /* {{{ */
return -1;
}
#if defined(TSRM_WIN32)
#if defined(ZEND_WIN32)
ret = tsrm_win32_access(new_state.cwd, mode);
#else
ret = access(new_state.cwd, mode);
@ -1553,7 +1540,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf) /* {{{ */
return -1;
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
ret = win32_utime(new_state.cwd, buf);
#else
ret = utime(new_state.cwd, buf);
@ -1583,7 +1570,7 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode) /* {{{ */
}
/* }}} */
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#if !defined(ZEND_WIN32) && !defined(NETWARE)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link) /* {{{ */
{
cwd_state new_state;
@ -1680,7 +1667,7 @@ CWD_API int virtual_rename(const char *oldname, const char *newname) /* {{{ */
/* rename on windows will fail if newname already exists.
MoveFileEx has to be used */
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
/* MoveFileEx returns 0 on failure, other way 'round for this function */
retval = (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0) ? -1 : 0;
#else
@ -1759,7 +1746,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode) /* {{{ */
return -1;
}
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
retval = mkdir(new_state.cwd);
#else
retval = mkdir(new_state.cwd, mode);
@ -1787,7 +1774,7 @@ CWD_API int virtual_rmdir(const char *pathname) /* {{{ */
}
/* }}} */
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
DIR *opendir(const char *name);
#endif
@ -1809,7 +1796,7 @@ CWD_API DIR *virtual_opendir(const char *pathname) /* {{{ */
}
/* }}} */
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
CWD_API FILE *virtual_popen(const char *command, const char *type) /* {{{ */
{
return popen_ex(command, type, CWDG(cwd).cwd, NULL);

View file

@ -42,7 +42,7 @@
#define VIRTUAL_DIR
#endif
#ifndef TSRM_WIN32
#ifndef ZEND_WIN32
#include <unistd.h>
#else
#include <direct.h>
@ -52,7 +52,7 @@
#include <errno.h>
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
#include "readdir.h"
#include <sys/utime.h>
/* mode_t isn't defined on Windows */
@ -117,7 +117,7 @@ typedef unsigned short mode_t;
#define CWD_EXPORTS
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
# ifdef CWD_EXPORTS
# define CWD_API __declspec(dllexport)
# else
@ -129,7 +129,7 @@ typedef unsigned short mode_t;
# define CWD_API
#endif
#ifdef TSRM_WIN32
#ifdef ZEND_WIN32
CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat);
# define php_sys_stat(path, buf) php_sys_stat_ex(path, buf, 0)
# define php_sys_lstat(path, buf) php_sys_stat_ex(path, buf, 1)
@ -172,7 +172,7 @@ CWD_API int virtual_rmdir(const char *pathname);
CWD_API DIR *virtual_opendir(const char *pathname);
CWD_API FILE *virtual_popen(const char *command, const char *type);
CWD_API int virtual_access(const char *pathname, int mode);
#if defined(TSRM_WIN32)
#if defined(ZEND_WIN32)
/* these are not defined in win32 headers */
#ifndef W_OK
#define W_OK 0x02
@ -192,7 +192,7 @@ CWD_API int virtual_access(const char *pathname, int mode);
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf);
#endif
CWD_API int virtual_chmod(const char *filename, mode_t mode);
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#if !defined(ZEND_WIN32) && !defined(NETWARE)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link);
#endif
@ -219,7 +219,7 @@ typedef struct _realpath_cache_bucket {
int path_len;
int realpath_len;
int is_dir;
#ifdef PHP_WIN32
#ifdef ZEND_WIN32
unsigned char is_rvalid;
unsigned char is_readable;
unsigned char is_wvalid;
@ -280,7 +280,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#define VCWD_UTIME(path, time) virtual_utime(path, time)
#endif
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#if !defined(ZEND_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1)
@ -296,7 +296,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#define VCWD_CREAT(path, mode) creat(path, mode)
/* rename on windows will fail if newname already exists.
MoveFileEx has to be used */
#if defined(TSRM_WIN32)
#if defined(ZEND_WIN32)
# define VCWD_RENAME(oldname, newname) (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0 ? -1 : 0)
#else
# define VCWD_RENAME(oldname, newname) rename(oldname, newname)
@ -311,7 +311,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#define VCWD_RMDIR(pathname) rmdir(pathname)
#define VCWD_OPENDIR(pathname) opendir(pathname)
#define VCWD_POPEN(command, type) popen(command, type)
#if defined(TSRM_WIN32)
#if defined(ZEND_WIN32)
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode)
#else
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
@ -320,7 +320,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path)
#if HAVE_UTIME
# ifdef TSRM_WIN32
# ifdef ZEND_WIN32
# define VCWD_UTIME(path, time) win32_utime(path, time)
# else
# define VCWD_UTIME(path, time) utime(path, time)
@ -328,7 +328,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
#endif
#define VCWD_CHMOD(path, mode) chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#if !defined(ZEND_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)

View file

@ -7854,9 +7854,10 @@ ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ANY)
if (EG(assertions) <= 0) {
zend_op *target = OP_JMP_ADDR(opline, opline->op2);
if (RETURN_VALUE_USED(target-1)) {
ZVAL_TRUE(EX_VAR((target-1)->result.var));
zend_op *result = target - 1;
SKIP_EXT_OPLINE(result);
if (RETURN_VALUE_USED(result)) {
ZVAL_TRUE(EX_VAR(result->result.var));
}
ZEND_VM_JMP(target);
} else {

View file

@ -1657,9 +1657,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSERT_CHECK_SPEC_HANDLER(ZEND
if (EG(assertions) <= 0) {
zend_op *target = OP_JMP_ADDR(opline, opline->op2);
if (RETURN_VALUE_USED(target-1)) {
ZVAL_TRUE(EX_VAR((target-1)->result.var));
zend_op *result = target - 1;
SKIP_EXT_OPLINE(result);
if (RETURN_VALUE_USED(result)) {
ZVAL_TRUE(EX_VAR(result->result.var));
}
ZEND_VM_JMP(target);
} else {

View file

@ -37,6 +37,6 @@ if test "$PHP_ENCHANT" != "no"; then
[
AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ])
AC_DEFINE(ENCHANT_VERSION_STRING, "1.5.x", [ ])
], [], [ -L$ENCHANT_LIB $ENCHANT_SHARED_LIBADD])
], [], [ -L$ENCHANT_LIBDIR $ENCHANT_SHARED_LIBADD])
fi

View file

@ -2660,6 +2660,7 @@ static zend_string* php_ldap_do_escape(const zend_bool *map, const char *value,
ZSTR_VAL(ret)[p] = '\0';
ZSTR_LEN(ret) = p;
return ret;
}
static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, const int charslen, char escape)

View file

@ -2,13 +2,16 @@ Most tests here relies on the availability of an LDAP server configured with TLS
Client/Server configuration:
===========================================================
OpenLDAP 2.3.43 has been used with the configuration below.
OpenLDAP 2.4.31 has been used with the configuration below.
Notes:
1. A self signed certificate can be generated using:
$ openssl req -newkey rsa:1024 -x509 -nodes -out server.pem -keyout server.pem -days 3650
It is used for testing ldap_start_tls(), which also requires "TLS_REQCERT never" in client configuration
2. An empty LDAP structure is required for the tests to be PASSed
2. An empty LDAP structure is required for the tests to be PASSed (except for base and admin)
If you use a debian based distribution, prefer the use of dpkg-reconfigure.
Otherwise you may alter these configuration files:
(/etc/openldap/)slapd.conf:
-----------------------------------------------------------
@ -40,6 +43,7 @@ Tests configuration:
The following environment variables may be defined:
LDAP_TEST_HOST (default: localhost) Host to connect to
LDAP_TEST_PORT (default: 389) Port to connect to
LDAP_TEST_BASE (default: dc=my-domain,dc=com) Base to use. May be the ldap root or a subtree. (ldap_search_variation6 will fail if a subtree is used)
LDAP_TEST_USER (default: cn=Manager,dc=my-domain,dc=com) DN used for binding
LDAP_TEST_SASL_USER (default: Manager) SASL user used for SASL binding
LDAP_TEST_PASSWD (default: secret) Password used for plain and SASL binding
@ -50,4 +54,4 @@ Credits:
===========================================================
Davide Mendolia <idaf1er@gmail.com>
Patrick Allaert <patrick.allaert@gmail.com>
Côme Bernigaud <mcmic@php.net>

View file

@ -22,6 +22,20 @@ function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version)
}
function insert_dummy_data($link, $base) {
// Create root if not there
$testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
if (ldap_count_entries($link, $testBase) < 1) {
ldap_add(
$link, "$base", array(
"objectClass" => array(
"top",
"organization",
"dcObject"
),
"o" => "php ldap tests"
)
);
}
ldap_add($link, "o=test,$base", array(
"objectClass" => array(
"top",

View file

@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
resource(6) of type (ldap result)
resource(%d) of type (ldap result)
array(2) {
["count"]=>
int(1)

View file

@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
resource(6) of type (ldap result)
resource(%d) of type (ldap result)
array(3) {
["count"]=>
int(2)

View file

@ -194,8 +194,8 @@ ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
/* }}} */
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN( "phar.readonly", "1", PHP_INI_ALL, phar_ini_modify_handler, readonly, zend_phar_globals, phar_globals)
STD_PHP_INI_BOOLEAN( "phar.require_hash", "1", PHP_INI_ALL, phar_ini_modify_handler, require_hash, zend_phar_globals, phar_globals)
STD_PHP_INI_BOOLEAN("phar.readonly", "1", PHP_INI_ALL, phar_ini_modify_handler, readonly, zend_phar_globals, phar_globals)
STD_PHP_INI_BOOLEAN("phar.require_hash", "1", PHP_INI_ALL, phar_ini_modify_handler, require_hash, zend_phar_globals, phar_globals)
STD_PHP_INI_ENTRY("phar.cache_list", "", PHP_INI_SYSTEM, phar_ini_cache_list, cache_list, zend_phar_globals, phar_globals)
PHP_INI_END()

View file

@ -1,5 +1,5 @@
--TEST--
Test money_format() function : error conditions
Test money_format() function : error conditions
--SKIPIF--
<?php
if (!function_exists('money_format')) {
@ -30,9 +30,10 @@ echo "\n-- Testing money_format() function with insufficient arguments --\n";
var_dump( money_format($string) );
echo "\n-- Testing money_format() function with more than expected no. of arguments --\n";
var_dump( money_format($string, $value, $extra_arg) );
echo "\n-- Testing money_format() function with more than one token --\n";
var_dump( money_format($string . $string, $value) );
?>
===DONE===
--EXPECTF--
@ -52,4 +53,9 @@ NULL
Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d
NULL
===DONE===
-- Testing money_format() function with more than one token --
Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d
bool(false)
===DONE===

View file

@ -14,10 +14,6 @@ if (setlocale(LC_MONETARY, 'en_US') === false) {
<?php
setlocale(LC_MONETARY, 'en_US');
var_dump( money_format("X%nY", 3.1415));
var_dump(money_format("AAAAA%n%n%n%n", NULL));
?>
--EXPECTF--
string(7) "X$3.14Y"
Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d
bool(false)

View file

@ -326,7 +326,8 @@ size_t php_http_parser_execute (php_http_parser *parser,
const char *data,
size_t len)
{
char c, ch;
char ch;
signed char c;
const char *p = data, *pe;
size_t to_read;

View file

@ -19,7 +19,7 @@ foreach ($strVals as $strVal) {
echo "--- testing: '$strVal' << '$otherVal' ---\n";
try {
var_dump(strVal<<$otherVal);
} catch (Exception $e) {
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
}

View file

@ -19,7 +19,8 @@ var_dump(ini_get('track_errors'));
ini_set('display_errors', 0);
var_dump(ini_get('display_errors'));
var_dump($php_errormsg);
ini_set("zend.assertions", -1);
$zero = 0;
$error = 1 / $zero;
var_dump($php_errormsg);
?>
--EXPECTF--
@ -29,4 +30,4 @@ string(1) "0"
string(1) "1"
string(1) "0"
NULL
string(%d) "%senabled or disabled%s"
string(%d) "%sivision by zer%s"

View file

@ -3,7 +3,7 @@ Error messages are shown
--FILE--
<?php
// If this test fails ask the developers of run-test.php
ini_set("zend.assertions", -1);
$error = 1 / 0;
?>
--EXPECTREGEX--
.*enabled or disabled.*
.*Division by zero.*

View file

@ -19,7 +19,8 @@ var_dump(ini_get('track_errors'));
ini_set('display_errors', 0);
var_dump(ini_get('display_errors'));
var_dump($php_errormsg);
ini_set('zend.assertions', -1);
$zero = 0;
$error = 1 / $zero;
var_dump($php_errormsg);
?>
--EXPECTF--
@ -29,4 +30,4 @@ string(1) "0"
string(1) "1"
string(1) "0"
NULL
string(%d) "%senabled or disabled%s"
string(%d) "%sivision by zer%s"