Test Server - Forum Code Changes for PHP 5.3.10 to PHP 7


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Test Server - Forum Code Changes for PHP 5.3.10 to PHP 7
# 1  
Old 12-15-2017
Test Server - Forum Code Changes for PHP 5.3.10 to PHP 7

Here is some docs of my ongoing work to port this forum PHP code which is running on 5.3.10, to PHP 7.

Motivation:

Unfortunately, every thing that has a beginning must have an end. PHP 5.6 active support ended January 19, 2017. It will receive security support until December 31, 2018.

#1

Code:
class_core.php

Code:
1644                 if(get_magic_quotes_runtime())
1645                 {
1646                        // Deactivate
1647                         set_magic_quotes_runtime(false);
1648                  }
1649                 //set_magic_quotes_runtime(0);
1650                 //@ini_set('magic_quotes_sybase', 0);

# 2  
Old 12-16-2017
#2 (this is a pain for sure)

On the test server with PHP 7.... all thread with bbcode is broken (example PHP 7 error):


Code:
Fatal error: Uncaught Error: Call to undefined function handle_bbcode_list() in /var/www/includes/class_bbcode.php:1147 

Stack trace: 

#0 /var/www/includes/class_bbcode.php(678): vB_BbCodeParser->parse_array(Array, 1, 0) 

#1 /var/www/includes/class_bbcode.php(420): vB_BbCodeParser->parse_bbcode('You've given us...', 1, 0) 

#2 /var/www/includes/class_bbcode.php(375): vB_BbCodeParser->do_parse('You've given us...', 0, 1, 1, 1, true, false) 

#3 /var/www/includes/class_postbit.php(1130): vB_BbCodeParser->parse('You've given us...', 30, '1', false, NULL, NULL, false) 

#4 /var/www/includes/class_postbit.php(288): vB_Postbit_Post->parse_bbcode() 

#5 /var/www/showthread.php(1104): vB_Postbit->construct_postbit(Array) 
 
#6 {main} thrown in /var/www/includes/class_bbcode.php on line 1147

LINE 1147:

Code:
// call a callback function
$pending_text = $this->$tag_info['callback']($open['data'], $open['option']);

If anyone reading knows how to fix this, please post and save me some time! Thanks.
# 3  
Old 12-16-2017
Better go back to basics:

Migrating a PHP 5 App to PHP 7 (Development Environment) - Part 1

-- Learn how to migrate a PHP 5 application to PHP 7: Setup and development environment.

Migrating a PHP 5 App to PHP 7 (Rundown of PHP 7 Features) - Part 2

-- Take a look at the PHP 7 features and learn how they can help you in migrating your PHP 5 projects.

Migrating a PHP 5 App to PHP 7 (Tools & Implementation) - Part 3

-- Let's go through migrating a simple PHP 5 app to PHP 7
# 4  
Old 12-16-2017
OK.. this is fixed:

Reference: Backward incompatible changes


PHP 5:

Code:
// call a callback function
$pending_text = $this->$tag_info['callback']($open['data'], $open['option']);

PHP 7 (and also works with 5)

Code:
// call a callback function
$pending_text = $this->$tag_info{['callback']}($open['data'], $open['option']);

Confirmed working Smilie

But many more to go...
# 5  
Old 12-16-2017
#3

Here is another one:

