Skip to content

Commit

Permalink
Merge branch 'master' into iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jul 4, 2016
2 parents 583386d + c2b29a5 commit d9a9cf8
Show file tree
Hide file tree
Showing 815 changed files with 1,088,190 additions and 26,746 deletions.
2 changes: 1 addition & 1 deletion CODING_STANDARDS
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ User Functions/Methods Naming Conventions
'foobar'
'foo_bar'

Internal Function Naming Convensions
Internal Function Naming Conventions
----------------------

1. Functions that are part of the external API should be named
Expand Down
98 changes: 97 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,97 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2016, PHP 7.1.0
?? ??? 2016, PHP 7.1.0beta1

- Core:
. Fixed bug #72523 (dtrace issue with reflection (failed test)). (Laruence)
. Fixed bug #72508 (strange references after recursive function call and
"switch" statement). (Laruence)

- COM:
. Fixed bug #72498 (variant_date_from_timestamp null dereference). (Anatol)

- CURL:
. Add curl_multi_errno(), curl_share_errno() and curl_share_strerror()
functions. (Pierrick)
. Add support for HTTP/2 Server Push (davey)

- GD:
. Fixed bug #72404 (imagecreatefromjpeg fails on selfie). (cmb)

- PCRE:
. Fixed bug #72476 (Memleak in jit_stack). (Laruence)
. Fixed bug #72463 (mail fails with invalid argument). (Anatol)

- Readline:
. Fixed bug #72538 (readline_redisplay crashes php). (Laruence)

- SQLite3:
. Fixed bug #70628 (Clearing bindings on an SQLite3 statement doesn't work).
(cmb)

- Session:
. Fixed bug #72531 (ps_files_cleanup_dir Buffer overflow). (Laruence)

- Standard:
. Implemented RFC: More precise float values. (Jakub Zelenka, Yasuo)
. array_multisort now uses zend_sort instead zend_qsort. (Laruence)
. Fixed bug #72505 (readfile() mangles files larger than 2G). (Cschneid)

- Streams:
. Fixed bug #72534 (stream_socket_get_name crashes). (Anatol)

- OpenSSL:
. Implemented FR #61204 (Add elliptic curve support for OpenSSL).
(Dominic Luechinger)

23 Jun 2016, PHP 7.1.0alpha2

- Core:
. Implemented RFC: Replace "Missing argument" warning with "Too few
arguments" exception. (Dmitry)
. Implemented RFC: Fix inconsistent behavior of $this variable. (Dmitry)
. Fixed bug #72441 (Segmentation fault: RFC list_keys). (Laruence)
. Fixed bug #72395 (list() regression). (Laruence)
. Fixed bug #72373 (TypeError after Generator function w/declared return type
finishes). (Nikita)
. Fixed bug #69489 (tempnam() should raise notice if falling back to temp dir).
(Laruence, Anatol)
. Fixed UTF-8 and long path support on Windows. (Anatol)

- GD:
. Fixed bug #43475 (Thick styled lines have scrambled patterns). (cmb)
. Fixed bug #53640 (XBM images require width to be multiple of 8). (cmb)
. Fixed bug #64641 (imagefilledpolygon doesn't draw horizontal line). (cmb)

- JSON
. Implemented FR #46600 ("_empty_" key in objects). (Jakub Zelenka)

- Mbstring:
. Fixed bug #72405 (mb_ereg_replace - mbc_to_code (oniguruma) -
oob read access). (Laruence)
. Fixed bug #72399 (Use-After-Free in MBString (search_re)). (Laruence)

- OpenSSL:
. Implemented FR #67304 (Added AEAD support [CCM and GCM modes] to
openssl_encrypt and openssl_decrypt). (Jakub Zelenka)
. Implemented error storing to the global queue and cleaning up the OpenSSL
error queue (resolves bugs #68276 and #69882). (Jakub Zelenka)

- PCRE:
. Upgraded to PCRE 8.39. (Anatol)

- Sqlite3:
. Implemented FR #72385 (Update SQLite bundle lib(3.13.0)). (Laruence)

- Standard:
. Fixed bug #72306 (Heap overflow through proc_open and $env parameter).
(Laruence)

- Streams:
. Fixed bug #72439 (Stream socket with remote address leads to a segmentation
fault). (Laruence)

