Skip to content

Commit c6bad96

Browse files
committed
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits) NEWS add test for bug #68381 Fixed bug #68381 Set FPM log level earlier during init proper dllexport move to size_t where zend_string is used internally fix some datatype mismatches return after the warning, to fix uninitialized salt usage fix datatype mismatches add missing type specifier fix datatype mismatches fix unsigned check "extern" shouldn't be used for definitions joined identical conditional blocks simplify fpm tests SEND_VAR_NO_REF optimization Add test for bug #68442 Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments. Add new FPM test for IPv4/IPv6 ... Conflicts: win32/build/config.w32
2 parents 4262663 + 64a39dc commit c6bad96

221 files changed

Lines changed: 12459 additions & 8330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ before_script:
4646

4747
# Run PHPs run-tests.php
4848
script:
49-
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
49+
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120 -s
5050
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg

NEWS

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,59 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 20??, PHP 7.0.0
44

5-
-Fileinfo:
6-
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
7-
85
- CLI server:
96
. Refactor MIME type handling to use a hash table instead of linear search.
107
(Adam)
118
. Update the MIME type list from the one shipped by Apache HTTPD. (Adam)
129

1310
- Core:
11+
. Fixed bug #68104 (Segfault while pre-evaluating a disabled function).
12+
(Laruence)
13+
. Fixed bug #68252 (segfault in Zend/zend_hash.c in function
14+
_zend_hash_del_el). (Laruence)
1415
. Added PHP_INT_MIN constant. (Andrea)
15-
. Added Closure::apply() method. (Andrea)
16+
. Added Closure::call() method. (Andrea)
1617
. Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
1718
. Fixed #67959 (Segfault when calling phpversion('spl')). (Florian)
1819
. Implemented the RFC `Catchable "Call to a member function bar() on a
1920
non-object"` (Timm)
2021

21-
- Reflection
22-
. Fixed inheritance chain of Reflector interface (Tjerk)
23-
2422
- DBA:
2523
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
2624

27-
- FPM:
28-
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
29-
30-
- Standard:
31-
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
32-
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
33-
. Added intdiv() function. (Andrea)
34-
. Improved precision of log() function for base 2 and 10. (Marc Bennewitz)
35-
36-
- XSL:
37-
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
25+
- DOM:
26+
. Made DOMNode::textContent writeable. (Tjerk)
3827

3928
- GD:
4029
. Made fontFetch's path parser thread-safe. (Sara)
4130

31+
- Fileinfo:
32+
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
33+
34+
- FPM:
35+
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
36+
37+
- Reflection
38+
. Fixed inheritance chain of Reflector interface (Tjerk)
39+
4240
- Session:
4341
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)
4442

43+
- SOAP:
44+
. Fixed bug #68361 (Segmentation fault on SoapClient::__getTypes).
45+
(Laruence)
46+
4547
- SPL:
4648
. Implemented #67886 (SplPriorityQueue/SplHeap doesn't expose extractFlags
4749
nor curruption state). (Julien)
4850

49-
- DOM:
50-
. Made DOMNode::textContent writeable. (Tjerk)
51+
- Standard:
52+
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
53+
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
54+
. Added intdiv() function. (Andrea)
55+
. Improved precision of log() function for base 2 and 10. (Marc Bennewitz)
56+
57+
- XSL:
58+
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
5159

5260
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

TSRM/tsrm_win32.c

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,35 @@ TSRM_API void tsrm_win32_shutdown(void)
109109
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
110110
{
111111
PSID pSid = TWG(impersonation_token_sid);
112-
DWORD sid_len = pSid ? GetLengthSid(pSid) : 0;
113112
TCHAR *ptcSid = NULL;
114113
char *bucket_key = NULL;
114+
size_t ptc_sid_len, pathname_len;
115+
116+
pathname_len = strlen(pathname);
115117

116118
if (!pSid) {
117-
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + 1);
119+
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + 1);
118120
if (!bucket_key) {
119121
return NULL;
120122
}
121-
memcpy(bucket_key, pathname, strlen(pathname));
123+
memcpy(bucket_key, pathname, pathname_len);
122124
return bucket_key;
123125
}
124126

125127
if (!ConvertSidToStringSid(pSid, &ptcSid)) {
126128
return NULL;
127129
}
128130

129-
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid) + 1);
131+
132+
ptc_sid_len = strlen(ptcSid);
133+
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + ptc_sid_len + 1);
130134
if (!bucket_key) {
131135
LocalFree(ptcSid);
132136
return NULL;
133137
}
134138

135-
memcpy(bucket_key, ptcSid, strlen(ptcSid));
136-
memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname) + 1);
139+
memcpy(bucket_key, ptcSid, ptc_sid_len);
140+
memcpy(bucket_key + ptc_sid_len, pathname, pathname_len + 1);
137141

138142
LocalFree(ptcSid);
139143
return bucket_key;
@@ -142,11 +146,8 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
142146

