Git Product home page Git Product logo

Comments (6)

ohader avatar ohader commented on June 23, 2024

Thanks for reporting this. Is there a ticket in Drupal's issue tracker? I'm just trying to get some more scenario and context details. Anyway, I'll try to reproduce that behavior soonish.

That's the position that triggers the TypeError:
https://github.com/TYPO3/phar-stream-wrapper/blob/master/src/Phar/Reader.php#L109

If possible, please provide the version of phpstan.phar that has been used and a debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS ) in case $line === false.

from phar-stream-wrapper.

ohader avatar ohader commented on June 23, 2024

Okay... independent from PharStreamWrapper I could reproduce fgets resolving to false at the end of a file offset, without(!) having feof() === true. Basically I was reading 2-byte chunks from a total of 13 bytes. I was able to reproduce that on macOS with PHP 7.4, but not with PHP 8.0. Well...

I think it's fine to add an additional guard for this case. Still, finding out what really happens with phpstan.phar of course would be interesting.

from phar-stream-wrapper.

ohader avatar ohader commented on June 23, 2024

@mglaman Please let me know whether PR #70 fixes the issue for Drupal. Thx

from phar-stream-wrapper.

mglaman avatar mglaman commented on June 23, 2024

Sorry! I linked this GitHub issue to the Drupal issue, but not here to there. Drupal issue: https://www.drupal.org/project/upgrade_status/issues/3232011

from phar-stream-wrapper.

mglaman avatar mglaman commented on June 23, 2024

I was able to reproduce that on macOS with PHP 7.4, but not with PHP 8.0. Well...

I had PHP 8.0, locally maybe that's why I couldn't reproduce. I'll see if I can work the user to get a reproduction and more data.

from phar-stream-wrapper.

ohader avatar ohader commented on June 23, 2024

Let's have a look, when that actually happens - thus, when PHP has problems to read from a stream, without issuing feof.

https://github.com/php/php-src/blob/PHP-7.4.20/ext/standard/file.c#L1122-L1127

false is returned when underlying stream invocation returns null, let's have a look...

https://github.com/php/php-src/blob/PHP-7.4.20/main/streams/streams.c#L991-L996

null is returned nothing could be read from a stream (zero bytes copied to memory).


tl;dr: fgets($resource) returns false, when not a single byte could be read from a string, as indicated by variable total_copied.

I have not able to reproduce this behavior with DDEV and PHP 7.4.20 on macOS.

from phar-stream-wrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.