PHPExcel Urgent: SetTitle does not work on PHP 5.4.0beta1

2012年12月23日 发表评论 阅读评论

Fatal error: Uncaught exception ‘LogicException’ with message ‘In the constructor of PHPExcel_WorksheetIterator, parent::__construct() must be called and its exceptions cannot be cleared’ in F:\wamp\www\ops2.0\PHPExcel.php:515 Stack trace: #0 F:\wamp\www\ops2.0\PHPExcel.php(515): PHPExcel_WorksheetIterator->internal_construction_wrapper(Object(PHPExcel)) #1 F:\wamp\www\ops2.0\PHPExcel\ReferenceHelper.php(530): PHPExcel->getWorksheetIterator() #2 F:\wamp\www\ops2.0\PHPExcel\Worksheet.php(693): PHPExcel_ReferenceHelper->updateNamedFormulas(Object(PHPExcel), ‘Worksheet’, ‘???????????????…’) #3 F:\wamp\www\ops2.0\actions\manage\export_domain_all.php(31): PHPExcel_Worksheet->setTitle(‘???????????????…’) #4 F:\wamp\www\ops2.0\actions\manage\export_domain_all.php(111): export_domain_excel() #5 {main} thrown in F:\wamp\www\ops2.0\PHPExcel.php on line 515


I manged to make it work again, but the generated Excel spreadsheet is corrupted. To make it run under PHP 5.4.0beta1 you have to modify the PHPExcel_WorksheetIterator class. Currently, it extends the CachingIterator which constructor has been changed in the PHP beta. To make the code run, you can change the class definition to: “implements Iterator” instead of “extends CachingIterator”.

就是将 extends CachingIterator 替换成 implements Iterator就OK了!

转载请注明来自:[MSN Spaces]

  1. 本文目前尚无任何评论.