When using `print_pdf_generate_path` (like mentioned in http://drupal.org/node/190173#pdf_via_mail) multiple times in the same request some notices are shown:

Notice: Constant DOMPDF_ENABLE_PHP already defined in _print_pdf_dompdf() (line 182 in ../sites/all/modules/contrib/print/print_pdf/print_pdf.pages.inc).

Simple fix would be to also check for if the constant is already defined:

// In function _print_pdf_dompdf, line 175
if (variable_get('print_pdf_autoconfig', PRINT_PDF_AUTOCONFIG_DEFAULT)) {
// should be
if (variable_get('print_pdf_autoconfig', PRINT_PDF_AUTOCONFIG_DEFAULT) && !defined('DOMPDF_ENABLE_PHP')) {

Comments

spyrosk’s picture

Version: 7.x-1.2 » 7.x-2.0-beta2
Priority: Normal » Major

I don't know if this should be in a separate ticket but we faced a similar issue with 7.x-2.0-beta2 that actually caused pathauto to stop working (no new aliases could be generated and the URL aliases configuration page was missing all content except for the "Save configuration" button).

These are the notices that were generated:

Notice: Constant PRINT_ROBOTS_NOARCHIVE_DEFAULT already defined in include_once() (line 40 of (...)/sites/all/modules/print/print.module).

The fix was to first check if the constant was defined before declaring it:

// original
define('PRINT_VIEW_MODE', 'print');
// fix
if (!defined('PRINT_VIEW_MODE'))
       define('PRINT_VIEW_MODE', 'print');
jcnventura’s picture

Status: Active » Fixed

@SpadXIII - thanks for the report. I have now fixed in git: http://drupalcode.org/project/print.git/commit/6a2c871

@spyrosk - huh? The only way those could happen is if in some weird way, the module code is being included TWICE. That should never ever happen. In this case, I'll do "as core does" and leave those defines as they are. If you still get those notices, check your code and make sure that you use include_once or require_once for the module files.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.