[FIXED] __autoload issue when using DOMpdf |
[eluser]Ñuño Martínez[/eluser]
Hello. I'm trying to create a document with DOMpdf but I have a problem with the __autoload stuff. DOMpdf tryes to autoload file "ci_db.cls.php", which obviously doesn't exists because it auto-builds the filename from CodeIgniter's CI_DB class. I've deleted the __autoload stuff from dompdf_config.inc.php file but then PHP says it can't find the DOMPDF class. How can I avoid to autoload any "autoloadable CodeIgniter's class"?
[eluser]Dam1an[/eluser]
Can you not just manually include the files needed by domPDF?
[eluser]Ñuño Martínez[/eluser]
It's a solution but seems like DOMpdf uses __autoload to load all the files, and there are some of them. Does somebody know a workaround?
[eluser]Dam1an[/eluser]
Quote:How can I avoid to autoload any “autoloadable CodeIgniter’s class”?Are you afraid of CI trying to use __autoload, and it failing to find the correct files? If I remember correctly, __autoload shouldn't be called for CI stuff, assuming you've loaded it yourself Alternativly, if all domPDF have a common prefix/suffix, just search for this in __autoload
[eluser]Ñuño Martínez[/eluser]
Actually I'm not using __autoload. Actually I have no idea how does it works. I have no idea where it's used. I only know it's a "magic" funcion because it has the "__" prefix and because GVim highlights it as a keyword. DOMpdf defines an __autoload function if it doesn't exists, this way: Code: /** Then "somewhere" it calls "__autoload ('CI_DB');". AFAIK 'CI_DB' is a CodeIgniter's class, but since __autoload is defined by DOMpdf it tryes to load "ci_db.class.pdf" at the DOMpdf's directory. If I delete the __autoload definition then it doesn't loads any of the DOMpdf's files. There are a lot (I've added 18 "require_once" on my source and it still saying I need more...) so it's not a good solution. I want to know how to prevent that.
[eluser]TheFuzzy0ne[/eluser]
Please add the closing [/code] tag to your post above, as it's breaking the forum.
[eluser]Dam1an[/eluser]
Do you use CI autoloading to load the database library? Maybe domPDF is trying to __autoload before CI manages to load it
[eluser]Ñuño Martínez[/eluser]
[quote author="Dam1an" date="1241018643"]Do you use CI autoloading to load the database library? Maybe domPDF is trying to __autoload before CI manages to load it[/quote] No, I don't. Actually I'm using ADODB because I find it more comfortable. BTW I did look at CI's autoload.php file and all arrays are empty. And as I've said I never used __autoload in my life. I'm getting ill with this.
[eluser]Ñuño Martínez[/eluser]
I've fixed it. It was so easy I feel as stupid because I didn't think that before. Just modify function DOMPDF_autoload at dompdf_config.inc.php: Code: function DOMPDF_autoload($class) { Of course that would introduce new problems if using __autoload to load CI's classes but that is other problem. :p
[eluser]wiredesignz[/eluser]
Code: /* don't autoload CI_ or subclass prefixed classes */ |
Welcome Guest, Not a member yet? Register Sign In |