Making the Interakt products compatible with PHP5.3

Any tips and tricks that has to with the interakt extensions that doesn't fit into one of the other categories
AleS
Posts: 5
Joined: 2010-02-19 19:30

Making the Interakt products compatible with PHP5.3

Post by AleS » 2010-02-20 11:19

This article posted by Andrei Bejenaru (great job, thanks) on the former Interakt forum will be surely very useful in 2010 !

-------------------------------------------------------------------------------
Making the Interakt products compatible with PHP5.3

This post also applies to Adobe Dreamweaver Developer Toolbox (ADDT)

PHP 5.3 brings the following sets of changes: deprecates old features in favour of modern, standard and performant ones; makes the language syntax less permissive.

1. Common's folder
**************************************************************
1.1. Deprecated function mysql_escape_string() used in includes/common/lib/db/KT_FakeRecordset.class.php

a) line 115, replace

$insert_values .= "'" . mysql_escape_string($value) . "', ";

with

$insert_values .= "'" . mysql_real_escape_string($value) . "', ";

b) line 131, replace

$multiple_values[$i] .= "'" . mysql_escape_string($value) . "', ";

with

$multiple_values[$i] .= "'" . mysql_real_escape_string($value) . "', ";

c) line 198, replace

$select_sql .= "'" . mysql_escape_string($value) . "' AS " . $colName . ", ";

with

$select_sql .= "'" . mysql_real_escape_string($value) . "' AS " . $colName . ", ";

1.2. Deprecated function split() used in includes/common/lib/file/KT_File.class.php

line 229, replace

$arr = split('[\\/]', $file);

with

$arr = preg_split('#[\\/]#', $file);

1.3. Deprecated function split() used in includes/common/lib/file_upload/KT_FileUpload.class.php

line 233, replace

$arr = split("[\\/]", $destinationName);

with

$arr = preg_split("#[\\/]#", $destinationName);

1.4. Deprecated function split() used in includes/common/lib/folder/KT_Folder.class.php

line 146, replace

$arrPath = split("[\\/]", $path);

with

$arrPath = preg_split("#[\\/]#", $path);

1.5. Deprecated function split() used in includes/common/lib/image/KT_Image.class.php

line 2004, replace

$arr = split("[/\]", $path);

with

$arr = preg_split("#[\\/]#", $path);

1.6. Deprecated Safe Mode configuration used in includes/common/lib/shell/KT_Shell.class.php

line 95, replace

if (ini_get("safe_mode")) {

with

if (@ini_get("safe_mode")) {

2. Kollection
******************************************************************
2.1. includes/tng/triggers/tNG_defTrigg.inc.php

line 49, replace

function Trigger_Default_FormValidation(&$tNG, &$uniVal) {

with

function Trigger_Default_FormValidation(&$tNG, $uniVal) {

2.2. includes/tng/tNG_custom.class.php

line 19, replace

parent::tNG_fields($connection);

with

parent::tNG($connection);

2.3. includes/tng/tNG_delete.class.php

line 19, replace

parent::tNG_fields($connection);

with

parent::tNG($connection);

2.4. includes/tng/tNG_fields.class.php

line 425, replace

function getFieldError($fName) {

with

function getFieldError($fName, $cnt = 1) {

2.5. includes/tng/tNG_insert.class.php

line 19, replace

parent::tNG_fields($connection);

with

parent::tNG($connection);

2.6. includes/tng/tNG_log.class.php

a) line 17, replace

function log($className, $methodName=NULL, $message=null) {

with

static function log($className, $methodName=NULL, $message=null) {

b) line 25, replace

function getResult($mode, $uniq='') {

with

static function getResult($mode, $uniq='') {

2.7. includes/tng/tNG_multiple.class.php

line 147, replace

function getFieldError($fName, $cnt) {

with

function getFieldError($fName, $cnt = 1) {

2.8. includes/tng/tNG_multipleDelete.class.php

line 17, replace

parent::tNG_multiple($connection);

with

parent::tNG($connection);

2.9. includes/tng/tNG_multipleInsert.class.php

line 31, replace

parent::tNG_multiple($connection);

with

parent::tNG($connection);

2.10. includes/tng/tNG_multipleUpdate.class.php

line 24, replace

parent::tNG_multiple($connection);

with

parent::tNG($connection);

2.11. includes/tng/tNG_update.class.php

line 18, replace

parent::tNG_fields($connection);

with

parent::tNG($connection);

3. Kart & Shop
*****************************************************************
3.1. Deprecated function session_unregister() used in includes/krt/krt_functions.inc.php

a) line 82, replace

session_unregister('KT_MXKART');

with

unset($_SESSION['KT_MXKART']);

b) line 93, replace

session_unregister($key);

with

unset($_SESSION[$key]);

3.2. includes/tng/krt_tNG.class.php

line 28, replace

function addColumn($colName, $type, $method, $reference, $null) {

with

function addColumn($colName, $type, $method, $reference, $defaultValue = '') {

3.3. includes/tng/krt_tNG_delete.class.php

line 13, replace

function setPrimaryKey($colName, $type, $method, $reference)

with

function setPrimaryKey($colName, $type, $method='VALUE', $reference=NULL)

3.4. includes/tng/krt_tNG_insert.class.php

line 10, replace

function addColumn($colName, $type, $method, $reference, $null) {

with

function addColumn($colName, $type, $method, $reference, $defaultValue = '') {

3.5. Deprecated function split() used in MXKart/authnet.php

a) line 52, replace

$resp $response);

with

$resp $response);

b) line 54, replace

$resp $response);

with

$resp $response);

4. KTML
*****************************************************************
4.1. Deprecated function split() used in includes/ktm/plugins/ktml4_security.class.php

line 239, replace

$arr = split("\\/", $folderName);

with

$arr = preg_split("#[\\/]#", $folderName);

4.2. Deprecated function split() used in includes/ktm/plugins/modules/spellcheck/service/ktml4_mspl_spellcheck.class.php

a) line 178, replace

$tmpAddedWords = split("[\n\r]", $content);

with

$tmpAddedWords = preg_split("#[\n\r]#", $content);

b) line 367, replace

$lines = split("[\r\n]", $text);

with

$lines = preg_split("#[\r\n]#", $text);

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Making the Interakt products compatible with PHP5.3

Post by Fred » 2010-02-20 19:23

That article is already posted on the site here:
http://www.interaktonline.info/article/ ... P-5.3.html

What we now need is someone that will patch all the files and create a zip file with the patched files to upload.

I moved the topic because it contains information about more products than just kollektion.

User avatar
Timespider
Posts: 37
Joined: 2010-02-16 22:15
Location: Auckland - New Zealand

Re: Making the Interakt products compatible with PHP5.3

Post by Timespider » 2010-02-24 23:05

For any who looks at the line numbers for PHP 5.3.1 code fixes & cant find the same code, just look a few lines below or above & it's there.

Chris
Motto: STUPID HURTS

kuopiopete
Posts: 3
Joined: 2010-03-24 09:17
Location: Vuorela, Finland
Contact:

Re: Making the Interakt products compatible with PHP5.3

Post by kuopiopete » 2010-03-24 17:16

The downloadable patch files for ADDT 1.0.1 include a further file not shown in the detailed list above.

includes/tng/tNG_import.class.php where the change is on line 104
delete - parent::tNG_multiple($connection);
replace with - parent::tNG($connection);

abejenaru
Posts: 1
Joined: 2010-03-25 10:15

Re: Making the Interakt products compatible with PHP5.3

Post by abejenaru » 2010-03-25 10:20

Hi all,

ADDT patching is addressed by this article: http://www.interaktonline.info/article/ ... P-5.3.html

You were looking at Kollection patching, that is why line numbers don't match and includes/tng/tNG_import.class.php is missing.

Best,
Andrei

Vegetta
Posts: 7
Joined: 2010-04-23 19:33

Re: Making the Interakt products compatible with PHP5.3

Post by Vegetta » 2010-04-23 20:48

My Host is still running 5.2.11 Should/could i be proactive and make the 5.3 changes now Will it break anything if I make the changes with 5.2.11

AleS
Posts: 5
Joined: 2010-02-19 19:30

Re: Making the Interakt products compatible with PHP5.3

Post by AleS » 2010-04-23 22:00

I didn't apply that changes, but everything seems right even for your version except on part 2. I don't understand exactly why all these changes are necessary, but be careful, particularly if you modified your code for your needs !

If someone did it on version before 5.3, I'm also interested on.

AleS

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Making the Interakt products compatible with PHP5.3

Post by Fred » 2010-04-25 09:31

I have updated this site with this download.

I have php 5.29 installed on my server and it looks fine as far as I can tell.

Just make a backup of your includes folder before upgrading. If there is a problem it is easy enough to fix if you have a backup.

Vegetta
Posts: 7
Joined: 2010-04-23 19:33

Re: Making the Interakt products compatible with PHP5.3

Post by Vegetta » 2010-04-28 20:12

Thanks for the heads up Guys.

I have about 20 different sites so i am going to pick one to be the guinea pig

:P Bwa ha ha

User avatar
Timespider
Posts: 37
Joined: 2010-02-16 22:15
Location: Auckland - New Zealand

Re: Making the Interakt products compatible with PHP5.3

Post by Timespider » 2010-04-28 20:51

Hi, my version is 5.2.13 & I have upgraded about 10 sites with no problems yet.
Motto: STUPID HURTS

Post Reply