|  | 
  Aryan Schmitz - 2016-12-14 11:02:31Hi Christian,
 Running PdfToText version 1.3.7 on PHP version 5.2.4 I had PHP errors on line 2157 and on line 3995. After a small change it seems ok.
 
 on line 2157 I changed:
 if  ( $current_font_size )
 to
 if  ( $current_font_size > 0)
 
 and on line 3995  I changed:
 implements	\ArrayAccess, \Countable
 to
 implements	ArrayAccess, Countable
 
 I don’t know if my fix for line 3995 does not break something but at least the class seems to work ok this way.
 
 With best regards
 Aryan
  Christian Vigh - 2016-12-14 11:29:53 - In reply to message 1 from Aryan SchmitzHello Aryan,
 many thanks for your reporting.
 
 Regarding line 2157, I don't know what happens. It seems that the $current_font_size variable contains either a negative value or a non-numeric value. I update the source according to your change however, I would be curious to check if it does not come from a bug in my code located in another place. Would it be possible to send me a sample PDF file whose processing generates such an error ?
 
 Regarding line 3995, my fault ; I have two versions of the PdfToText class, one which is integrated in my own framework, Thrak (https://github.com/christian-vigh/thrak) and one that I'm packing only to publish it as a standalone class on phpclasses.org. The notation "implements \someinterface" became usable starting from PHP 5.3 (or 5.2.x?). Before that, you could not indicate that the interface was located in the root namespace, and php was bailing when it encountered a leading backslash a class name (keyword "extends") or an interface name (keyword "implements").
 
 During my last Winmerge session between my two versions of PdfToText, there were so many small modifications elsewhere in the code that I mistakenly validated this update. Will try to pay better attention next time !
 
 With kind regards,
 Christian.
  Aryan Schmitz - 2016-12-14 12:13:22 - In reply to message 2 from Christian VighDear Christian,
 Thank you for your prompt reply.
 
 I think $current_font_size is 0 because I get
 Warning: Division by zero in ………/PdfToText.phpclass on line 2158
 without the $current_font_size>0
 
 I get int(0)
 when I put:
 echo $current_font_size;
 var_dump( $current_font_size);
 right after
 if  ( $current_font_size )
 
 I ‘ll send you the PDF file too :-)
 
 Best regards
 Aryan
  Christian Vigh - 2016-12-14 12:44:36 - In reply to message 3 from Aryan SchmitzHello Aryan,
 Thanks for the sample ! there was indeed a problem that was due to the fact that some font specifiers in your sample were using a dot in their name (eg, "/F1.0" where I expected "/F1_0"). This stupidly caused the current font size to be set to a dot instead of the number just after the specifier. Hence the division by zero.
 
 I made a fix which will be available in version 1.3.8 ; meanwhile, you can keep the correction you made in version 1.3.7, it should not affect the output of the PdfToText class.
 
 Christian.
  Aryan Schmitz - 2016-12-14 13:44:52 - In reply to message 4 from Christian VighHello Christian,
 Thank you. I had assumed differences in the way zero/null values are treated between PHP versions was causing this.
 
 Glad my PDF file could help you finding the source of the issue :-)
 
 /Aryan
 
  Aryan Schmitz - 2016-12-27 14:07:49 - In reply to message 5 from Aryan SchmitzHello Christian,
 Seems I’ve forgotten to mention that there also is/was another issue  causing an fatal error on line 90.
 
 I “fixed" it by replacing:
 abstract class  PdfObjectBase		extends  Object
 
 with:
 abstract class  PdfObjectBase		//extends  Object
 
 and the class seems to work without any issues but I’m not sure if that does not mess up anything else.
 
 With season's greetings and best wishes for 2017!
 Aryan
 
  Aryan Schmitz - 2016-12-27 14:07:54 - In reply to message 5 from Aryan SchmitzHello Christian,
 Seems I’ve forgotten to mention that there also is/was another issue  causing an fatal error on line 90.
 
 I “fixed" it by replacing:
 abstract class  PdfObjectBase		extends  Object
 
 with:
 abstract class  PdfObjectBase		//extends  Object
 
 and the class seems to work without any issues but I’m not sure if that does not mess up anything else.
 
 With season's greetings and best wishes for 2017!
 Aryan
 
  Christian Vigh - 2016-12-27 19:30:00 - In reply to message 7 from Aryan SchmitzHello Aryan,
 it seems you were unlucky : you downloaded the "first" version 1.3.8 that existed only for a few hours ; It contained two mods that should have remained in my framework, but I mistakenly reported them in the phpclasses version.
 
 I've corrected that since them, so if you download the class again, everything should be ok.
  Aryan Schmitz - 2016-12-27 21:25:30 - In reply to message 8 from Christian VighHello Christian,
 Thank you and I can confirm that it worked when I downloaded the class again.
 
 Best regards
 Aryan
 |