bobbingwide / oik-css

[bw_css] shortcode for internal CSS styling
https://www.oik-plugins.com/oik-plugins/oik-css
0 stars 0 forks source link

Support PHP 7.2 #5

Closed bobbingwide closed 6 years ago

bobbingwide commented 6 years ago

oik-css uses GeSHI for pretty printing of code samples using the [bw_geshi] shortcode.

Actual output

This produces the following message under PHP 7.2

Deprecated: Function create_function() is deprecated in C:\apache\htdocs\wordpress\wp-content\plugins\oik-css\geshi\geshi.php on line 4751

Expected output

No messages

Explanation

The GeSHi code contains the deprecated create_function.

Proposed solution

Update the version of GeSHi.

GeSHI links:

Note: oik-css will use another version of GeSHi if it has already been loaded by another plugin. This is because it was being used alongside wp-syntax; a long time ago. If the other version which has already been loaded is back level then the Deprecated message may appear. Should we test for this? Or is the deprecated message good enough. I’d say the latter.

bobbingwide commented 6 years ago

While developing the tests for the [bw_css] shortcode I got distracted by

There was 1 risky test:

1) Tests_oik_css::test_bw_enqueue_style
This test printed output:

which was echoing an unexpected space. After reducing the test to

    function test_bw_enqueue_style() {
        $this->assertTrue( true );
    }

and finding I was still getting the message I then looked at the logic in

    function setUp() {
        parent::setUp();
        oik_require( "shortcodes/oik-css.php", "oik-css" );
    }

It turns out that the shortcodes/oik-css.php file started

  <?php // (C) Copyright Bobbing Wide 2013-2015

Note the unwanted space at the beginning of the line!