Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flock(): Illegal operation argument #27

samijnih opened this issue Sep 19, 2015 · 4 comments

flock(): Illegal operation argument #27

samijnih opened this issue Sep 19, 2015 · 4 comments


Copy link

ErrorException in Stream.php line 176: flock(): Illegal operation argument

  1. in Stream.php line 176
  2. at HandleExceptions->handleError('2', 'flock(): Illegal operation argument', '/Applications/AMPPS/www/inMindBO/vendor/antecedent/patchwork/src/Preprocessor/Stream.php', '176', array('operation' => '0'))
  3. at flock(resource, '0') in Stream.php line 176
  4. at Stream->stream_lock('0')

I can fix this error by setting LOCK_EX

Copy link


I assume you get this by calling flock() from your own code. If so, which $operation do you use when it is not LOCK_EX? Perhaps you are missing the second argument of flock(), which is mandatory?

Copy link


I never called flock from my own code (or the Laravel framework does it for me) but I fixed it by always setting the LOCK_EX constant

Copy link

I use this lib on WordPress instalations. After update to 1.4 the language system is broken.
For now, I need to steek on 1.3.*

Any help on it?

tstuttard added a commit to tstuttard/php-vcr that referenced this issue Aug 25, 2017
* master:
  Fix logo image
  Travis: skip phpcs in case of integration tests
  stream_lock operation can use strict type checking when it's 0
  PHP 7.1: Fixed issue with php-cs-fixer
  Fix bug with StreamProcessor::stream_lock explained here antecedent/patchwork#27
  Test php 7.1
  test for setting post method when CURLOPT_POSTFIELDS set
  Adds github pull request template
  Set POST method when CURLOPT_POSTFIELDS is set
  Fix parallel cURL requests:  - Make sure all handles are inside an array so they can be removed properly when done  - Remove handle as soon as done  - Fix behaviour of curl_multi_exec to return last curl info  - Also fix test, check for the second to last curl info and make sure the third returns false, not the second  - CS fixes
  php-cs-fixer introduced (php-vcr#173)
Copy link

I have found a similar issue with flock on line 192 - the issue manifested because - somehow - this module conflicts with the php codesniffer module.

The main issue seems to be that the stream_lock method assumes that the $operation parameter is going to be a string representation of operation - which is strange because the operation constants should theoretically be available. What I found was that checking the numerical equivalent resolved the issue - however stream_lock doesn't seem to be validating the operation.

I'll check this out when I get to the office tomorrow - but I think the internals of this function could pass in operation as an integer, and that would allow consumers to call it using more appropriate methods - for example stream_lock(LOCK_EX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

4 participants