thujohn / pdf-l4

Dompdf for Laravel 4
MIT License
228 stars 72 forks source link

Constants may only evaluate to scalar values #53

Open asanzred opened 10 years ago

asanzred commented 10 years ago

ErrorException

Constants may only evaluate to scalar values open: /var/sites/exactchange/vendor/thujohn/pdf/src/Thujohn/Pdf/Pdf.php

protected $orientation;
public function __construct(){
$_conf = array('DOMPDF_TEMP_DIR', 'DOMPDF_UNICODE_ENABLED', 'DOMPDF_PDF_BACKEND', 'DOMPDF_DEFAULT_MEDIA_TYPE', 'DOMPDF_DEFAULT_PAPER_SIZE', 'DOMPDF_DEFAULT_FONT', 'DOMPDF_DPI', 'DOMPDF_ENABLE_PHP', 'DOMPDF_ENABLE_REMOTE', 'DOMPDF_ENABLE_CSS_FLOAT', 'DOMPDF_ENABLE_JAVASCRIPT', 'DEBUGPNG', 'DEBUGKEEPTEMP', 'DEBUGCSS', 'DEBUG_LAYOUT', 'DEBUG_LAYOUT_LINES', 'DEBUG_LAYOUT_BLOCKS', 'DEBUG_LAYOUT_INLINE', 'DOMPDF_FONT_HEIGHT_RATIO', 'DEBUG_LAYOUT_PADDINGBOX', 'DOMPDF_ENABLE_HTML5PARSER', 'DOMPDF_ENABLE_FONTSUBSETTING', 'DOMPDF_ADMIN_USERNAME', 'DOMPDF_ADMIN_PASSWORD');
foreach ($_conf as $conf){
if ((Config::has('pdf::'.$conf) || Config::get('pdf::'.$conf)) && !defined($conf))
define($conf, Config::get('pdf::'.$conf));
}
thujohn commented 10 years ago

What value did you change in the config ?

asanzred commented 10 years ago

Nothing, just installed on my laravel project with composer

Raywin88 commented 10 years ago

I have this problem too, exactly same. But there is no problem for the WAMP. Any solution here? because of i using share host ?

My php version is 5.4.29

craigmccreath commented 9 years ago

I noticed this happened to me after installing with composer, but forgetting to add Thujohn\Pdf\PdfServiceProvider to the list of providers in app/config/app.php.

This happens as since Laravel doesn't have access to the config values, it returns an empty array which it attempts to define.