MWDelaney / bootstrap-3-shortcodes

WordPress shortcodes for easier use of Bootstrap elements in your content.
https://wordpress.org/plugins/bootstrap-3-shortcodes/
MIT License
377 stars 118 forks source link

PHP7 Support for media elements #135

Closed jacobgelling closed 8 years ago

jacobgelling commented 8 years ago

When using the latest version of the plugin and WordPress with PHP7, the following errors are printed to the log.

2016/07/30 16:07:53 [error] 13886#13886: *2012 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'DOMDocument' not found in /srv/www/example.com/wp-content/plugins/bootstrap-3-shortcodes/bootstrap-shortcodes.php:2068
Stack trace:
#0 /srv/www/example.com/wp-content/plugins/bootstrap-3-shortcodes/bootstrap-shortcodes.php(1609): BoostrapShortcodes->scrape_dom_element(Array, '\n<img src="/wp-...', 'media-object im...', '', false)
#1 /srv/www/example.com/wp-includes/shortcodes.php(326): BoostrapShortcodes->bs_media_object(Array, '\n<img src="/wp-...', 'media-object')
#2 [internal function]: do_shortcode_tag(Array)
#3 /srv/www/example.com/wp-includes/shortcodes.php(223): preg_replace_callback('/\\[(\\[?)(media\\...', 'do_shortcode_ta...', '\n[media-object ...')
#4 /srv/www/example.com/wp-content/plugins/bootstrap-3-shortcodes/bootstrap-shortcodes.php(1584): do_shortcode('\n[media-object ...')
#5 /srv/www/example.com/wp-includes/shortcodes.php" while reading response header from upstream, client: 192.168.1.1, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/example.com.sock:", host: "example.com"

The media element example can be used to reproduce the error.

[media]
  [media-object media="left"]
    ...
  [/media-object]
  [media-body title="Testing"]
    ...
  [/media-body]
[/media]
MWDelaney commented 8 years ago

Hi, thanks for reporting this. This is working for me in PHP7. According to this you may need to install an extension to PHP7 or enable XML support. From my reading this should be enabled by default, though.

Can you tell me a little more about your hosting environment? Is it shared hosting, or did you set it up yourself?

jacobgelling commented 8 years ago

Thanks, it was fixed by installing the php-xml and php-mbstringpackages.

It's my own server upgraded to Ubuntu Server 16.04. It was previously running 14.04 without problem so it seems like the above extensions are no longer installed by default. My explicitly installed extensions remained after the upgrade (such as json, imap etc).