tsugiproject / tsugi

Tsugi Admin, Developer, and Management Console (pls join the dev list)
http://www.tsugi.org
Apache License 2.0
346 stars 257 forks source link

Fix for Deprecated: htmlentities(): Passing null to parameter : Issue #146 #147

Closed TurRil closed 2 years ago

TurRil commented 2 years ago

Fix for Issue 146:

Error shown on page:

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/tsugi/vendor/tsugi/lib/src/Util/U.php on line 53

PHP 8.1 deprecates these calls, it does not make them errors. The purpose of deprecation is to give authors advance notice to fix their code, so you and the authors of libraries you use have until PHP 9.0 comes out to fix things.

Fix is:

public static function htmlent_utf8($string) { return htmlentities($string ?? '',ENT_QUOTES,$encoding = 'UTF-8'); }

csev commented 2 years ago

Thanks. And thanks for testing on PHP 8.1.

csev commented 2 years ago

Thanks - I merged this.

Thanks for testing PHP 8.1 for us and finding the little things.

Are you otherwise running PHP 8.1 successfully?

/Chuck

On May 26, 2022, at 7:23 AM, TurRil @.***> wrote:

Fix for Issue 146:

Error shown on page:

Deprecated: htmlentities(): Passing null to parameter #1 https://github.com/tsugiproject/tsugi/issues/1 ($string) of type string is deprecated in /var/www/vhosts/tsugi/vendor/tsugi/lib/src/Util/U.php on line 53

PHP 8.1 deprecates these calls, it does not make them errors. The purpose of deprecation is to give authors advance notice to fix their code, so you and the authors of libraries you use have until PHP 9.0 comes out to fix things.

Fix is:

public static function htmlent_utf8($string) { return htmlentities($string ?? '',ENT_QUOTES,$encoding = 'UTF-8'); }

You can view, comment on, or merge this pull request online at:

https://github.com/tsugiproject/tsugi/pull/147 https://github.com/tsugiproject/tsugi/pull/147 Commit Summary

4fd7355 https://github.com/tsugiproject/tsugi/pull/147/commits/4fd7355e99699b49db1456f5eb6c56c598d7064c Fix for Deprecated: htmlentities(): Passing null to parameter : Issue #146 File Changes (1 file https://github.com/tsugiproject/tsugi/pull/147/files) M vendor/tsugi/lib/src/Util/U.php https://github.com/tsugiproject/tsugi/pull/147/files#diff-d35fe5cc729b1a45023eaebe3f47739ed4de7473ae22e1836b2d53c3dd542c9f (2) Patch Links:

https://github.com/tsugiproject/tsugi/pull/147.patch https://github.com/tsugiproject/tsugi/pull/147.patch https://github.com/tsugiproject/tsugi/pull/147.diff https://github.com/tsugiproject/tsugi/pull/147.diff — Reply to this email directly, view it on GitHub https://github.com/tsugiproject/tsugi/pull/147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEJJQ2SUKV5U6L6NKJEPTVL5NKVANCNFSM5XA4I2MA. You are receiving this because you are subscribed to this thread.

TurRil commented 2 years ago

Yes, we're running PHP 8.1 on Ubuntu 20.04. Everything is stable and all the tools are running smoothly.

Best, Corné

On Thu, 26 May 2022, 14:31 Charles Severance, @.***> wrote:

Thanks - I merged this.

Thanks for testing PHP 8.1 for us and finding the little things.

Are you otherwise running PHP 8.1 successfully?

/Chuck

On May 26, 2022, at 7:23 AM, TurRil @.***> wrote:

Fix for Issue 146:

Error shown on page:

Deprecated: htmlentities(): Passing null to parameter #1 < https://github.com/tsugiproject/tsugi/issues/1> ($string) of type string is deprecated in /var/www/vhosts/tsugi/vendor/tsugi/lib/src/Util/U.php on line 53

PHP 8.1 deprecates these calls, it does not make them errors. The purpose of deprecation is to give authors advance notice to fix their code, so you and the authors of libraries you use have until PHP 9.0 comes out to fix things.

Fix is:

public static function htmlent_utf8($string) { return htmlentities($string ?? '',ENT_QUOTES,$encoding = 'UTF-8'); }

You can view, comment on, or merge this pull request online at:

https://github.com/tsugiproject/tsugi/pull/147 < https://github.com/tsugiproject/tsugi/pull/147> Commit Summary

4fd7355 < https://github.com/tsugiproject/tsugi/pull/147/commits/4fd7355e99699b49db1456f5eb6c56c598d7064c> Fix for Deprecated: htmlentities(): Passing null to parameter : Issue #146 File Changes (1 file < https://github.com/tsugiproject/tsugi/pull/147/files>) M vendor/tsugi/lib/src/Util/U.php < https://github.com/tsugiproject/tsugi/pull/147/files#diff-d35fe5cc729b1a45023eaebe3f47739ed4de7473ae22e1836b2d53c3dd542c9f> (2) Patch Links:

https://github.com/tsugiproject/tsugi/pull/147.patch < https://github.com/tsugiproject/tsugi/pull/147.patch> https://github.com/tsugiproject/tsugi/pull/147.diff < https://github.com/tsugiproject/tsugi/pull/147.diff> — Reply to this email directly, view it on GitHub < https://github.com/tsugiproject/tsugi/pull/147>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAJEJJQ2SUKV5U6L6NKJEPTVL5NKVANCNFSM5XA4I2MA . You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHub https://github.com/tsugiproject/tsugi/pull/147#issuecomment-1138528222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC45WY4PMGJUWPBYWKQ7FTVL5VKFANCNFSM5XA4I2MA . You are receiving this because you authored the thread.Message ID: @.***>