summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index ffebc2fb4b..4b3ec87444 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -263,12 +263,16 @@ PHP_FUNCTION(flock)
RETURN_FALSE;
}
+ if (arg3 && PZVAL_IS_REF(arg3)) {
+ convert_to_long_ex(&arg3);
+ Z_LVAL_P(arg3) = 0;
+ }
+
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
act = flock_values[act - 1] | (operation & 4 ? LOCK_NB : 0);
if (!php_stream_lock(stream, act)) {
if (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) {
- convert_to_long_ex(&arg3);
- ZVAL_LONG(arg3, 1);
+ Z_LVAL_P(arg3) = 1;
}
RETURN_TRUE;
}