Error using PDF Viewer

Permalink Browser Info Environment
When trying to link the PDF Viewer to a file it is failing and returning the following error:

Use of undefined constant external_url - assumed 'external_url' (this will throw an Error in a future version of PHP)

Details

/srv/sites/longdendale/www/packages/pdf_viewer/blocks/pdf_viewer/controller.php(44): Whoops\Exception\ErrorException->null
/srv/sites/longdendale/www/packages/pdf_viewer/blocks/pdf_viewer/controller.php(44): Whoops\Run->handleError
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/controllers/dialog/block/edit.php(39): Concrete\Package\PdfViewer\Block\PdfViewer\Controller->validate
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/controllers/dialog/block/edit.php(51): Concrete\Controller\Dialog\Block\Edit->validateBlock
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Controller/AbstractController.php(294): Concrete\Controller\Dialog\Block\Edit->submit
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Controller/AbstractController.php(294): null->call_user_func_array
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Routing/ControllerRouteAction.php(61): Concrete\Core\Controller\AbstractController->runAction
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/RouteDispatcher.php(37): Concrete\Core\Routing\ControllerRouteAction->execute
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/DispatcherDelegate.php(39): Concrete\Core\Http\RouteDispatcher->dispatch
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareStack.php(86): Concrete\Core\Http\Middleware\DispatcherDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/DefaultDispatcher.php(126): Concrete\Core\Http\Middleware\MiddlewareStack->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/DefaultDispatcher.php(58): Concrete\Core\Http\DefaultDispatcher->handleDispatch
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/DispatcherDelegate.php(39): Concrete\Core\Http\DefaultDispatcher->dispatch
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/ThumbnailMiddleware.php(76): Concrete\Core\Http\Middleware\DispatcherDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\ThumbnailMiddleware->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/FrameOptionsMiddleware.php(39): Concrete\Core\Http\Middleware\MiddlewareDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\FrameOptionsMiddleware->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/CookieMiddleware.php(35): Concrete\Core\Http\Middleware\MiddlewareDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\CookieMiddleware->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/ApplicationMiddleware.php(29): Concrete\Core\Http\Middleware\MiddlewareDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\ApplicationMiddleware->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/Middleware/MiddlewareStack.php(86): Concrete\Core\Http\Middleware\MiddlewareDelegate->next
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Http/DefaultServer.php(85): Concrete\Core\Http\Middleware\MiddlewareStack->process
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Foundation/Runtime/Run/DefaultRunner.php(119): Concrete\Core\Http\DefaultServer->handleRequest
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/src/Foundation/Runtime/DefaultRuntime.php(102): Concrete\Core\Foundation\Runtime\Run\DefaultRunner->run
/srv/sites/longdendale/www/updates/concrete5-8.5.1/concrete/dispatcher.php(36): Concrete\Core\Foundation\Runtime\DefaultRuntime->run
/srv/sites/longdendale/www/concrete/bootstrap/configure.php(55): null->require
/srv/sites/longdendale/www/concrete/dispatcher.php(13): null->require
/srv/sites/longdendale/www/index.php(3): null->require

This black has been used on multiple occasions and has now started throwing an error.

Pelase can further direction be given.

Type: Discussion
Status: In Progress
creativestudiofrog
View Replies:
geotex replied on at Permalink Reply
geotex
Update: I am running php 7.3.7 and Concrete5-8.5.1 and found that I cannot clear cash on this version of PHP, I get fatal errors. Dropping back to 7.1/x seems tp a;;ow the errors to clear.

I don't know if the author is still even around, as nothing until your post for 2 years. I have the same issue. The error shows with PHP 7.2.x and 7.3.x

I have 2 sites currently using PHP 7.3.7.
If you have cPanel, here is a work around.
Open cpanel, Under Software, you should find PHP Manager. Set the version for your site back to php 7.1.x or earlier.
You probably will want to clear cache before changing the php version as refresh may take several tries before updating the site in your browser.

install the pdf files in pdf viewer and publish the page.
After verifying that the update was successful, clear cache
Then, you can go back to 7.3 and all should work. At least it does for me on both sites that were affected.
tipweb replied on at Permalink Reply
tipweb
Hi
I had the same problem. The error message is quite clear.
Edit the file htdocs\packages\pdf_viewer\blocks\pdf_viewer\controller.php and add quotation marks around external_url. One of the last lines has to look:
if($args["external_url"] && $args["pdf_file"]){
This resolved the problem for me.

HTH
Regards
Matthias
creativestudiofrog replied on at Permalink Reply
creativestudiofrog
Perfect - works again!
jmartinwestern replied on at Permalink Reply
jmartinwestern
Thank you so much for posting this!
jmartinwestern replied on at Permalink Reply
jmartinwestern
Thank you so much for posting this!
Pixelfixer replied on at Permalink Reply
Pixelfixer
Perfect! Thank you for posting this solution!
elmaster replied on at Permalink Reply
elmaster
Thank you so much for the information.
infomanb5 replied on at Permalink Reply 1 Attachment
infomanb5
Sorry, its the same solution as above .... didn't see it

Hello,
I also had this error message:
"Use of undefined constant external_url - assumed 'external_url' (this will throw an Error in a future version of PHP)."

I've changed
line 44
adding missing " around external_url
in
concrete5/packages/pdf_viewer/blocks/pdf_viewer/controller.php :

OLD:
if($args[external_url] && $args["pdf_file"]){

NEW:
if($args["external_url"] && $args["pdf_file"]){


Now everything works
Best regards

concrete5 Environment Information

# concrete5 Version
Core Version - 8.5.1
Version Installed - 8.5.1
Database Version - 20190301133300

# concrete5 Packages
Advanced HTML Block (0.9), Cloneamental (0.9.3), Enhanced Version List (0.9.2), PDF Viewer (1.0.1), Redirect (2.0.0), Twitter Embedded Timeline (0.9.7)

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 5 minutes.

# Server Software
Apache

# Server API
apache2handler

# PHP Version
7.3.4

# PHP Extensions
apache2handler, apc, apcu, bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 256M
post_max_size - 8M
upload_max_filesize - 2M
ldap.max_links - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Chrome Version 74.0.3729.169 (Official Build) (64-bit)

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.