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

Open
samijnih opened this Issue Sep 19, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@samijnih

samijnih commented Sep 19, 2015

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

@antecedent

This comment has been minimized.

Show comment
Hide comment
@antecedent

antecedent Oct 9, 2015

Owner

Hello,

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?

Owner

antecedent commented Oct 9, 2015

Hello,

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?

@samijnih

This comment has been minimized.

Show comment
Hide comment
@samijnih

samijnih Oct 10, 2015

Hello,

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

samijnih commented Oct 10, 2015

Hello,

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

antecedent added a commit that referenced this issue Oct 11, 2015

@bruno-barros

This comment has been minimized.

Show comment
Hide comment
@bruno-barros

bruno-barros Feb 4, 2016

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?

bruno-barros commented Feb 4, 2016

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?

@renatomefi renatomefi referenced this issue Dec 9, 2016

Merged

Fix bug with StreamProcessor::stream_lock #185

1 of 2 tasks complete

tstuttard added a commit to tstuttard/php-vcr that referenced this issue Aug 25, 2017

Merge branch 'master' into feature/composer-test
* 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 (#173)
@computamike

This comment has been minimized.

Show comment
Hide comment
@computamike

computamike Dec 20, 2017

Contributor

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)

Contributor

computamike commented Dec 20, 2017

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