Zen Cart Logo
Forums / Contribution-Writing Guidelines / Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

Views: 3,564

Results 1 to 8 of 8
21 Dec 2013, 1:21 PM
#1
lat9 avatar

lat9

Administrator

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

Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

RodG's post (http://www.zen-cart.com/showthread.php?211441-mysql_query&p=1230753#post1230753) should be a wake-up call to any plugin authors who use PHP mysql* functions rather than using the Zen Cart $db-related functions. Since v1.5.2 converted to use mysqli* functions, any plugin that uses mysql* functions will experience an error when used in v1.5.2.

23 Dec 2013, 3:16 AM
#2
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

If only the following PHP mysql* functions need upgrading:
mysql_fetch_array
mysql_query

then for me it looks like these important mods will require an upgrade:
SuperOrders
EasyPopulate4
OzPost

But are there any other PHP mysql* functions that need to be addressed?

23 Dec 2013, 3:30 AM
#3
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

There are many others:

http://www.php.net/manual/en/ref.mysql.php

But which of these PHP mysql* funcitions are not compatible with zencart 152.

23 Dec 2013, 12:15 PM
#4
lat9 avatar

lat9

Administrator

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

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

dw08gm:

There are many others:

http://www.php.net/manual/en/ref.mysql.php

But which of these PHP mysql* funcitions are not compatible with zencart 152.
I'm ***guessing ***that the answer is "none of them".

24 Dec 2013, 11:31 AM
#5
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

Whoops. My bad. Briefly confused mysql* with the mysqli* functions.

What I intended to ask is whether any of the PHP mysqli* functions are incompatible with or otherwise to be replaced by specific Zen Cart 152+ $db-related functions.

Happy Holidays

24 Dec 2013, 12:51 PM
#6
lat9 avatar

lat9

Administrator

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

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

dw08gm:

Whoops. My bad. Briefly confused mysql* with the mysqli* functions.

What I intended to ask is whether any of the PHP mysqli* functions are incompatible with or otherwise to be replaced by specific Zen Cart 152+ $db-related functions.

Happy Holidays
Understood, since mysqli* does fall under mysql! I should have more properly phrased the functions as mysql_.

Just like the previous versions of Zen Cart abstract the database calls (using mysql_* functions) via the query_factory class, v1.5.2 provides the same interface abstraction using mysqli_* calls -- thus making the transition from the (now deprecated) mysql_* calls transparent to any code that calls the $db interface (or the zen_db functions). If I found the need to use a mysqli_ function that is not currently abstracted by the Zen Cart database class, I'd create a suggestion for Zen Cart to include that function's processing within the database class structure.

26 May 2014, 1:08 PM
#7
lat9 avatar

lat9

Administrator

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

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

Since it sounds like ZC v1.5.3 is coming soon, I thought that I'd refresh this thread to remind plugin authors to check their plugins for compatibility with ZC 1.5.2 (and later) relative to the use of any PHP mysql_* direct function calls. Since the $db object in ZC 1.5.2+ uses a mysqli interface, it is incompatible with any use of PHP mysql_* functions!

27 May 2014, 6:10 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Plugin authors: Check for use of mysql* functions for compatibility with v1.5.2

Clarification: The current version of PHP is what's incompatible with the old mysql_xxxx() function calls.
Your custom code should always be using the built-in $db object, and NOT writing your own direct calls to mysql_xxxx() or mysqli_xxxxx() functions.

And, keep in mind that the syntax is different between the mysql_xxxx() and mysqli_xxxx() functions. You can't just change them out for the other ones. You must also change a number of parameters. THAT is one big reason why you should just use the built-in $db object methods in your ZC plugins. And also the fact that the $db object handles security correctly, and making your own calls to mysql functions does not.