-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
(php 8.2) Function utf8_encode() is deprecated in PHPOffice/PhpWord/Shared/Text.php on line 139 #2370
Labels
Milestone
Comments
Well if it helps someone, in the end I have solved it like this
If this is not the correct solution, let me know. |
This is still an issue. Should we fork the repo? PHP8 is pushing us to fork too many repos really. |
Or like this /**
* @param string $subject
*
* @return string
*/
protected static function ensureUtf8Encoded($subject)
{
if (!Text::isUTF8($subject) && null !== $subject) {
$subject = mb_convert_encoding($subject, 'UTF-8', mb_list_encodings());
}
return (null !== $subject) ? $subject : '';
} |
The suggested changes as per this pull request at #2447 seem to resolve the PHP 8.2 issues for utf8_encode. Still needs some more testing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deprecated: Function utf8_encode() is deprecated in .../PHPOffice/PhpWord/Shared/Text.php on line 139
The original code is this
and the code that I have used to solve it is the following
The error disappears but when generating the word it breaks and does not open, appears blank.
Any solution?
The text was updated successfully, but these errors were encountered: