Skip to content

Commit

Permalink
Merge branch 'master' of git.php.net:php-src
Browse files Browse the repository at this point in the history
  • Loading branch information
George Wang committed Nov 20, 2014
2 parents dce692d + 8904fbc commit 0f9f0c0
Show file tree
Hide file tree
Showing 222 changed files with 9,857 additions and 6,397 deletions.
42 changes: 23 additions & 19 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 7.0.0

-Fileinfo:
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)

- CLI server:
. Refactor MIME type handling to use a hash table instead of linear search.
(Adam)
Expand All @@ -22,35 +19,42 @@ PHP NEWS
. Implemented the RFC `Catchable "Call to a member function bar() on a
non-object"` (Timm)

- Reflection
. Fixed inheritance chain of Reflector interface (Tjerk)

- DBA:
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)

- FPM:
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)

- Standard:
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
. Added intdiv() function. (Andrea)
. Improved precision of log() function for base 2 and 10. (Marc Bennewitz)

- XSL:
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
- DOM:
. Made DOMNode::textContent writeable. (Tjerk)

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

- Fileinfo:
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)

- FPM:
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)

- Reflection
. Fixed inheritance chain of Reflector interface (Tjerk)

- Session:
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)

- SOAP:
. Fixed bug #68361 (Segmentation fault on SoapClient::__getTypes).
(Laruence)

- SPL:
. Implemented #67886 (SplPriorityQueue/SplHeap doesn't expose extractFlags
nor curruption state). (Julien)

- DOM:
. Made DOMNode::textContent writeable. (Tjerk)
- Standard:
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
. Added intdiv() function. (Andrea)
. Improved precision of log() function for base 2 and 10. (Marc Bennewitz)

- XSL:
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)

<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
2 changes: 1 addition & 1 deletion README.TESTING
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ [email protected]
TMPDIR=/var/tmp
TODAY=`date +"%Y%m%d"`

# Make sure compilation enviroment is correct
# Make sure compilation environment is correct
CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre'
export MAKE=gmake
export CC=gcc
Expand Down
69 changes: 58 additions & 11 deletions TSRM/tsrm_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,35 @@ TSRM_API void tsrm_win32_shutdown(void)
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
{
PSID pSid = TWG(impersonation_token_sid);
DWORD sid_len = pSid ? GetLengthSid(pSid) : 0;
TCHAR *ptcSid = NULL;
char *bucket_key = NULL;
size_t ptc_sid_len, pathname_len;

pathname_len = strlen(pathname);

if (!pSid) {
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + 1);
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + 1);
if (!bucket_key) {
return NULL;
}
memcpy(bucket_key, pathname, strlen(pathname));
memcpy(bucket_key, pathname, pathname_len);
return bucket_key;
}

if (!ConvertSidToStringSid(pSid, &ptcSid)) {
return NULL;
}

bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid) + 1);

ptc_sid_len = strlen(ptcSid);
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + ptc_sid_len + 1);
if (!bucket_key) {
LocalFree(ptcSid);
return NULL;
}

memcpy(bucket_key, ptcSid, strlen(ptcSid));
memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname) + 1);
memcpy(bucket_key, ptcSid, ptc_sid_len);
memcpy(bucket_key + ptc_sid_len, pathname, pathname_len + 1);

LocalFree(ptcSid);
return bucket_key;
Expand All @@ -139,11 +143,8 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)

PSID tsrm_win32_get_token_sid(HANDLE hToken)
{
BOOL bSuccess = FALSE;
DWORD dwLength = 0;
PTOKEN_USER pTokenUser = NULL;
PSID sid;
PSID *ppsid = &sid;
DWORD sid_len;
PSID pResultSid = NULL;

Expand Down Expand Up @@ -204,7 +205,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
BYTE * psec_desc = NULL;
BOOL fAccess = FALSE;

BOOL bucket_key_alloc = FALSE;
realpath_cache_bucket * bucket = NULL;
char * real_path = NULL;

Expand Down Expand Up @@ -242,7 +242,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
was impersonating already, this function uses that impersonation context.
*/
if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
DWORD err = GetLastError();
if (GetLastError() == ERROR_NO_TOKEN) {
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &thread_token)) {
TWG(impersonation_token) = NULL;
Expand Down Expand Up @@ -722,4 +721,52 @@ TSRM_API char *realpath(char *orig_path, char *buffer)
return buffer;
}

