Skip to content

Commit

Permalink
remove automatic file unlocking on shutdown and/or stream close
Browse files Browse the repository at this point in the history
(make it win32-specific for 5_2, as discussed with Ilia)
  • Loading branch information
tony2001 committed Dec 25, 2009
1 parent 9326c7e commit 42d05a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -17,6 +17,9 @@ PHP NEWS
- Changed "post_max_size" php.ini directive to allow unlimited post size by
setting it to 0. (Rasmus)

- Removed automatic file descriptor unlocking happening on shutdown and/or
stream close (on all OSes). (Tony, Ilia)

- Added INTERNALDATE support to imap_append. (nick at mailtrust dot com)
- Added support for SHA-256 and SHA-512 to php's crypt. (Pierre)
- Added realpath_cache_size() and realpath_cache_get() functions. (Stas)
Expand Down
3 changes: 0 additions & 3 deletions main/streams/plain_wrapper.c
Expand Up @@ -387,9 +387,6 @@ static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
#endif

if (close_handle) {
if (data->lock_flag != LOCK_UN) {
php_stream_lock(stream, LOCK_UN);
}
if (data->file) {
if (data->is_process_pipe) {
errno = 0;
Expand Down

1 comment on commit 42d05a5

@naox
Copy link

@naox naox commented on 42d05a5 Jan 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consider this a regression. This should be OPTIONAL. Before that flock could be used to detect multiple running instances of file (like previous run did not complete yet) (provided that php did not crash and was not killed by kill -9)

$h55 = fopen($_SERVER['argv'][0],"r");
while(!flock($h55, LOCK_EX + LOCK_NB )) {
echo "no lock sleep(10)\n";
sleep(10);
}

or

$h55 = fopen($_SERVER['argv'][0],"r");
while(!flock($h55, LOCK_EX + LOCK_NB )) {
echo "no lock die\n";
die();
}

Please sign in to comment.