ZF-10677: Zend_Pdf_StringParser uses PHP 5.2.5 escape sequences (eg. \f)

Description

Although " http://framework.zend.com/manual/en/… " states :

"Zend recommends the most current release of PHP [...], and currently supports PHP 5.2.4 or later."

it is not possible to use Zend_Pdf (Zend_Pdf_StringParser) with PHP 5.2.4.

The problem comes from special escape sequences introduced only in PHP 5.2.5 :

The "\f" escape sequence appears at several places in "Zend/Pdf/StringParser.php" and maybe elsewhere in the Zend_Pdf package.

My current specific problem is "startxref" that is truncated to "startxre" because "\f" is handled as "f".

I recommend using "\x0C" instead and still support PHP 5.2.4.

Thank you!

Comments

ZF-8791 solves te startxref issue, however errors relating this issue still exist.

The error I get loading a pdf file is:

An error occurred while processing a request (Zend_Pdf_Exception). Message: Argument must be numeric The error occurred in /var/www/versions/20110801-1205/library/Zend/Pdf/Element/Numeric.php at line 55. Trace: Zend_Pdf_Element_Numeric->__construct( 'alse' )

Apparently 'F' in 'False' is cut.

Proposed solution by Sylvain solves this issue. So replase all instances of \f by \x0C in Zend_Pdf_StringParser. The hack from #ZF-8791 that contains a phpversion check can be replaced.

Thank you so much for your hint Loek and Sylvain.