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

[Console] Fix OutputStream for PHP 7.4 #36222

Merged
merged 1 commit into from Mar 27, 2020

Conversation

guillbdx
Copy link

@guillbdx guillbdx commented Mar 26, 2020

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #36166
License MIT

From PHP 7.4, fwrite function now returns false for any failure: https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.fread-fwrite

Actually, the note in the PHP documentation is not exact: for PHP 7.3 and lower, fwrite function did return false when arguments passed in to the function were invalid, and 0 for other failures. From PHP 7.4, it returns false for any failure.
We can see it in the source code: for PHP 7.3: https://github.com/php/php-src/blob/a1a8d144854acb1c891cf0c21abb0f612b1d8de7/ext/standard/file.c#L1140
Compare to PHP 7.4: https://github.com/php/php-src/blob/master/ext/standard/file.c#L1136

I update OutputStream::doWrite() to keep the same behavior as before.

@nicolas-grekas nicolas-grekas changed the title [Console] Fix OutputSream for PHP 7.4 [Console] Fix OutputStream for PHP 7.4 Mar 26, 2020
@@ -70,14 +69,12 @@ public function getStream()
*/
protected function doWrite($message, $newline)
{
$message = (string) $message;
Copy link
Member

Choose a reason for hiding this comment

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

It's not related to the fix, I'm going to revert this change while merging the PR.

@fabpot fabpot force-pushed the console-fix-outputsream-php-7.4 branch from 8f9d015 to b375f93 Compare March 27, 2020 17:07
@fabpot
Copy link
Member

fabpot commented Mar 27, 2020

Thank you @guillbdx.

@fabpot fabpot merged commit b928089 into symfony:3.4 Mar 27, 2020
This was referenced Mar 30, 2020
@HarasimowiczKamil
Copy link

HarasimowiczKamil commented Apr 7, 2020

@guillbdx @fabpot Is there a chance to merge it to 4.3?

@xabbuh
Copy link
Member

xabbuh commented Apr 12, 2020

@HarasimowiczKamil Symfony 4.3 does not receive bugfixes anymore (see https://symfony.com/releases/4.3).

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

Successfully merging this pull request may close these issues.

None yet

7 participants