#if HAVE_UTIME
static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;

ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
/* }}} */

TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
{
FILETIME mtime, atime;
HANDLE hFile;

hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);

/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
the CreateFile operation succeeds */
if (GetLastError() == ERROR_ALREADY_EXISTS) {
SetLastError(0);
}

if ( hFile == INVALID_HANDLE_VALUE ) {
return -1;
}

if (!buf) {
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &mtime);
atime = mtime;
} else {
UnixTimeToFileTime(buf->modtime, &mtime);
UnixTimeToFileTime(buf->actime, &atime);
}
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
CloseHandle(hFile);
return -1;
}
CloseHandle(hFile);
return 1;
}
/* }}} */
#endif
#endif
3 changes: 3 additions & 0 deletions TSRM/tsrm_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#include "TSRM.h"
#include <windows.h>
#if HAVE_UTIME
# include <sys/utime.h>
#endif

struct ipc_perm {
int key;
Expand Down
2 changes: 1 addition & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ PHP X.Y UPGRADE NOTES
========================================

- Core
. Instead of being undefined and platform-dependant, NaN and Infinity will
. Instead of being undefined and platform-dependent, NaN and Infinity will
always be zero when casted to integer.
. Calling a method on a non-object no longer raises a fatal error; see
also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
Expand Down
31 changes: 30 additions & 1 deletion UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ PHP 7.0 INTERNALS UPGRADE NOTES
h. HashTable API
i. New portable macros for large file support
j. New portable macros for integers
k. get_class_entry object handler info
l. get_class_name object handler info
m. Other portable macros info

2. Build system changes
a. Unix build system changes
Expand Down Expand Up @@ -110,8 +113,34 @@ PHP 7.0 INTERNALS UPGRADE NOTES
The handler is now obligatory, no longer accepts a `parent` argument and
must return a non-NULL zend_string*, which will be released by the caller.

m. Other portable macros info

ZEND_SECURE_ZERO - zeroes chunk of memory
ZEND_VALID_SOCKET - validates a php_socket_t variable

ZEND_FASTCALL is defined to use __vectorcall convention on VS2013 and above
ZEND_NORETURN is defined as __declspec(noreturn) on VS

========================
2. Build system changes
========================


a. Unix build system changes

b. Windows build system changes

- Besides Visual Studio, building with Clang or Intel Composer is now
possible. To enable an alternative toolset, add the option
--with-toolset=[vs,clang,icc] to the configure line. The default
toolset is vs. Still clang or icc need the correct environment
which involves many tools from the vs toolset.

The toolset option is supported by phpize as well.

AWARENESS The only recommended and supported toolset to produce production
ready binaries is Visual Studio. Still other compilers can be used now for
testing and analyzing purposes.

- configure.js now produces response files which are passed to the linker
and library manager. This solves the issues with the long command lines
which can exceed the OS limit.
2 changes: 1 addition & 1 deletion Zend/ZEND_CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ Changes in the Zend Engine 1.0
Use ob_start() to begin output buffering, ob_end_flush() to end
buffering and send out the buffered contents, ob_end_clean() to
end buffering without sending the buffered contents, and
ob_get_contents() to retreive the current contents of the output
ob_get_contents() to retrieve the current contents of the output
buffer. Header information (header(), content type, cookies) are
not buffered. By turning on output buffering, you can
effectively send header information all throughout your file,
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug21478.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stream_filter_append($fp, "myfilter");
fwrite($fp, "This is a test.\n");
print "Done.\n";
fclose($fp);
// Uncommenting the following 'print' line causes the segfault to stop occuring
// Uncommenting the following 'print' line causes the segfault to stop occurring
// print "2\n";
readfile(dirname(__FILE__)."/test.txt");
unlink(dirname(__FILE__)."/test.txt");
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug33512.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TheObj {
unset($SomeObj->Virtual1);
unset($SomeObj->{'Virtual'.(3)});

//but, these variables are still available??? eventhough they're "unset"-ed
//but, these variables are still available??? even though they're "unset"-ed
print $SomeObj->Virtual1."\n";
print $SomeObj->{'Virtual'.(3)}."\n";
?>
Expand Down
8 changes: 8 additions & 0 deletions Zend/tests/bug38779_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ include $filename;

echo "Done\n";
?>
--CLEAN--
<?php

$filename = dirname(__FILE__)."/bug38779.txt";
if (file_exists($filename)) {
@unlink(dirname(__FILE__)."/bug38779.txt");
}
?>
--EXPECTF--
Parse error: %s error%sin %s on line %d
string(6) "flush!"
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug40809.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Bug #40809 (Poor perfomance of ".=")
Bug #40809 (Poor performance of ".=")
--FILE--
<?php
error_reporting(E_ALL|E_STRICT);
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug43200.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Bug #43200 (Interface implementation / inheritence not possible in abstract classes)
Bug #43200 (Interface implementation / inheritance not possible in abstract classes)
--FILE--
<?php

Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug43200_2.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Bug #43200.2 (Interface implementation / inheritence not possible in abstract classes)
Bug #43200.2 (Interface implementation / inheritance not possible in abstract classes)
--FILE--
<?php

Expand Down
18 changes: 18 additions & 0 deletions Zend/tests/bug68370.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Bug #68370 "unset($this)" can make the program crash
--FILE--
<?php
class C {
public function test() {
unset($this);
return get_defined_vars();
}
}
$c = new C();
$x = $c->test();
print_r($x);
unset($c, $x);
--EXPECTF--
Array
(
)
25 changes: 25 additions & 0 deletions Zend/tests/class_properties_const.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Const class properties(runtime cache)
--FILE--
<?php
class A {
}

$a = new A;

echo "runtime\n";
var_dump($a->{array()});
var_dump($a->{1});
var_dump($a->{function(){}});
?>
--EXPECTF--
Notice: Array to string conversion in %sclass_properties_const.php on line %d
runtime

Notice: Undefined property: A::$Array in %sclass_properties_const.php on line %d
NULL

Notice: Undefined property: A::$1 in %sclass_properties_const.php on line %d
NULL

Catchable fatal error: Object of class Closure could not be converted to string in %sclass_properties_const.php on line %d
8 changes: 4 additions & 4 deletions Zend/tests/debug_backtrace_with_include_and_this.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ set_error_handler(function($code, $msg, $file, $line) {
});

try {
(new CL())->load('class://non.existant.Class');
(new CL())->load('class://non.existent.Class');
} catch (CLException $e) {
echo $e."\n";
}
--EXPECTF--
ERR#2: include(class://non.existant.Class): failed to open stream: "CLWrapper::stream_open" call failed @ include
ERR#2: include(): Failed opening 'class://non.existant.Class' for inclusion (include_path='%s') @ include
ERR#2: include(class://non.existent.Class): failed to open stream: "CLWrapper::stream_open" call failed @ include
ERR#2: include(): Failed opening 'class://non.existent.Class' for inclusion (include_path='%s') @ include

Fatal error: Uncaught exception 'Exception' with message 'Failed loading class://non.existant.Class' in %s
Fatal error: Uncaught exception 'Exception' with message 'Failed loading class://non.existent.Class' in %s
Stack trace:
#0 %s(%d): CL->load('class://non.exi...')
#1 {main}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/traits/bug54441.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ class Boo {

?>
--EXPECTF--
Fatal error: The modifiers for the trait alias dontKnow() need to be changed in the same statment in which the alias is defined. Error in %s on line %d
Fatal error: The modifiers for the trait alias dontKnow() need to be changed in the same statement in which the alias is defined. Error in %s on line %d
Loading

0 comments on commit 0f9f0c0

Please sign in to comment.