From: Ilia Alshanetsky Date: Mon, 24 Nov 2003 01:43:59 +0000 (+0000) Subject: MFH: Fixed bug #26355 (flock() doesn't initialize the wouldblock argument) X-Git-Tag: php-4.3.5RC1~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5354a79497fd2b678555b57ffe9faec76771ff29;p=php MFH: Fixed bug #26355 (flock() doesn't initialize the wouldblock argument) --- diff --git a/NEWS b/NEWS index bf33a34538..ab54bdc1a7 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP 4 NEWS ?? ??? 2003, Version 4.3.5 - Fixed header handler in NSAPI SAPI module (header->replace was ignored, send_default_content_type now sends value from php.ini). (Uwe Schindler) +- Fixed bug #26355 (flock() doesn't initialize the wouldblock argument). (Ilia) - Fixed bug #26309 (Fixed argument parsing for imageftbbox()). (Ilia) - Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows). (Ilia) - Fixed bug #26267 (gmp_random() leaks memory and does not produce random diff --git a/ext/standard/file.c b/ext/standard/file.c index 246790db40..e389b2457f 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -247,12 +247,17 @@ PHP_FUNCTION(flock) RETURN_FALSE; } + if (arg_count == 3) { + convert_to_long_ex(arg3); + Z_LVAL_PP(arg3) = 0; + } + /* flock_values contains all possible actions if (arg2 & 4) we won't block on the lock */ act = flock_values[act - 1] | (Z_LVAL_PP(arg2) & 4 ? LOCK_NB : 0); if (flock(fd, act)) { if (errno == EWOULDBLOCK && arg_count == 3) { - ZVAL_LONG(*arg3, 1); + Z_LVAL_PP(arg3) = 1; } else { RETURN_FALSE; }