From 63617a678f51d07d7e1843221afffe9a8b31c624 Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 5 Oct 2015 11:39:55 -0400 Subject: [PATCH 1/2] Fixed bug #70641 (Random_* - Better compatibility on Linux distros) See: * https://bugs.php.net/bug.php?id=70641 * https://github.com/php/php-src/pull/1513#issuecomment-145571829 --- ext/standard/random.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/standard/random.c b/ext/standard/random.c index 6d3ec141bc..f46c4e0a14 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -31,7 +31,7 @@ # include "win32/winutil.h" #endif #ifdef __linux__ -# include +# include #endif #ifdef ZTS @@ -107,7 +107,7 @@ static int php_random_bytes(void *bytes, size_t size) amount_to_read */ - n = getrandom(bytes + read_bytes, amount_to_read, 0); + n = syscall(SYS_getrandom, bytes + read_bytes, amount_to_read, 0); if (n == -1) { if (errno == EINTR || errno == EAGAIN) { @@ -140,7 +140,13 @@ static int php_random_bytes(void *bytes, size_t size) return FAILURE; } /* Does the file exist and is it a character device? */ - if (fstat(fd, &st) != 0 || !S_ISCHR(st.st_mode)) { + if (fstat(fd, &st) != 0 || +# ifdef S_IFNAM + !(S_IFNAM(st.st_mode) || S_ISCHR(st.st_mode)) +# else + !S_ISCHR(st.st_mode) +# endif + ) { close(fd); zend_throw_exception(zend_ce_exception, "Error reading from source device", 0); return FAILURE; From 60bb51c0d38292f434b8e16214ac0477f96932b4 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Tue, 6 Oct 2015 01:02:52 +0200 Subject: [PATCH 2/2] Update NEWS --- NEWS | 6 +++++- UPGRADING | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9051f4d333..013a856cf4 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS - Phpdbg . Fixed bug #70614 (incorrect exit code in -rr mode with Exceptions). (Bob) +- Standard: + . Fixed bug #70641 (Compile fails for ext/standard/random.c). + (Scott Arciszewski) + 01 Oct 2015, PHP 7.0.0 RC 4 - Core: @@ -64,7 +68,7 @@ PHP NEWS - SQLite3: . Fixed bug #70571 (Memory leak in sqlite3_do_callback). (Adam) --SPL: +- SPL: . Fixed bug #70573 (Cloning SplPriorityQueue leads to memory leaks). (Dmitry) - XMLRPC diff --git a/UPGRADING b/UPGRADING index cf06893151..11c100cdab 100644 --- a/UPGRADING +++ b/UPGRADING @@ -435,6 +435,8 @@ Standard library changes different sort order of elements that compare as equal. . Removed dl() function on fpm-fcgi. . setcookie() with an empty cookie name now issues a WARNING and doesn't send an empty set-cookie header line anymore. + . Closure::call() and Closure::bindTo() do no longer accept foreign scopes for Closures of functions and methods + generated via ReflectionFunctionAbstract::getClosure(). Other =====