ZF-2996: ZF 1.5.0 breaks co-existance with external libs (domPDF)

Description

I have an application which relies heavily on generating PDF reports. I have chosen domPDF for the task (which is excellent BTW). Since upgrading to 1.5.0 the changes to Zend_Loader now seem to prevent use.

Example code to replicate issue:



require_once 'DomPDF/dompdf_config.inc.php';
require_once 'Zend/Loader.php';

Zend_Loader::registerAutoload();
spl_autoload_register('DOMPDF_autoload');

$pdf = new DOMPDF();

With 1.0.4 this works without any issues. The domPDF gets loads and the class is usable from within my application. Since upgrading to 1.5.0 I now get the following errors:


Warning: Zend_Loader::include_once(DOMPDF.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'DOMPDF.php' for inclusion (include_path='widgets/Macro4/Accounting/RunReport\;.;C:\php5\pear;..\ZendFramework\library;.\library;.\application\models;.\application\config;.\widgets') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once(Frame\Tree.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Frame\Tree.php' for inclusion (include_path='widgets/Macro4/Accounting/RunReport\;.;C:\php5\pear;..\ZendFramework\library;.\library;.\application\models;.\application\config;.\widgets') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once(Stylesheet.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Stylesheet.php' for inclusion (include_path='widgets/Macro4/Accounting/RunReport\;.;C:\php5\pear;..\ZendFramework\library;.\library;.\application\models;.\application\config;.\widgets') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ZendFramework\library\Zend\Loader.php on line 83

I use domPDF because I need to convert HTML to PDF. I accept the Zend_Loader has changed but is there a way to switch off the new behavior to allow the use of external libs that do not necessarily conform to the strict guidelines in ZF?

Cheers,

  • Robert

Comments

Please evaluate and assign as necessary.

Here is a patch for this issue

The patch works :-)

Many thanks ....

Will this be in the next release?

All the very best,

  • Robert

Hi,

How did you apply the patch? I am also receiving a similar error, which I think can be solved using this patch. Please help, regards, Current

######################My Error

Warning: include(Zend/Loader.php) [function.include]: failed to open stream: No such file or directory in /var/www/index.php on line 11

Warning: include() [function.include]: Failed opening 'Zend/Loader.php' for inclusion (include_path='.:./library:./application/models/:.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 11

Fatal error: Class 'Zend_Loader' not found in /var/www/index.php on line 12

#

@ current,

I think you issue is more with not have the Zend Framework specified in your PHP path.

e.g.

set_include_path(PS . '..' . DS . 'ZendFramework' . DS . 'library' . PS . '.' .DS . 'library' . PS . '.' .DS . 'application' . DS . 'models' . PS . get_include_path());

Hi,

Is there any chance that this tiny ickle patch could make it into 1.6.0? Pretty please :-)

Cheers, - Robert

Same problem here (ZF 1.6.2), this is my config:

bootstrap:

// Include path set_include_path( '.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . '../library/classes'
. PATH_SEPARATOR . '../library/functions'
. PATH_SEPARATOR . '../library/plugins'
. PATH_SEPARATOR . '/usr/local/lib/fw/php/phpzend-1.6.2/library' . PATH_SEPARATOR . '/usr/local/lib/dompdf/dompdf-0.5.1'
. PATH_SEPARATOR . get_include_path()
);

controller/action:

public function pdfAction() { // Include dompdf config file. require_once( "dompdf_config.inc.php" );

    // SPL register the DOMPDF loader so we can instantiate a new DOMPDF object.
    spl_autoload_register( "DOMPDF_autoload" );

   $objDomPdf = new DOMPDF();

   $objDomPdf->load_html( $strHtml );

   $objDomPdf->render();

   $objDomPdf->stream( "blah.pdf" );

}

And I got this warnings:

Warning: Zend_Loader::include_once(DOMPDF.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'DOMPDF.php' for inclusion (include_path='.:../library:../library/classes:../library/functions:../library/plugins:/usr/local/lib/fw/php/phpzend-1.6.2/library:/usr/local/lib/dompdf/dompdf-0.5.1:.:/usr/share/php:/usr/share/pear') in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once(Frame/Tree.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Frame/Tree.php' for inclusion (include_path='.:../library:../library/classes:../library/functions:../library/plugins:/usr/local/lib/fw/php/phpzend-1.6.2/library:/usr/local/lib/dompdf/dompdf-0.5.1:.:/usr/share/php:/usr/share/pear') in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once(Stylesheet.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Stylesheet.php' for inclusion (include_path='.:../library:../library/classes:../library/functions:../library/plugins:/usr/local/lib/fw/php/phpzend-1.6.2/library:/usr/local/lib/dompdf/dompdf-0.5.1:.:/usr/share/php:/usr/share/pear') in /usr/local/lib/fw/php/phpzend-1.6.2/library/Zend/Loader.php on line 83

Resolved in trunk with ZF-2923 fixes; will not release until 1.8.0.