Skip to content

Commit 94ea334

Browse files
committed
Prevent problems with PDFlib 3.00 when setting the imagewarning parameter.
# I don't know if this is in later minors of PDF 3.x; someone please check!
1 parent c3106f4 commit 94ea334

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/pdf/pdf.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ static int le_gd;
6060
static int le_pdf;
6161

6262
/* {{{ constants
63-
/*
6463
* to adopt the php way of error handling to PDFlib
6564
* The image related functions in PDFlib return -1 on error
6665
* but they may return 0 (FALSE) in normal cases
@@ -487,8 +486,9 @@ PHP_FUNCTION(pdf_open)
487486
} else {
488487
PDF_open_mem(pdf, pdf_flushwrite);
489488
}
490-
489+
#if (PDFLIB_MAJORVERSION >= 4)
491490
PDF_set_parameter(pdf, "imagewarning", "true");
491+
#endif
492492
PDF_set_parameter(pdf, "binding", "PHP");
493493

494494
ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);
@@ -2226,7 +2226,9 @@ PHP_FUNCTION(pdf_new) {
22262226
PDF *pdf;
22272227

22282228
pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);
2229+
#if (PDFLIB_MAJORVERSION >= 4)
22292230
PDF_set_parameter(pdf, "imagewarning", "true");
2231+
#endif
22302232
PDF_set_parameter(pdf, "binding", "PHP");
22312233

22322234
ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);

0 commit comments

Comments
 (0)