Code:
#### /var/www/includes/functions.php
* variableInterpolation
 * Line 1875: ` global $$cache_name; // internal array for cacheing purposes`
 * Line 1902: ` global $$cache_name; // internal array for cacheing purposes`
 * Line 2041: `         global $$varname;

Fixed (not confirmed because have not reproduced error... assumed to be fixed until error appears ...)

Code:
#### /var/www/includes/functions.php
* variableInterpolation
 * Line 1875: ` global ${$cache_name}; // internal array for cacheing purposes`
 * Line 1902: ` global ${$cache_name}; // internal array for cacheing purposes`
 * Line 2041: `         global ${$varname};

# 6  
Old 12-16-2017
#4 /profile.php?do=updateprofile

Another PHP 7 issue from PHP 5:

Code:
Warning: Declaration of vB_DataManager_User::save($doquery = true, $delayed = false) 
should be compatible with vB_DataManager::save($doquery = true, $delayed = false,
 $affected_rows = false, $replace = false, $ignore = false) in [path]/includes/class_dm_user.php on line 2968

Warning: Declaration of vB_DataManager_User_Multiple::fetch_query($condition, $limit = 0, $offset = 0) 
should be compatible with vB_DataManager_Multiple::fetch_query($condition = '', $limit = 0, $offset = 0) 
in [path]/includes/class_dm_user.php on line 3119

Which seems to result in vB MySQL error:

Code:
Database error in vBulletin 3.8.9:

Invalid SQL:
UPDATE user SET
	parentemail = '',
	icq = '',
	msn = '',
	aim = '',
	yahoo = '',
	skype = '',
	homepage = 'https://www.unix.com',
	birthday_search = '',
	birthday = '',
	showbirthday = 0,
	usertitle = 'Administrator',
	customtitle = 1,
	facebook = 'unixlinuxhq',
	myspace = '',
	twitter = 'unixlinux',
	youtube = 'UnixTutorials',
	linkedin = '',
	hyves = ''
WHERE userid = 1;

MySQL Error   : Incorrect date value: '' for column 'birthday_search' at row 1
Error Number  : 1292

Which my PHP 7 compatibility tool (php7mar) indicates only this:

Code:
#### /var/www/includes/class_dm_user.php
* oldClassConstructors
 * Line 181: `  function vB_DataManager_User(&$registry, $errtype = ERRTYPE_STANDARD)`

... miles and miles to go before i sleep, and promises to keep ....
# 7  
Old 12-16-2017
This is a terribly boring project..... yesterday worked for hours and hours only to find making the suggestions to fix "critical" issues identified by php7mar seemed to get me nowhere fast. Instead of the test site becoming more robust, things broke more and more.

Back to square one Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Web Development

PHP Changes to WOL for New Forum Home Page

Wrote some PHP code today to make the Who Is Online (WOL) in the forums work properly with the new home page: Wrote this global plugin to add the location to both the user table (for members) and session table (for guests + registered users) <?php if (THIS_SCRIPT != 'misc' and... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

PHP - add rm %dir to php code

Hello everyone, I'm trying to modify a php file to perform 2 actions in an if statement. // If the delete button is pressed if(isset($_GET) && isset($_GET)) { if(!mysql_query("DELETE FROM users WHERE User='".$_GET."'",$link)) ... (2 Replies)
Discussion started by: da1
2 Replies

3. Shell Programming and Scripting

php code - Sending mail with external SMTP server

Here is the code: <?php //new function function loadini($path) { $fp = fopen($path, "r"); $fpcontents = fread($fp, filesize($path)); fclose($fp); return $fpcontents; } $to = "test@test.com"; $nameto = "notme"; $from = "test"; $namefrom = "Who From"; ... (0 Replies)
Discussion started by: galford
0 Replies

4. Web Development

[PHP] Server Check and Failover Code

Here is some sample PHP code you can run if you have a PHP web application that uses code or images from an ad server, image server, or content deliver network, and you want to check if it is working and if not, failover to another one: <?php $current_server = "server.domain.com"; // set... (0 Replies)
Discussion started by: Neo
0 Replies

5. Web Development

I can't open my index.php page after insert php code

Hello guys, Does anyone can help me? I've just made my simple index.php without any code, but after insert session code to check if any user is authenticated, my index.php doesn't work anymore. Any fresh eyes could help me to see what and where the code is wrong? <? if... (6 Replies)
Discussion started by: metalfreakbr
6 Replies

6. Shell Programming and Scripting

Hiding PHP code on the server

Hi all, Sometime back, had put up a Q regarding hiding perl code. A: There is a utility known as 'pp' which comes along with PAR. Downloaded from CPAN. These people have done wonderful work I must say. Cool executables from perl scripts. Have one more... (4 Replies)
Discussion started by: sudhir_onweb
4 Replies
Login or Register to Ask a Question

Featured Tech Videos