Zend Framework

Zend_Pdf_Page has fatal errors when used due to bad dependencies

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.4
  • Fix Version/s: 1.9.6
  • Component/s: Zend_Pdf
  • Labels:
    None

Description

If Zend_Pdf_Page is used on its own (e.g. to access Zend_Pdf_Page::SIZE_A4), a fatal error occurs:

Fatal error: Cannot redeclare class zend_pdf_resource_font in /xxxx/Zend/Pdf/Resource/Font.php on line 40

This is solved, for me, by either:

1) Stripping all require_once's and relying on autoloader (good for performance, but this is not the way most people will use it in the beginning, or necessarily on their development servers)

2) Adding the following line at the top of Zend_Pdf_Page before other require statements:

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
/** Zend_Pdf_Font */
require_once 'Zend/Pdf/Font.php';

3) Using Zend_Pdf before accessing the constants of Zend_Pdf_Page (not ideal)

Since I rely on autoloading, I'm not fully sure if my solution #2 would solve the issue in all cases, but I think trying to fix the underlying problem would be a good idea.

Activity

Hide
Ondrej Flidr added a comment -

Solution #2 works for me (ZF 1.9.4)

Show
Ondrej Flidr added a comment - Solution #2 works for me (ZF 1.9.4)
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Do you have any code to reproduce this issue?

Show
Dolf Schimmel (Freeaqingme) added a comment - Do you have any code to reproduce this issue?
Hide
Travis Pew added a comment -

Sure, just call:

var_dump(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);

at the top of any view script before you've accessed Zend_Pdf

Show
Travis Pew added a comment - Sure, just call:
var_dump(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
at the top of any view script before you've accessed Zend_Pdf
Hide
Alexander Veremyev added a comment -

Fixed.

Show
Alexander Veremyev added a comment - Fixed.

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: