Skip to content

Another failure in FileMock #304

Open
JanTvrdik wants to merge 1 commit intonette:masterfrom
JanTvrdik:pr/file_mock_another_failure
Open

Another failure in FileMock #304
JanTvrdik wants to merge 1 commit intonette:masterfrom
JanTvrdik:pr/file_mock_another_failure

Conversation

@JanTvrdik
Copy link
Contributor

No description provided.

@JanTvrdik
Copy link
Contributor Author

Isolated to https://3v4l.org/gTXsR, seems like a PHP bug.

@milo milo force-pushed the master branch 2 times, most recently from 20198c1 to 1b583e9 Compare May 19, 2016 09:41
@dg dg force-pushed the master branch 2 times, most recently from 715ed4e to 334dc33 Compare January 4, 2017 14:23
@dg dg force-pushed the master branch 3 times, most recently from c7e8a12 to df5e87f Compare July 24, 2017 14:21
@dg dg force-pushed the master branch 2 times, most recently from b9711f5 to 3f273cf Compare June 7, 2018 11:24
@milo
Copy link
Member

milo commented Oct 10, 2018

@JanTvrdik I thought it has been solved but it's still failing on 3v4al.org. Did you report PHP bug? I can't find any open or solved.

@JanTvrdik
Copy link
Contributor Author

@milo I don't remember opening any bug so it's possible that it has never been reported.

@JanTvrdik
Copy link
Contributor Author

Just found in PHP documentation

If you have opened the file in append (a or a+) mode, any data you write to the file will always be appended, regardless of the file position, and the result of calling fseek() will be undefined.

@milo
Copy link
Member

milo commented Oct 10, 2018

But in doc of fopen()

a - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. In this mode, fseek() has no effect, writes are always appended.
a+ - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. In this mode, fseek() only affects the reading position, writes are always appended.

The a+ mode is about read/append. How would one can read.

I'll open PHP bug/doc issue.

@milo
Copy link
Member

milo commented Oct 10, 2018

Will see https://bugs.php.net/bug.php?id=76995

@milo
Copy link
Member

milo commented Oct 11, 2018

As I expected, it is a problem of lower layer. So, documentation issue.

Is a good idea to emit notice by FileMock::stream_seek() in a+ mode? IMHO yes, it may notice programmer about this clumsy behaviour.

@milo milo force-pushed the master branch 2 times, most recently from eaaeb7b to 7184606 Compare February 21, 2019 06:47
@dg dg force-pushed the master branch 2 times, most recently from ee525b7 to 6ca248e Compare February 27, 2019 13:34
@dg dg force-pushed the master branch 2 times, most recently from 55e4447 to ad2df9a Compare November 19, 2019 01:08
@dg dg force-pushed the master branch 4 times, most recently from 977e96a to dd5bc63 Compare October 15, 2020 20:09
@dg dg force-pushed the master branch 6 times, most recently from 4969211 to 81b3703 Compare November 2, 2020 17:30
@milo
Copy link
Member

milo commented Jan 5, 2021

Still buggy in PHP 8.0

@dg dg force-pushed the master branch 3 times, most recently from e3ff0e9 to cfedd76 Compare February 5, 2021 20:50
@dg dg force-pushed the master branch 3 times, most recently from cd207d6 to 8c3e2ef Compare March 1, 2021 15:23
@dg dg force-pushed the master branch 2 times, most recently from 6799278 to 8bac4c2 Compare November 24, 2021 10:36
@dg dg force-pushed the master branch 2 times, most recently from 8e93803 to 5774dce Compare March 24, 2022 18:58
@dg dg force-pushed the master branch 5 times, most recently from f2ca728 to b5fcdb3 Compare August 29, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants