summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2014-04-10 16:49:13 +0300
committerAndrey Hristov <andrey@php.net>2014-04-10 16:49:13 +0300
commit090c3e87c0449e6eadf83815bb57c8a6eff4b56e (patch)
tree946fdc55ed17d2dc07a99b388565cc96197026dd /ext/standard/streamsfuncs.c
parent63791d055ad64762c3f63e08ca7ad8ba1f44e0ab (diff)
parent3204ad5858a5abc50b11b8527d22c82eb07a80cc (diff)
downloadphp-git-090c3e87c0449e6eadf83815bb57c8a6eff4b56e.tar.gz
Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6
Conflicts: ext/mysqli/tests/mysqli_begin_transaction.phpt
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index b623447651..8d42a51af6 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -610,10 +610,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == SUCCESS;
zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
- /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast()
- would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave
- the higher bits of a SOCKET variable uninitialized on systems with little endian. */
- int tmp_fd;
+ php_socket_t this_fd;
php_stream_from_zval_no_verify(stream, elem);
if (stream == NULL) {
@@ -624,9 +621,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
* when casting. It is only used here so that the buffered data warning
* is not displayed.
* */
- if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) {
-
- php_socket_t this_fd = (php_socket_t)tmp_fd;
+ if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) {
PHP_SAFE_FD_SET(this_fd, fds);
@@ -660,10 +655,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
char *key;
uint key_len;
ulong num_ind;
- /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast()
- would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave
- the higher bits of a SOCKET variable uninitialized on systems with little endian. */
- int tmp_fd;
+ php_socket_t this_fd;
type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array),
@@ -682,10 +674,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
* when casting. It is only used here so that the buffered data warning
* is not displayed.
*/
- if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&tmp_fd, 1) && tmp_fd != -1) {
-
- php_socket_t this_fd = (php_socket_t)tmp_fd;
-
+ if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != SOCK_ERR) {
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
if (type == HASH_KEY_IS_LONG) {
zend_hash_index_update(new_hash, num_ind, (void *)elem, sizeof(zval *), (void **)&dest_elem);