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

Error: fwrite(): Passing null to parameter #2 ($data) of type string is deprecated #19712

Closed
impayru opened this issue Dec 9, 2022 · 2 comments
Labels
Milestone

Comments

@impayru
Copy link
Contributor

impayru commented Dec 9, 2022

What steps will reproduce the problem?

yii asset assets.php config/assets-prod.php

What is the expected result?

out js

What do you get instead?

Error: fwrite(): Passing null to parameter #2 ($data) of type string is deprecated

Additional info

In the file vendor\yiisoft\yii2\console\controllers\AssetController.php 518
call is used
$this->stdout(shell_exec(strtr($this->jsCompressor, [
'{from}' => escapeshellarg($tmpFile),
'{to}' => escapeshellarg($outputFile),
])));
shell_exec returns null for line in assets.php 'jsCompressor' => 'uglifyjs {from} -m -o {to}',
this throws an error Error: fwrite(): Passing null to parameter #2 ($data) of type string is deprecated

Q A
Yii version 2.0.47
PHP version 8.1.13
Operating system Windows
@impayru
Copy link
Contributor Author

impayru commented Dec 9, 2022

patch:

-            $this->stdout(shell_exec(strtr($this->jsCompressor, [
+            $this->stdout((string)shell_exec(strtr($this->jsCompressor, [

@samdark samdark added the php8 label Dec 10, 2022
@samdark samdark added this to the 2.0.48 milestone Dec 10, 2022
@samdark
Copy link
Member

samdark commented Dec 10, 2022

Would you please prepare a pull request? Thanks.

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

No branches or pull requests

2 participants