Open filmus22 opened 3 months ago
Hi
Thanks for your detailed reply I am updating most of the functions now Still remains Deprecated function: Function utf8_encode() is deprecated in PdfToText->__get_character_padding() (line 5872 of modules/contrib/david/includes/pdfToText.inc). Many warnings about utf8_encode
Any chance you will add a php 8 version?
Regards
Carmel
On Tue, 13 Aug 2024 at 08:33, camrionnvmff @.***> wrote:
Mainly because PHP 8 has stricter requirements for the return types of some interface methods. If a class implements certain interfaces (such as ArrayAccess, Countable, etc.), the return type of the method must match the interface definition.
resolvent Update the return type of the method: You can add the correct return type in the method of the class to comply with PHP 8 requirements. For example: class PdfTexterCharacterMap implements ArrayAccess { //Modify the offsetSet method public function offsetSet($offset, $value): void { //Method body }
//Modify the offsetUnset method public function offsetUnset($offset): void { //Method body } } Other methods such as offsetExists and offsetGet also require similar modifications to ensure that their return types are consistent with the interface definition.
Alternatively, you can use ServBay to redeploy the PHP8 environment, which is more convenient to solve.
— Reply to this email directly, view it on GitHub https://github.com/christian-vigh-phpclasses/PdfToText/issues/49#issuecomment-2285371763, or unsubscribe https://github.com/notifications/unsubscribe-auth/BII7TVN5AEB6ABMTTS2IKTTZRGLBPAVCNFSM6AAAAABMLWGUK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBVGM3TCNZWGM . You are receiving this because you authored the thread.Message ID: @.***>
public function my_utf8_encode ($item){ return mb_convert_encoding($item, "UTF-8", mb_detect_encoding($item)); }
Solved the utf8_encode deprecated problem
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
The original line is 1577 and the line is: self::$CharacterClasses [ $ch ] = 0 ;
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