09 Jun 2016, PHP 7.1.0alpha1

- Core:
. Added nullable types. (Levi, Dmitry)
Expand All @@ -10,10 +101,15 @@ PHP NEWS
. Change statement and fcall extension handlers to accept frame. (Joe)
. Implemented safe execution timeout handling, that prevents random crashes
after "Maximum execution time exceeded" error. (Dmitry)
. Fixed bug #53432 (Assignment via string index access on an empty string
converts to array). (Nikita)
. Fixed bug #62210 (Exceptions can leak temporary variables). (Dmitry, Bob)
. Fixed bug #62814 (It is possible to stiffen child class members visibility).
(Nikita)
. Fixed bug #69989 (Generators don't participate in cycle GC). (Nikita)
. Fixed bug #70228 (Memleak if return in finally block). (Dmitry)
. Fixed bug #71266 (Missing separation of properties HT in foreach etc).
(Dmitry)
. Fixed bug #71604 (Aborted Generators continue after nested finally).
(Nikita)
. Fixed bug #71572 (String offset assignment from an empty string inserts
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pull Requests
=============
PHP accepts pull requests via github. Discussions are done on github, but
depending on the topic can also be relayed to the official PHP developer
mailinglist internals@lists.php.net.
mailing list internals@lists.php.net.

New features require an RFC and must be accepted by the developers.
See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more
Expand Down
5 changes: 4 additions & 1 deletion TSRM/tsrm_config_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ char *alloca ();
#endif

#ifndef MAXPATHLEN
# ifdef PATH_MAX
# if _WIN32
# include "win32/ioutil.h"
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
# elif PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
# define MAXPATHLEN MAX_PATH
Expand Down
92 changes: 75 additions & 17 deletions TSRM/tsrm_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <Sddl.h>
#include "tsrm_win32.h"
#include "zend_virtual_cwd.h"
#include "win32/ioutil.h"

#ifdef ZTS
static ts_rsrc_id win32_globals_id;
Expand Down Expand Up @@ -208,28 +209,42 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode)
BYTE * psec_desc = NULL;
BOOL fAccess = FALSE;

PHP_WIN32_IOUTIL_INIT_W(pathname)
if (!pathw) {
return -1;
}

realpath_cache_bucket * bucket = NULL;
char * real_path = NULL;

if (mode == 1 /*X_OK*/) {
DWORD type;
return GetBinaryType(pathname, &type) ? 0 : -1;
int ret;

ret = GetBinaryTypeW(pathw, &type) ? 0 : -1;

PHP_WIN32_IOUTIL_CLEANUP_W()

return ret;
} else {
if(!IS_ABSOLUTE_PATH(pathname, strlen(pathname)+1)) {
real_path = (char *)malloc(MAX_PATH);
real_path = (char *)malloc(MAXPATHLEN);
if(tsrm_realpath(pathname, real_path) == NULL) {
goto Finished;
}
pathname = real_path;
PHP_WIN32_IOUTIL_REINIT_W(pathname);
}

if(access(pathname, mode)) {
if(php_win32_ioutil_access(pathname, mode)) {
PHP_WIN32_IOUTIL_CLEANUP_W()
free(real_path);
return errno;
}

/* If only existence check is made, return now */
if (mode == 0) {
PHP_WIN32_IOUTIL_CLEANUP_W()
free(real_path);
return 0;
}
Expand Down Expand Up @@ -285,10 +300,11 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode)
if(bucket == NULL && real_path == NULL) {
/* We used the pathname directly. Call tsrm_realpath */
/* so that entry is created in realpath cache */
real_path = (char *)malloc(MAX_PATH);
real_path = (char *)malloc(MAXPATHLEN);
if(tsrm_realpath(pathname, real_path) != NULL) {
pathname = real_path;
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t);
PHP_WIN32_IOUTIL_REINIT_W(pathname);
}
}
}
Expand Down Expand Up @@ -325,13 +341,13 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode)
}

