New PDFlib extension for PHP5

php.internals

Rainer Schaaf

22 years ago
Hello, I'm maintaining the PDFlib wrapper code for the "pdf" extenions of PHP. I did a major rewrite of the wrapper for PDFlib 6 and PHP 5 and wanted to ask whether it is good idea to check in this code now (short before the release of PHP 5). My idea is to add this new Wrappercode as an extra module and keep the existing wrapper code for peoples using the old PDFlib 4 version. This is necessary because there are incompatible changes between PDFlib 4 and 5 which made a new wrapper module necessary. Here the details about the new wrapper code: This PDFlib Wrapper Code works with PDFlib 5 and higher. A new module was introduced, as PDFlib 5 supports a method to handle the special returnvalues needed for PHP in the PDFlib core now. This is necessary, as the new concept of optionlists in PDFlib allows to pass handles to PDFlib objects and filenames inside of optionlists. Before the wrapper added some offset to handles returned by PDFlib to fit into scheme used by php to return 0 in case of errors, whereas in PDFlib the errorcode is -1 and "0" is a valid handle. As the optionlist may contain filenames on various places the VIRTUAL_DIR support and the CHECK_OPEN_BASEDIR checks implemented in the wrapper will not work reliable too. So VIRTUAL_DIR support and the CHECK_OPEN_BASEDIR checking is disabled here too, as it would only work for some of the files used with PDFlib. The main changes: - only official PDFlib API's are included (exception pdf_open_memory_image) - supports PDFlib 5 and PDFlib 6 - builds with older PHP Version too (tested with PHP 4.1.0, 4.2.1, 4.3.0, and 5.0.0RC2.) - adds an Object Oriented API to PDFlib (for PHP 5 only) - uses PHP exceptions (for PHP 5 only) - disables VIRTUAL_DIR support (use SerachPath instead) - disables CHECK_OPEN_BASEDIR checks - changed old API's with varargs to only accept all args now I think it is worth to include this now, so that PHP5 comes with this new code, but I wanted to discuss this first.
-- Best regards, Rainer Schaaf rjs@pdflib.com http://www.pdflib.com Personalize PDF: PDFlib Personalization Server and Block plugin _______PDFlib - a library for generating PDF on the fly________

Wez Furlong

22 years ago
Hello Rainer, A few of us have been planning to move the pdflib extension into PECL (http://pecl.php.net) for a little while now; it sounds like an excellent time to make this move, because it will allow you to make supplemental releases outside of the PHP 5 core release cycle. Here is a possible release plan: 1/ Move the current code into PECL 2/ Make a release (so that people may choose to use the code they are used to) 3/ Merge your new code and bump the extension version to the next major (eg: from 1.x to 2.0) 4/ Make a release 5/ Update and make additional releases whenever you like How does that sound to you?
> - disables VIRTUAL_DIR support (use SerachPath instead) > - disables CHECK_OPEN_BASEDIR checks
This doesn't sound too hot for shared hosters. --Wez.