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

vendor/masnathan/odtphp deprecation warnings with php 8.3 #385

Open
jeffallen opened this issue Jul 17, 2024 · 5 comments
Open

vendor/masnathan/odtphp deprecation warnings with php 8.3 #385

jeffallen opened this issue Jul 17, 2024 · 5 comments

Comments

@jeffallen
Copy link

jeffallen commented Jul 17, 2024

When I try to generate a PO, I get these warnings:

 Deprecated: Function utf8_encode() is deprecated in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/Odf.php on line 112

Deprecated: Return type of Odtphp\Segment::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/Segment.php on line 87

Deprecated: Return type of Odtphp\Segment::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/Segment.php on line 77

Deprecated: Return type of Odtphp\SegmentIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 31

Deprecated: Return type of Odtphp\SegmentIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 41

Deprecated: Return type of Odtphp\SegmentIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 36

Deprecated: Return type of Odtphp\SegmentIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 61

Deprecated: Return type of Odtphp\SegmentIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 46

Deprecated: Return type of Odtphp\SegmentIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 51

Deprecated: Return type of Odtphp\SegmentIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 56

Deprecated: Creation of dynamic property Odtphp\SegmentIterator::$keys is deprecated in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/SegmentIterator.php on line 28

Deprecated: Function utf8_encode() is deprecated in /var/www/glpi/plugins/order/vendor/masnathan/odtphp/src/Odf.php on line 112

This comes from https://github.com/TECLIB/odtphp apparently.

@jeffallen
Copy link
Author

I was able to solve this problem by adding display_errors=off in my php.ini, but that's a sledgehammer.

I would prefer to see https://github.com/TECLIB/odtphp get fixed.

@trasher
Copy link
Contributor

trasher commented Aug 5, 2024

I would prefer to see https://github.com/TECLIB/odtphp get fixed.

Unfortunately, original lib is not maintained for years, I do not think we will fix this fork. The best solution would be to replace that lib with another one that is still supported (phpspreadshirt has been included as part of GLPI 11, it's certainly the best option).

Adapting whole PHP configuration for such issues is most of the time not a good solution (but that's up to you).

@jeffallen
Copy link
Author

OK, understood that this is fixed in GLPI 11.

Where can I find out more about GLPI 11 and follow it's schedule and release?

@trasher
Copy link
Contributor

trasher commented Aug 5, 2024

This is not fixed in GLPI 11.

I just mean there is already another ODT export lib included, so plugin should use the same.

@trasher trasher reopened this Aug 5, 2024
@sboden
Copy link

sboden commented Dec 24, 2024

In the meantime I released a version of odtphp which is compatible with PHP 8.x. I needed it for my own projects.

It's at https://github.com/sboden/odtphp. I started from cybermonde/odtphp, but most if not all of the TECLIB changes are included.

sboden/odtphp has some phpunit test cases and is phpcs warning free.

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

No branches or pull requests

3 participants