Skip to content

Commit

Permalink
fix #4028
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Jan 26, 2021
1 parent 63ff79d commit 709813f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
6 changes: 6 additions & 0 deletions ext-src/php_swoole.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ extern ZEND_DECLARE_MODULE_GLOBALS(swoole);
#endif
/*}}}*/

#if PHP_VERSION_ID < 70400
typedef size_t php_stream_size_t;
#else
typedef ssize_t php_stream_size_t;
#endif

/* PHP 7 wrapper functions / macros */

//----------------------------------Zval API------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions ext-src/swoole_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
#define HAVE_SEC_LEVEL 1
#endif

#if PHP_VERSION_ID < 70400
typedef size_t php_stream_size_t;
#else
typedef ssize_t php_stream_size_t;
#endif

using swoole::Coroutine;
using swoole::PHPCoroutine;
using swoole::coroutine::Socket;
Expand Down
16 changes: 5 additions & 11 deletions thirdparty/php/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@

/* $Id$ */

#include "php.h"
#include "php_globals.h"
#include "php_network.h"
#include "php_swoole.h"
#include "php_open_temporary_file.h"
#include "ext/standard/file.h"
#include "ext/standard/flock_compat.h"
#include "ext/standard/php_filestat.h"
#include <stddef.h>

#include <fcntl.h>
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
Expand All @@ -36,15 +34,8 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include "SAPI.h"

#include "thirdparty/php/streams/php_streams_int.h"
#ifdef PHP_WIN32
#include "win32/winutil.h"
#include "win32/time.h"
#include "win32/ioutil.h"
#include "win32/readdir.h"
#endif

#include "swoole_file_hook.h"

Expand Down Expand Up @@ -891,6 +882,9 @@ static php_stream *stream_opener(php_stream_wrapper *wrapper,
if (options & STREAM_OPEN_FOR_INCLUDE) {
_open_for_include:
stream = php_stream_fopen_rel(path, mode, opened_path, options);
if (stream == NULL) {
return NULL;
}
stream->ops = php_swoole_get_ori_php_stream_stdio_ops();
return stream;
}
Expand Down

0 comments on commit 709813f

Please sign in to comment.