143147
PSID tsrm_win32_get_token_sid(HANDLE hToken)
144148
{
145-
BOOL bSuccess = FALSE;
146149
DWORD dwLength = 0;
147150
PTOKEN_USER pTokenUser = NULL;
148-
PSID sid;
149-
PSID *ppsid = &sid;
150151
DWORD sid_len;
151152
PSID pResultSid = NULL;
152153

@@ -207,7 +208,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
207208
BYTE * psec_desc = NULL;
208209
BOOL fAccess = FALSE;
209210

210-
BOOL bucket_key_alloc = FALSE;
211211
realpath_cache_bucket * bucket = NULL;
212212
char * real_path = NULL;
213213

@@ -245,7 +245,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
245245
was impersonating already, this function uses that impersonation context.
246246
*/
247247
if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
248-
DWORD err = GetLastError();
249248
if (GetLastError() == ERROR_NO_TOKEN) {
250249
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &thread_token)) {
251250
TWG(impersonation_token) = NULL;
@@ -282,14 +281,14 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
282281

283282
if (CWDG(realpath_cache_size_limit)) {
284283
t = time(0);
285-
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
284+
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
286285
if(bucket == NULL && real_path == NULL) {
287286
/* We used the pathname directly. Call tsrm_realpath */
288287
/* so that entry is created in realpath cache */
289288
real_path = (char *)malloc(MAX_PATH);
290289
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
291290
pathname = real_path;
292-
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
291+
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
293292
}
294293
}
295294
}
@@ -480,7 +479,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
480479
}
481480

482481
/*The following two checks can be removed once we drop XP support */
483-
type_len = strlen(type);
482+
type_len = (int)strlen(type);
484483
if (type_len <1 || type_len > 2) {
485484
return NULL;
486485
}
@@ -725,4 +724,52 @@ TSRM_API char *realpath(char *orig_path, char *buffer)
725724
return buffer;
726725
}
727726

727+
#if HAVE_UTIME
728+
static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
729+
{
730+
// Note that LONGLONG is a 64-bit value
731+
LONGLONG ll;
732+
733+
ll = Int32x32To64(t, 10000000) + 116444736000000000;
734+
pft->dwLowDateTime = (DWORD)ll;
735+
pft->dwHighDateTime = ll >> 32;
736+
}
737+
/* }}} */
738+
739+
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
740+
{
741+
FILETIME mtime, atime;
742+
HANDLE hFile;
743+
744+
hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
745+
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);
746+
747+
/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
748+
the CreateFile operation succeeds */
749+
if (GetLastError() == ERROR_ALREADY_EXISTS) {
750+
SetLastError(0);
751+
}
752+
753+
if ( hFile == INVALID_HANDLE_VALUE ) {
754+
return -1;
755+
}
756+
757+
if (!buf) {
758+
SYSTEMTIME st;
759+
GetSystemTime(&st);
760+
SystemTimeToFileTime(&st, &mtime);
761+
atime = mtime;
762+
} else {
763+
UnixTimeToFileTime(buf->modtime, &mtime);
764+
UnixTimeToFileTime(buf->actime, &atime);
765+
}
766+
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
767+
CloseHandle(hFile);
768+
return -1;
769+
}
770+
CloseHandle(hFile);
771+
return 1;
772+
}
773+
/* }}} */
774+
#endif
728775
#endif

TSRM/tsrm_win32.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
#include "TSRM.h"
2525
#include <windows.h>
26+
#if HAVE_UTIME
27+
# include <sys/utime.h>
28+
#endif
2629

2730
struct ipc_perm {
2831
int key;

UPGRADING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ PHP X.Y UPGRADE NOTES
5252

5353
- Core
5454
. Support for strings with length >= 2^31 bytes in 64 bit builds
55-
. Closure::apply() method added
55+
. Closure::call() method added
5656

5757
- Standard
5858
. intdiv() function for integer division added.

UPGRADING.INTERNALS

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,17 @@ PHP 7.0 INTERNALS UPGRADE NOTES
114114
2. Build system changes
115115
========================
116116

117-
117+
a. Unix build system changes
118+
119+
b. Windows build system changes
120+
121+
- Besides Visual Studio, building with Clang or Intel Composer is now
122+
possible. To enable an alternative toolset, add the option
123+
--with-toolset=[vs,clang,icc] to the configure line. The default
124+
toolset is vs. Still clang or icc need the correct environment
125+
which involves many tools from the vs toolset.
126+
127+
AWARENESS The only recommended and supported toolset to produce production
128+
ready binaries is Visual Studio. Still other compilers can be used now for
129+
testing and analyzing purposes.
130+

Zend/tests/bug38779_1.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ include $filename;
3939

4040
echo "Done\n";
4141
?>
42+
--CLEAN--
43+
<?php
44+
45+
$filename = dirname(__FILE__)."/bug38779.txt";
46+
if (file_exists($filename)) {
47+
@unlink(dirname(__FILE__)."/bug38779.txt");
48+
}
49+
?>
4250
--EXPECTF--
4351
Parse error: %s error%sin %s on line %d
4452
string(6) "flush!"

Zend/tests/bug68370.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #68370 "unset($this)" can make the program crash
3+
--FILE--
4+
<?php
5+
class C {
6+
public function test() {
7+
unset($this);
8+
return get_defined_vars();
9+
}
10+
}
11+
$c = new C();
12+
$x = $c->test();
13+
print_r($x);
14+
unset($c, $x);
15+
--EXPECTF--
16+
Array
17+
(
18+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Const class properties(runtime cache)
3+
--FILE--
4+
<?php
5+
class A {
6+
}
7+
8+
$a = new A;
9+
10+
echo "runtime\n";
11+
var_dump($a->{array()});
12+
var_dump($a->{1});
13+
var_dump($a->{function(){}});
14+
?>
15+
--EXPECTF--
16+
Notice: Array to string conversion in %sclass_properties_const.php on line %d
17+
runtime
18+
19+
Notice: Undefined property: A::$Array in %sclass_properties_const.php on line %d
20+
NULL
21+
22+
Notice: Undefined property: A::$1 in %sclass_properties_const.php on line %d
23+
NULL
24+
25+
Catchable fatal error: Object of class Closure could not be converted to string in %sclass_properties_const.php on line %d

0 commit comments

Comments
 (0)