/* Get size of security buffer. Call is expected to fail */
if(GetFileSecurity(pathname, sec_info, NULL, 0, &sec_desc_length)) {
if(GetFileSecurityW(pathw, sec_info, NULL, 0, &sec_desc_length)) {
goto Finished;
}

psec_desc = (BYTE *)malloc(sec_desc_length);
if(psec_desc == NULL ||
!GetFileSecurity(pathname, sec_info, (PSECURITY_DESCRIPTOR)psec_desc, sec_desc_length, &sec_desc_length)) {
!GetFileSecurityW(pathw, sec_info, (PSECURITY_DESCRIPTOR)psec_desc, sec_desc_length, &sec_desc_length)) {
goto Finished;
}

Expand Down Expand Up @@ -373,6 +389,7 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode)
real_path = NULL;
}

PHP_WIN32_IOUTIL_CLEANUP_W()
if(fAccess == FALSE) {
errno = EACCES;
return errno;
Expand Down Expand Up @@ -459,14 +476,15 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
{
FILE *stream = NULL;
int fno, type_len, read, mode;
STARTUPINFO startup;
STARTUPINFOW startup;
PROCESS_INFORMATION process;
SECURITY_ATTRIBUTES security;
HANDLE in, out;
DWORD dwCreateFlags = 0;
BOOL res;
process_pair *proc;
char *cmd;
char *cmd = NULL;
wchar_t *cmdw = NULL, *cwdw = NULL, *envw = NULL;
int i;
char *ptype = (char *)type;
HANDLE thread_token = NULL;
Expand All @@ -490,18 +508,42 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
ptype++;
}

cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
if (!cmd) {
return NULL;
}

sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
cmdw = php_win32_cp_any_to_w(cmd);
if (!cmdw) {
free(cmd);
return NULL;
}

if (cwd) {
cwdw = php_win32_ioutil_any_to_w(cwd);
if (!cwdw) {
free(cmd);
free(cmdw);
return NULL;
}
}

security.nLength = sizeof(SECURITY_ATTRIBUTES);
security.bInheritHandle = TRUE;
security.lpSecurityDescriptor = NULL;

if (!type_len || !CreatePipe(&in, &out, &security, 2048L)) {
free(cmdw);
free(cwdw);
free(cmd);
return NULL;
}

memset(&startup, 0, sizeof(STARTUPINFO));
memset(&startup, 0, sizeof(STARTUPINFOW));
memset(&process, 0, sizeof(PROCESS_INFORMATION));

startup.cb = sizeof(STARTUPINFO);
startup.cb = sizeof(STARTUPINFOW);
startup.dwFlags = STARTF_USESTDHANDLES;
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);

Expand Down Expand Up @@ -533,19 +575,28 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
}
}

cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
if (!cmd) {
return NULL;
envw = php_win32_cp_env_any_to_w(env);
if (envw) {
dwCreateFlags |= CREATE_UNICODE_ENVIRONMENT;
} else {
if (env) {
free(cmd);
free(cmdw);
free(cwdw);
return NULL;
}
}

sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
if (asuser) {
res = CreateProcessAsUser(token_user, NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
res = CreateProcessAsUserW(token_user, NULL, cmdw, &security, &security, security.bInheritHandle, dwCreateFlags, envw, cwdw, &startup, &process);
CloseHandle(token_user);
} else {
res = CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process);
res = CreateProcessW(NULL, cmdw, &security, &security, security.bInheritHandle, dwCreateFlags, envw, cwdw, &startup, &process);
}
free(cmd);
free(cmdw);
free(cwdw);
free(envw);

if (!res) {
return NULL;
Expand Down Expand Up @@ -749,10 +800,17 @@ TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
{
FILETIME mtime, atime;
HANDLE hFile;
PHP_WIN32_IOUTIL_INIT_W(filename)

hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
if (!pathw) {
return -1;
}

hFile = CreateFileW(pathw, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);

PHP_WIN32_IOUTIL_CLEANUP_W()

/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
the CreateFile operation succeeds */
if (GetLastError() == ERROR_ALREADY_EXISTS) {
Expand Down

0 comments on commit d9a9cf8

Please sign in to comment.