Forums / Reports of Security Problems / Cannot redeclare zen_random_select() - applying Security Patch released 04-April

Cannot redeclare zen_random_select() - applying Security Patch released 04-April

Views: 42

Results 1 to 5 of 5
5 Apr 2024, 2:29 AM
#1
elemi avatar

elemi

Zen Follower

Join Date:
Mar 2006
Location:
Auckland, New Zealand
Posts:
242
Plugin Contributions:
0

Cannot redeclare zen_random_select() - applying Security Patch released 04-April

It's crashed my website guys.

This page isn’t working right nowamoraromatherapy.com can't currently handle this request.
HTTP ERROR 500

My report came up as 0 spam.

When I deleted the spam_cleanup_check.php file I also lost my admin area. by reinstating it, I got that back, however I still have no site...

My log file error message is "[05-Apr-2024 11:54:04 Pacific/Auckland] PHP Fatal error: Cannot redeclare zen_random_select() (previously declared in /home/amoraromatherapy/public_html/includes/functions/functions_general.php:778) in /home/amoraromatherapy/public_html/includes/functions/database.php on line 190"

/** @deprecated

  • Return a random row from a database query
    */
    function zen_random_select($query) {
    trigger_error('Call to deprecated function zen_random_select. Use $db->ExecuteRandomMulti() instead', E_USER_DEPRECATED);

    global $db;
    $random_query = $db->Execute($query);
    $num_rows = $random_query->RecordCount();
    if ($num_rows > 1) {
    $random_row = zen_rand(0, ($num_rows - 1));
    $random_query->Move($random_row);
    }
    return $random_query;

Elemi

The Art of Bespoke Aromatherapy
https://www.AmorAromatherapy.co.nz

5 Apr 2024, 2:40 AM
#2
elemi avatar

elemi

Zen Follower

Join Date:
Mar 2006
Location:
Auckland, New Zealand
Posts:
242
Plugin Contributions:
0

Re: Cannot redeclare zen_random_select() - applying Security Patch released 04-April

I've reinstated my previous database.php file and this has brought my site back online.

Elemi

The Art of Bespoke Aromatherapy
https://www.AmorAromatherapy.co.nz

5 Apr 2024, 2:57 AM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Cannot redeclare zen_random_select() - applying Security Patch released 04-April

What version of Zen Cart?

5 Apr 2024, 3:24 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Cannot redeclare zen_random_select() - applying Security Patch released 04-April

Elemi:

My log file error message is "[05-Apr-2024 11:54:04 Pacific/Auckland] PHP Fatal error: Cannot redeclare zen_random_select() (previously declared in /home/amoraromatherapy/public_html/includes/functions/functions_general.php:778) in /home/amoraromatherapy/public_html/includes/functions/database.php on line 190"

You put the v1.5.8 patch onto a v1.5.7 site.

v1.5.7 has the zen_random_select function on line 778 of functions_general.php
v1.5.8 moved the zen_random_select function to line 190 of database.php

So, when you put the patched v1.5.8 database.php onto your v1.5.7 site, you caused the "cannot redeclare" problem.

Solution: use the v1.5.7 patched /includes/functions/database.php file instead.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Apr 2024, 1:48 AM
#5
elemi avatar

elemi

Zen Follower

Join Date:
Mar 2006
Location:
Auckland, New Zealand
Posts:
242
Plugin Contributions:
0

Re: Cannot redeclare zen_random_select() - applying Security Patch released 04-April

yeah - I did all the 1.5.8 upgrades when they came out, however my site keeps insisting its 1.5.7c.

Is this going to create an issue when I upgrade to the new release over the weekend Dr B?

Elemi

The Art of Bespoke Aromatherapy
https://www.AmorAromatherapy.co.nz