Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • #839833

    Dear,
    I tried to upgrade to PHP 7 with my WP 4.8.1 website https://www.pq-partner.nl, but it did not work.
    I then ran the PHP Compatibility Checker (details see below) which generated a series of errors and warnings. It boils down to one Warning and two Errors in 16 files, all of them in wp-content/themes/choices/(includes & framework):
    Warning: Use of deprecated PHP4 style class constructor is not supported since PHP 7
    Error 1: Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity
    Error 2: Extension ‘mysql_’ is deprecated since PHP 5.5 and removed since PHP 7.0; Use mysqli instead

    Obviously a ‘limited’ problem, but is Choices going to be updated to PHP7 compatibility?

    Christiaan Boland

    #839927

    Hey Christiaan,

    I relaid this question to Kriesi.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #840314

    Meanwhile I’ve temporarily changed the theme to Tenty Seventeen and although obviously a major part of the website did not function well, I could run PHP Compatibility Checker, which gave me following result:
    3 out of 18 plugins/themes may not be compatible.
    Better Search Replace – Compatible Warnings: 1 toggle details
    CC Cookie Consent – Compatible toggle details
    Choices – Warnings: 23 Errors: 8 toggle details
    Convert WP Database to UTF-8 – Errors: 16 toggle details (NOT ACTIVE)
    Display PHP Version – Compatible toggle details
    Duplicator – Compatible Warnings: 15 toggle details
    Events Manager – Compatible Warnings: 1 toggle details
    Floating Menu – Compatible Warnings: 2 toggle details
    Image Widget – Compatible toggle details
    PCB NAVURLEXT – Compatible toggle details
    Post Types Order – Compatible toggle details
    Really Simple SSL – Compatible toggle details
    Reveal IDs – Compatible toggle details
    Simple Image Sizes – Compatible toggle details
    Twenty Seventeen – Compatible toggle details
    WP Accessibility – Compatible toggle details
    WP Native Dashboard – Warnings: 6 Errors: 3 toggle details
    Yoast SEO – Compatible toggle details

    Regards,
    Christiaan Boland

    #841334

    Hi Christiaan Boland,

    Thank you for sharing. Well, there are other plugins now, that might do what you need.

    Best regards,
    Victoria

    #841376

    Dear Victoria,

    I’m afraid you misunderstood. The plugin works well an tells me that in theme Choices there are 8 errors against PHP7 and 23 Warnings.(so it has nothing to do with plugins)
    7 times the same error, 1 other error.
    To be more precise:
    1. wp-content/themes/choices/includes/helper-template-dynamic.php:
    line 121 | ERROR | Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.(121:$this->final_output[] = $this->$element[‘dynamic’]($element);)

    same problem for
    2 & 3.. wp-content/themes/choices/framework/php/class-htmlhelper.php,
    lines 203 and 222, (both lines: $output .= $this->$element[‘type’]( $element );
    4. wp-content/themes/choices/framework/php/class-style-generator.php
    line 119, ($this->output .= $this->$rule[‘key’]($rule).”\n”;)
    5. wp-content/themes/choices/framework/php/class-form-generator.php
    line 194($this->$element[‘type’]($element_id.$this->id_sufix, $element);)
    6. wp-content/themes/choices/framework/php/wordpress-importer/wordpress-importer.php
    line 764 ($$meta[‘key’] = $meta[‘value’];)
    7. wp-content/themes/choices/framework/php/wordpress-importer/avia-import-class.php
    line 235 ($$meta[‘key’] = $meta[‘value’];)

    I’ve tried to figure out how & where to use the curly brackets, but din’t manage to get positive resul with my limitedmy PHP knowledge.

    The other error is the use of ‘mysql’ which should from PHP5.5 onward be ‘mysqli’
    wp-content/themes/choices/framework/php/class-framework-widgets.php
    line 1318 ($content = mysql_real_escape_string($content); ERROR | Extension ‘mysql_’ is deprecated since PHP 5.5 and removed since PHP 7.0; Use mysqli instead)

    Then there are 23 warnings:
    Use of deprecated PHP4 style class constructor is not supported since PHP 7 in a number of lines.

    Why don’t you run the PHP Compatibility Checker for PHP7 yourself on Choices and get the full report?
    If you want I can also forward my report.

    Christiaan Boland

    #841967

    Hi Christiaan Boland,

    I wrote the question you asked to Kriesi, he is the one who makes those kin of decisions and can answer your question, whether there will be a new version of Choices. I understood what you wrote from the first time and I understand that the code base might be outdated.

    Best regards,
    Victoria

    #841980

    OK Victoria,

    Let’s see what he comes up with… ;-)

    Christiaan

    #843117

    Hi,

    Are you using the latest version of choices 4.2 ?

    Searching the code in this version I cannot find the mysql_ and the Error in line 121 of wp-content/themes/choices/includes/helper-template-dynamic.php is fixed.

    Best regards,
    Günter

    #843235

    Wow, shame on me! I never checked the version of Choices.
    Indeed I’m way behind with version 2.2!
    I’ve ‘found’ the update page Choices>Theme Update, where you have to put your Themeforest User Name and the Themeforest API Key to activate the subscription for regular update checks.
    Then I got the update to 4.1 as the lastest version (not 4.2 !), which I’m now installing. I’ve made a few tweaks in the theme, that I have to copy to or rewrite in the updated version.
    Then I will check for the PHP7 compatibility, which I assume will be OK now.

    Sorry for the hassle

    Christiaan Boland

    #843385

    Well, I’ve updated to Choices 4.1 (is there a 4.2 and if so why doesn’t it show up in the “Them Updates”?).
    There is on error left according PHP Compatibility Checker:
    FILE: wp-content/themes/choices/framework/php/wordpress-importer/wordpress-importer.php
    FILE: wp-content/themes/choices/framework/php/wordpress-importer/wordpress-importer.php
    FOUND 1 ERROR AFFECTING 1 LINE
    798 | ERROR | Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.

    797: foreach ( $item[‘postmeta’] as $meta )
    798: $$meta[‘key’] = $meta[‘value’];
    I don’t know how to ‘improve’ this one, but I assume as long as I don’t import, not problem will occur (?)

    Christiaan

    #844534

    Hi,

    Thanks for coming back.

    Sorry, 4.2 is on our development repo on github but not released yet.

    The plugin wordpress-importer that is used in the framework still has some php 7.0 problems in core. As long as you do not use any import you should not have problems.

    Best regards,
    Günter

    #844728

    Hey,

    With Choice 4.1 my website runs under PHP7. Indeed the PHP Compatibility Checker reports only 1 error: line 798 in choices\framework\php\wordpress-importer\wordpress-importer.php. I fixed at least the error report by adding the curly brackets in ${$meta[‘key’]} = $meta[‘value’]; If it is indeed not an error I don’t know.

    Meanwhile I’ve still got a problem with PHP7, most likely not due to Choices. Somehow, the list of events does not show up in admin, although there are 40 events in the dB. Also the link to the events-page only yields an empty page.
    I’m going to look further if anyone had similar problems.

    Cheers
    Christiaan

    #844748

    Hi,

    Try to refresh the permalinks Dashboard -> Settings -> Permalinks.

    Best regards,
    Günter

    #845058

    Dear Günter,

    I had a look at the permalinks in my test site and noticed they are set at
    Custom Structure https://my.testsite.nl/%category%/%postname%/.
    I don’t know who did that, as I surely didn’t, would know to do it. Anyway I tried various other settings, including Plain and Post name, but to no avail.
    I keep looking where this goes wrong.

    Christiaan

    #847509

    Hi,

    798 | ERROR | Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.
    797: foreach ( $item[‘postmeta’] as $meta )
    798: $$meta[‘key’] = $meta[‘value’];

    Regarding the error above, please replace the code with:

    foreach ( $item['postmeta] as $meta )
    ${$meta['key']} = $meta[value];
    

    You should not encounter any errors unless you’re importing the demo or settings.

    Best regards,
    Ismael

    #865288

    Hi there again,

    I’ve found, that my websites run still OK with php 7.0.24, but generate a fatal error when running under php 1.10. I see the following in my debug-logfile:
    It stumbles over line 48 in compat.php file in Choices/includes/admin stating “Cannot use string offset as an array”

    48 $custom_fields[‘slideshow’][0][‘slideshow_image’] = “”;
    I tried to ‘solve; the issue by putting bracktes,
    48 (($custom_fields[‘slideshow’])[0])[‘slideshow_image’] = “”;
    but to no avail.

    below the debug logfile lines with the fatal error.

    Any suggestion?

    [17-Oct-2017 11:42:38 UTC] PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-content/themes/choices/includes/admin/compat.php:48
    Stack trace:
    #0 /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-includes/class-wp-hook.php(298): avia_backend_compatibility_custom_field_filter(”, 670)
    #1 /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-includes/plugin.php(203): WP_Hook->apply_filters(”, Array)
    #2 /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-content/themes/choices/framework/php/function-set-avia-frontend.php(262): apply_filters(‘avia_post_meta_…’, ”, 670)
    #3 /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-content/themes/choices/framework/php/function-set-avia-frontend.php(209): avia_post_meta(670, ‘dynamic_templat…’)
    #4 /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-content/themes/choices/includes/helper-template-logic.php(134): avia_is_dynamic_template(670)
    #5 /home/deb89125/domains/ in /home/deb89125/domains/boland-devries.nl/public_html/ngm1780/wp-content/themes/choices/includes/admin/compat.php on line 48

    #865653

    Hi,

    The problem you reported is a bug with PHP 7.1, that should be fixed with the next update.

    Meanwhile you have to update file choices/includes/admin/compat.php. Please replace the complete content of this file with the RAW paste content of

    https://pastebin.com/K4xYrLg1

    This link is valid for one month. Make sure to make a copy of the original file to have a fallback and that you are using the latest version of Choices.

    Please clear your browser cache, Server cache and reload the page (sometimes you need to close the browser and reopen a new browser window and reload the page several times).

    If you have problem we can do the update for you, please give us FTP access to your server.

    Best regards,
    Günter

    #865724

    Deart Günter,

    Thanks, that solved indeed a problem I’ve been looking for since some months!.

    Groeten / Regards
    Christiaan Boland

    #865755

    Hi,

    Glad we found a solution.

    Can we close the topic? In case you need further assistance, you can open a new one any time you need and we will try to help you.

    Best regards,
    Günter

    #865763

    Sure,

    I’m still checking my other website for php 7, but I’m fine for now.

    Thanks,
    Christiaan

    #866096

    Hi,

    Great. Please feel free to open a new thread if you encounter any issues.

    Best regards,
    Ismael

Viewing 21 posts - 1 through 21 (of 21 total)

The topic ‘Choices and php7 – compatibility checker finds errors & warnings’ is closed to new replies.