Needs review
Project:
PDF Stamper
Version:
6.x-1.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
7 Oct 2010 at 07:46 UTC
Updated:
12 Nov 2010 at 18:45 UTC
Each time there's a:
require_once('fpdi.php');
in this module (for example when clicking "submit" on a new node) I get:
"Fatal error: Class 'FPDF' not found in /Users/webchick/Sites/buzzy/sites/all/modules/pdfstamper/lib/FPDF_TPL/fpdf_tpl.php on line 20"
This seems to be because the latest verison of fpdi.php sub-classes off of fpdf.php, which isn't loaded yet.
By explicitly adding require_once('fpdf.php'); before each of these, it seems to work.
Here's a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| pdfstamper-fix-fatal-error.patch | 1.77 KB | webchick |
Comments
Comment #1
yasheshb commentedhi.
the problem is actually in fpdf_tpl.php. it's documented in the README_EXTERNAL_LIB_PLUGIN.txt
but the above patch supplied would fix the need for having a line hacked in fpdf_tpl.php. thoughts on what's the best way forward ?
i.e. either add a line to fpdf_tpl.php or add the require_once "fpdf.php" to the module code inspite of the module not using it directly
(it uses only FPDI class).
rgd.
yashesh
Comment #2
webchickHm. Yeah, I guess I did read that. For some reason it didn't register that that would be causing this problem. Maybe a sterner warning like "THIS MODULE WILL EXPLODE IN YOUR FACE IF YOU DON'T DO THIS" ;) would help. ;)
Personally, though, I think hacking third-party libraries should be avoided, especially when the fix is just a couple of one-liners. If future versions of these libraries come out for security reasons or whatever, we have to re-apply those hacks over and over. Same reason we tell people not to hack Drupal core and contributed modules.
I realize it's slightly more annoying for you as a module author to write two lines of code to import the libraries, but I think it's much better for the users of this module if this is handled transparently to them.
Comment #3
venuslabs commentedyeah. i subscribe to your point of view that for the end user it's beneficial to add the require_once for fpdf.php. i've applied the patch and modified the README file appropriately.
i'm not sure when it'll show up on the module page though - http://drupal.org/project/pdfstamper
thx.
yash
Comment #4
junedkazi commentedThe new changes will not show up if you don't enable the dev version or create a new version by adding a new tag to it.