diff --git a/package.xml b/package.xml index 5e84251..9c3f1f1 100644 --- a/package.xml +++ b/package.xml @@ -10,11 +10,11 @@ bobwei9@hotmail.com yes - 2019-04-28 + 2019-05-01 - 0.2.3 - 0.2.3 + 0.2.4 + 0.2.4 beta @@ -23,7 +23,6 @@ PHP License - Fix Windows build - - Fix PHP 7.4 build diff --git a/php_uv.c b/php_uv.c index c7fd751..90ed785 100644 --- a/php_uv.c +++ b/php_uv.c @@ -1873,7 +1873,11 @@ static void php_uv_fs_cb(uv_fs_t* req) case UV_FS_READLINK: argc = 2; ZVAL_BOOL(¶ms[0], uv->uv.fs.result == 0); - ZVAL_STRING(¶ms[1], req->ptr); + if (uv->uv.fs.result == 0) { + ZVAL_STRING(¶ms[1], req->ptr); + } else { + ZVAL_NULL(¶ms[1]); + } break; case UV_FS_READ: diff --git a/php_uv.h b/php_uv.h index cd0e928..91c4324 100755 --- a/php_uv.h +++ b/php_uv.h @@ -3,7 +3,7 @@ #define PHP_UV_H #define PHP_UV_EXTNAME "uv" -#define PHP_UV_VERSION "0.2.3" +#define PHP_UV_VERSION "0.2.4" #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/tests/320-fs-readlink.phpt b/tests/320-fs-readlink.phpt new file mode 100644 index 0000000..21d5137 --- /dev/null +++ b/tests/320-fs-readlink.phpt @@ -0,0 +1,22 @@ +--TEST-- +uv_fs_readlink() segfaults if file not a link +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + bool(false) + [1]=> + NULL +} +