Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Hi Zencart, here is an issue I need to tackle. I will be re-loading my site with PHP 5.6 for now, so the site will appear to work. This is just so I don't disappoint my customers today.

    site URL: https://www.stopmotionstore.com/
    ZC version: 1.5.5a
    List of plugins: Premium 2a theme (default templates are display same problem)
    PHP version: 7 (5.6 does not create this error)

    What is the problem? Upon updating from PHP 5.6 to 7.0, Zencart doesn't display any product categories for any template I use, including the default templates. This seems to happen in Google Chrome and Firefox. I didn't test in IE.

    I thought this had to do with a mobile template I installed years ago and then removed recently. However this problem happened while it was installed and while it was uninstalled.

    Here's the error in the log file which displays no matter which template is set to default:

    [26-Jul-2017 07:24:24 America/New_York] PHP Fatal error: Uncaught Error: Call to undefined function ereg_replace() in /homepages/1/XXXX/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php:141
    Stack trace:
    #0 /homepages/1/XXXX/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php(73): require()
    #1 /homepages/1/XXXX/htdocs/www.stopmotionstore.com/index.php(97): require('/homepages/1/d3...')
    #2 {main}
    thrown in /homepages/1/XXXX/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php on line 141

    Not sure if this is an issue but I also have this message at the top of my admin area: "Your database appears to need patching to a higher level. See Tools->Server Information to review patch levels."

    Thanks for any help.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    The ereg_replace function (used on line 141 of /includes/templates/premium2a/common/tpl_header.php) is "deprecated" in PHP 5.6 and removed in PHP 7.0+. See this stackoverflow posting for details on how to replace the use of ereg_replace with preg_replace.

  3. #3

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Thanks lat9 for your reply, when I change from ereg to preg, I get this error on the page where the contents of the categories would be:

    Error!

    Unable to determine the page link!


    Then I get a similar issue on my error logs:

    #1 preg_replace() called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php:141]
    #2 require(/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php) called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php:73]
    #3 require(/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php) called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/index.php:97]

    [26-Jul-2017 10:40:30 America/New_York] PHP Warning: preg_replace(): No ending delimiter '.' found in /homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php on line 141


    I'm not sure if I did it properly as I'm a coding newb. I simply replaced the terms in the file to see what would happen. What I read in your link seems to be indirect and a few people arguing over what is the best way to alter such a file. Is there a more direct and simple solution? Or is holding onto the old template just going to give me problems as things progress?

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    outside templates that say they are ZC1.5.5 compatible may not be compatible with php7. which is exactly what you have here....

    i highly doubt that the ZC default template does not work with php7. pretty sure that has been thoroughly vetted for any functions deprecated in php7.

    fixing the deprecated ereg_* functions is not that hard and can easily done. the link @lat9 provided no doubt helps.

    good luck.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Quote Originally Posted by animateclay View Post
    Thanks lat9 for your reply, when I change from ereg to preg, I get this error on the page where the contents of the categories would be:

    Error!

    Unable to determine the page link!


    Then I get a similar issue on my error logs:

    #1 preg_replace() called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php:141]
    #2 require(/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php) called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php:73]
    #3 require(/homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php) called at [/homepages/1/xxxx/htdocs/www.stopmotionstore.com/index.php:97]

    [26-Jul-2017 10:40:30 America/New_York] PHP Warning: preg_replace(): No ending delimiter '.' found in /homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php on line 141


    I'm not sure if I did it properly as I'm a coding newb. I simply replaced the terms in the file to see what would happen. What I read in your link seems to be indirect and a few people arguing over what is the best way to alter such a file. Is there a more direct and simple solution? Or is holding onto the old template just going to give me problems as things progress?
    ending delimiter in red:

    Code:
    preg_replace('/\\\/','',$theData)
    also look at:

    http://www.php.net/manual/en/functio...lace.php#98602
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Thank you Carl. I went ahead and updated Zencart to the latest version and applied the change. Here is what my log file tells me using the premium2a theme:

    [26-Jul-2017 11:46:52 America/New_York] PHP Fatal error: Uncaught Error: Call to undefined function () in /homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php:141
    Stack trace:
    #0 /homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_main_page.php(73): require()
    #1 /homepages/1/xxxx/htdocs/www.stopmotionstore.com/index.php(97): require('/homepages/1/d3...')
    #2 {main}
    thrown in /homepages/1/xxxx/htdocs/www.stopmotionstore.com/includes/templates/premium2a/common/tpl_header.php on line 141

    This is line 141 of that document:

    <?php echo zen_draw_form('currencies', zen_href_link(basename(preg_replace('/\\\/','',$theData)('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>

    Here is the odd part. If I use PHP 7.0, the default themes do not give any error messages in my logs. The site has most of its functionality. However the category list and extra info links do not show up. I wouldn't mind using the responsive template while I search for a new theme somewhere. I'm in a damned if I use the old, damned if I use the new.

    I would guess solving the issue of the categories would be the most important thing.

    Name:  categories.jpg
Views: 1752
Size:  38.2 KB

  7. #7
    Join Date
    Jan 2007
    Posts
    1,484
    Plugin Contributions
    10

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    What is the original line of code?

    Zen Cart and it's community are the best!!

  8. #8

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Hi Lankeeyankee. Here is the original/altered code:

    Original: <?php echo zen_draw_form('currencies', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>

    Altered: <?php echo zen_draw_form('currencies', zen_href_link(basename(preg_replace('/\\\/','',$theData)('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Quote Originally Posted by animateclay View Post
    Hi Lankeeyankee. Here is the original/altered code:

    Original: <?php echo zen_draw_form('currencies', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>

    Altered: <?php echo zen_draw_form('currencies', zen_href_link(basename(preg_replace('/\\\/','',$theData)('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>
    use the following altered line as a replacement for the original:

    Code:
    <?php echo zen_draw_form('currencies', zen_href_link(basename(preg_replace('/.php/', '', $PHP_SELF)), '', $request_type, false), 'get') ?>
    the replacement code that you used was just an example.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10

    Default Re: Updated PHP 5.6 to PHP 7 & Template Error Message / Partial Site Loading

    Thank you Carlwhat! That code did the trick. When I made the change and updated to PHP 7.0, everything worked as it should with that template. I then tested it with PHP 7.1 and it worked too. So this should mean I'm all set unless any bugs creep up.

    Now for the Zencart team, maybe this info is important. The Classic Green and Responsive Classic templates still don't work properly. It doesn't affect me as I'll keep my current theme which does work. But not sure if anyone else has that issue. Maybe with my tinkering over time some files are missing that I don't know of - or my layout settings are to different to work with the classic templates - but I figured I would throw this out there since I'm not sure.

    Thanks again Zen Team. I do appreciate your time to help out.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v150 cryptic php error message foils loading of my admin dashboard
    By cyberbaffled in forum Installing on a Linux/Unix Server
    Replies: 10
    Last Post: 21 Apr 2012, 09:36 PM
  2. Embed php template within another php template based on drop-down menu selection?
    By mcqueeneycoins in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 21 Jan 2012, 06:44 PM
  3. Error on page when loading index.php
    By ebaobao in forum General Questions
    Replies: 5
    Last Post: 7 Oct 2010, 08:19 PM
  4. error when loading create_account.php
    By lenertolson in forum General Questions
    Replies: 1
    Last Post: 24 Jun 2007, 06:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR