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

A lot fo depreciated warrning on PHP 8 #49

Open
filmus22 opened this issue Aug 12, 2024 · 4 comments
Open

A lot fo depreciated warrning on PHP 8 #49

filmus22 opened this issue Aug 12, 2024 · 4 comments

Comments

@filmus22
Copy link

Hello Christian

I am testing your excellent pdftotext php script.
It works great and I managed to process some pdf file that no other script managed to process.
However, I do get a lot of warnings like these:

Deprecated function: Return type of PdfTexterCharacterMap::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7134 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterCharacterMap::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7134 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterUnicodeMap::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7191 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterUnicodeMap::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7191 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterUnicodeMap::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7191 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterEncodingMap::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7487 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterEncodingMap::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7487 of modules/contrib/david/includes/PdfToText.inc).

Deprecated function: Return type of PdfTexterEncodingMap::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 7487 of modules/contrib/david/includes/PdfToText.inc).

And many similar others...

I use php 8.2.4 under XAMPP
Will be grateful for any help

@filmus22
Copy link
Author

filmus22 commented Aug 13, 2024 via email

@filmus22
Copy link
Author

public function my_utf8_encode ($item){
return mb_convert_encoding($item, "UTF-8", mb_detect_encoding($item));
}

Solved the utf8_encode deprecated problem

@filmus22
Copy link
Author

I have fixes all the php 8.2 compatibility errors except this one:
Deprecated function: Automatic conversion of false to array is deprecated in PdfToText->__construct() (line 1585 of modules/contrib/david/includes/pdfToText.inc).

The class will still work with this error but will stop working in php 9.
Have no idea how to fix that as it depends on value of $ch
Will be grateful for any help

@filmus22
Copy link
Author

The original line is 1577 and the line is:
self::$CharacterClasses [ $ch ] = 0 ;

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

2 participants
@filmus22 and others