Author |
Message |
neralex
Site Admin
Joined: Aug 22, 2007
Posts: 1774
|
Posted:
Sun Jan 01, 2017 11:04 pm |
|
Note: I noticed that the mysql-functions are removed in php7 - it's supporting mysqli only. That means the whole INSTALLATION process is broken in php7! I'm working on a package for RavenNuke 2.5.1, which will work also with php7. For a fresh installation please don't use php7 as long the new package is released.
php5.6 gets the last major update (v5.6.30) in the next time. With this release the development on php5.x will ends finally. After that it will get only security updates until 2019.
So I guess its time to test RN251 with php7. On my local box I'm testing currently with php5.6.28, php7.0.10 and php7.1.11 to compare possible issues. I will update this thread, if I get more issues.
Please note: All my changes are only related to my used php versions. No guarantee that will work with previous versions.
Fixes for class constructor warnings: HERE
open rnconfig.php and find:
php Code:if (!version_compare(phpversion(), '6.0.0') >= 0) {
@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
@ini_set('allow_call_time_pass_reference', true); // PHP5 may/will throw a warning so this will suppress it
}
|
replace:
php Code:if (!version_compare(phpversion(), '6.0.0') >= 0) {
@ini_set('magic_quotes_runtime', 0); // Disable magic_quotes_runtime
@ini_set('allow_call_time_pass_reference', true); // PHP5 may/will throw a warning so this will suppress it
}
|
open modules/Forums/common.php and find:
php Code:@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
|
replace with:
php Code:@ini_set('magic_quotes_runtime', 0); // Disable magic_quotes_runtime
|
open: modules/Forums/includes/bbcode.php:
find:
php Code:$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
|
change it to:
php Code: # PHP7 fix
# http://php.net/manual/en/reference.pcre.pattern.modifiers.php
$text = preg_replace_callback(
"#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#si",
function ($m) use ($uid) {
return "[img:$uid]$m[1]" . str_replace(' ', '%20', $m[3]) . "[/img:$uid]";
},
$text
);
|
open includes/kses/kses.php:
find:
php Code:function kses_split($string, $allowed_html, $allowed_protocols)
###############################################################################
# This function searches for HTML tags, no matter how malformed. It also
# matches stray ">" characters.
###############################################################################
{
return preg_replace('%(<'. # EITHER: <
'[^>]*'. # things that aren't >
'(>|$)'. # > or end of string
'|>)%e', # OR: just a >
"kses_split2('\\1', \$allowed_html, ".
'$allowed_protocols)',
$string);
} # function kses_split
|
replace with:
php Code:function kses_split($string, $allowed_html, $allowed_protocols)
###############################################################################
# This function searches for HTML tags, no matter how malformed. It also
# matches stray ">" characters.
###############################################################################
{
$callback = function ($matches) use ($allowed_html, $allowed_protocols){
return kses_split2($matches[1], $allowed_html, $allowed_protocols);
};
return preg_replace_callback('%(<'. # EITHER: <
'[^>]*'. # things that aren't >
'(>|$)'. # > or end of string
'|>)%', # OR: just a >
$callback,
$string);
} # function kses_split
|
find:
php Code:function kses_normalize_entities($string)
###############################################################################
# This function normalizes HTML entities. It will convert "AT&T" to the correct
# "AT&T", ":" to ":", "&#XYZZY;" to "&#XYZZY;" and so on.
###############################################################################
{
# Disarm all entities by converting & to &
$string = str_replace('&', '&', $string);
# Change back the allowed entities in our entity whitelist
$string = preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/',
'&\\1;', $string);
$string = preg_replace('/&#0*([0-9]{1,5});/e',
'kses_normalize_entities2("\\1")', $string);
$string = preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/',
'&#\\1\\2;', $string);
return $string;
} # function kses_normalize_entities
|
replace with:
php Code:function kses_normalize_entities($string)
###############################################################################
# This function normalizes HTML entities. It will convert "AT&T" to the correct
# "AT&T", ":" to ":", "&#XYZZY;" to "&#XYZZY;" and so on.
###############################################################################
{
# Disarm all entities by converting & to &
$string = str_replace('&', '&', $string);
# Change back the allowed entities in our entity whitelist
$string = preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/',
'&\\1;', $string);
$callback = function (){
return kses_normalize_entities2("\\1");
};
$string = preg_replace_callback('/&#0*([0-9]{1,5});/', $callback, $string);
$string = preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/',
'&#\\1\\2;', $string);
return $string;
} # function kses_normalize_entities
|
open modules/Content/var/fpdf.php
find:
php Code:set_magic_quotes_runtime(0);
|
replace it with:
php Code:@ini_set('magic_quotes_runtime', 0);
|
find:
php Code:set_magic_quotes_runtime($mqr);
|
replace it with:
php Code:@ini_set('magic_quotes_runtime', $mqr);
|
open modules/News/printpdf.php
find:
php Code:$pdf->Output('articles'.$sid.'.pdf', 'I');
|
add before:
|
_________________ Github: RavenNuke
Last edited by neralex on Sat Jun 23, 2018 6:04 am; edited 13 times in total |
|
|
|
kguske
Site Admin
Joined: Jun 04, 2004
Posts: 6433
|
Posted:
Wed Jan 04, 2017 9:49 pm |
|
|
|
|
helidoc
Hangin' Around
Joined: Jul 09, 2006
Posts: 49
|
Posted:
Sun Jun 25, 2017 3:26 pm |
|
Thanks Neralex, now to figure out what to do with the forums mod. since phpbb that comes with raven doesn't work with php7 |
|
|
|
|
neralex
|
Posted:
Sun Jun 25, 2017 3:31 pm |
|
You are right, there are issues with the bbcode.php.
open: modules/Forums/includes/bbcode.php and find:
php Code:$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
|
change it to:
php Code: # PHP7 fix
# http://php.net/manual/en/reference.pcre.pattern.modifiers.php
$text = preg_replace_callback(
"#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#si",
function ($m) use ($uid) {
return "[img:$uid]$m[1]" . str_replace(' ', '%20', $m[3]) . "[/img:$uid]";
},
$text
);
|
Note: I added this also to the thread-opener.
I will check it in the next days because I guess there are more issues like that. I noticed also an SQL error in the index.php of the Forums module, which I will fix later. |
Last edited by neralex on Sun Jun 25, 2017 4:40 pm; edited 1 time in total |
|
|
|
helidoc
|
Posted:
Sun Jun 25, 2017 4:35 pm |
|
Specific to the forums module, I'm finding that folks posts don't show, ie the the topic will post but with no body posted. Haven't drilled down the cause of it yet but it's only with php 7 running on the site, reverting back to 5.6 and posts show as normal. Thanks for the bbcode edits will keep an eye here for further updates and thanks for all the php7 edits |
|
|
|
|
neralex
|
Posted:
Sun Jun 25, 2017 4:53 pm |
|
Thank you for the report.
Each report will help to get it sorted. All my 'live'-projects are running still on 5.6.x because this PHP version is very stable but for the future is it better to find all issues. |
|
|
|
|
moekin
New Member
Joined: May 07, 2010
Posts: 1
|
Posted:
Wed Aug 16, 2017 10:14 am |
|
Thank you so much. This saved my bacon. Really appreciate the work you put into this and sharing it. |
|
|
|
|
neralex
|
Posted:
Thu Aug 17, 2017 5:11 pm |
|
No problem, if you will find more issues, please let me know. |
|
|
|
|
gravutrad
Hangin' Around
Joined: Feb 27, 2012
Posts: 30
|
Posted:
Thu Aug 17, 2017 6:09 pm |
|
Interesting. Noted. Thanks for these tips. |
|
|
|
|
neralex
|
Posted:
Tue Oct 10, 2017 11:32 am |
|
To prevent php7.x warnings caused by deprecated function names of class constructors, I prepared a "little" to-do list.
Note: I noticed also many of these warnings in /includes/xmlrpc/xmlrpc.php, but I wont post it here in detail, because the fixes are causing some other issues, which will be fixed in the PHP7-ready package.
-----------------------
Open /classes/class.legal_doctypes.php
find:
php Code:function Legal_DocTypes($modName='', $lang='')
|
replace it with:
php Code:function __construct($modName='', $lang='')
|
-----------------------
Open /classes/class.legal_document.php
find:
php Code:function Legal_Document($srcModule='')
|
replace it with:
php Code:function __construct($srcModule='')
|
-----------------------
Open /classes/class.paginator.php
find:
php Code:function Paginator($page, $num_rows, $per_page)
|
replace it with:
php Code:function __construct($page, $num_rows, $per_page)
|
-----------------------
Open /includes/NukeSEO/content/content.php
find:
php Code:function seoContent ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/Downloads_GR.php
find:
php Code:function Downloads_GR ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/Encyclopedia.php
find:
php Code:function seoEncyclopedia ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/FAQ.php
find:
php Code:function seoFAQ ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/Forums.php
find:
php Code:function seoForums ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/News.php
find:
php Code:function seoNews ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/Reviews.php
find:
php Code:function seoReviews ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/content/Web_Links.php
find:
php Code:function seoWeb_Links ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhAdmin.php
find:
php Code:function dhAdmin ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhContent.php
find:
php Code:function dhContent ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhDefault.php
find:
php Code:function dhDefault ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhDownloads.php
find:
php Code:function dhDownloads ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhEncyclopedia.php
find:
php Code:function dhEncyclopedia ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhFAQ.php
find:
php Code:function dhFAQ ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhFeeds.php
find:
php Code:function dhFeeds ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhForums.php
find:
php Code:function dhForums ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhGCalendar.php
find:
php Code:function dhGCalendar ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhNews.php
find:
php Code:function dhNews ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhReviews.php
find:
php Code:function dhReviews ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhStories_Archive.php
find:
php Code:function dhStories_Archive ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhSurveys.php
find:
php Code:function dhSurveys ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/NukeSEO/dh/dhWeb_Links.php
find:
php Code:function dhWeb_Links ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open /includes/class.autokeyword.php
find:
php Code:function autokeyword($params, $encoding)
|
replace it with:
php Code:function __construct($params, $encoding)
|
-----------------------
Open /includes/class.php-captcha.php
find:
php Code:function PhpCaptcha(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/Comments/Combo.php
find:
php Code:function RNComm_Combo(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/Comments/FormBase.php
find:
php Code:function RNComm_FormBase(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/Comments/FormFactory.php
find:
php Code:function RNComm_FormFactory(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/Comments/ForumsForm.php
find:
php Code:function ForumsForm(
|
replace it with:
php Code:function __construct(
|
find:
php Code:parent::RNComm_FormBase(
|
replace it with:
php Code:parent::__construct(
|
-----------------------
Open /modules/Comments/HtmlList.php
find:
php Code:functionRNComm_HtmlList(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/Comments/NewsForm.php
find:
php Code:function RNComm_NewsForm(
|
replace it with:
php Code:function __construct(
|
find:
php Code:parent::RNComm_FormBase(
|
replace it with:
php Code:parent::__construct(
|
-----------------------
Open /modules/Comments/ReviewsForm.php
find:
php Code:function RNComm_ReviewsForm(
|
replace it with:
php Code:function __construct(
|
find:
php Code:parent::RNComm_FormBase(
|
replace it with:
php Code:parent::__construct(
|
-----------------------
Open /modules/Comments/SurveysForm.php
find:
php Code:function RNComm_SurveysForm(
|
replace it with:
php Code:function __construct(
|
find:
php Code:parent::RNComm_FormBase(
|
replace it with:
php Code:parent::__construct(
|
-----------------------
Open /includes/nukeSEO/forms/CLinkedSelect.php
find:
php Code:function CLinkedSelect ()
|
replace it with:
php Code:function __construct()
|
-----------------------
Open modules/GCalendar/class.checkboxes.php
find:
php Code:function Checkboxes(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/GCalendar/class.combo.php
find:
replace it with:
php Code:function __construct(
|
find:
php Code:function NumericCombo(
|
replace it with:
php Code:function __construct(
|
find:
php Code:$this->Combo($name, $items, $selKey);
|
replace it with:
php Code:parent::__construct($name, $items, $selKey);
|
-----------------------
Open /modules/GCalendar/class.eventForm.php
find:
php Code:function EventForm(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/GCalendar/class.radio.php
find:
php Code:function RadioButtons(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open /modules/GCalendar/gcInputFilter.php
find:
php Code:function GCInputFilter(
|
replace it with:
php Code:function __construct(
|
-----------------------
Open modules/GCalendar/admin/class.adminEventTable.php
find:
php Code:function AdminEventTable(
|
replace it with:
php Code:function __construct(
|
Happy replacing. |
Last edited by neralex on Sat Jan 06, 2018 12:33 pm; edited 8 times in total |
|
|
|
kguske
|
Posted:
Tue Oct 10, 2017 6:37 pm |
|
Nice, and short |
|
|
|
|
Raven
Site Admin/Owner
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Wed Oct 11, 2017 8:54 am |
|
|
|
|
mike63740
Worker
Joined: Jun 21, 2010
Posts: 102
|
Posted:
Fri Nov 03, 2017 8:42 am |
|
I just upgraded XAMPP Version 1.8.2 to XAMPP Version 7.1.10 with this download:
xampp-win32-7.1.10-0-VC14-installer.exe
* Apache 2.4.28
* MariaDB 10.1.28
* PHP 7.1.10
* phpMyAdmin 4.7.4
The RavenNuke 2.51 database imported error free, but when I executed RavenNuke I got this error on white background:
Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in C:\xampp\htdocs\RavenNukeV2.51\rnconfig.php:282 Stack trace: #0 C:\xampp\htdocs\RavenNukeV2.51\config.php(80): require_once() #1 C:\xampp\htdocs\RavenNukeV2.51\mainfile.php(141): require_once('C:\\xampp\\htdocs...') #2 C:\xampp\htdocs\RavenNukeV2.51\index.php(23): require_once('C:\\xampp\\htdocs...') #3 {main} thrown in C:\xampp\htdocs\RavenNukeV2.51\rnconfig.php on line 282
I assumed from this topic that I should downgrade to a lesser verison of XAMPP. |
|
|
|
|
Raven
|
Posted:
Fri Nov 03, 2017 9:02 am |
|
Mike, did you follow the instructions in the first post of this thread? |
|
|
|
|
mike63740
|
Posted:
Fri Nov 03, 2017 9:17 am |
|
Yes Raven. After reading over this topic, I downloaded and installed:
xampp-win32-5.6.30-0-VC11-installer.exe
* Apache 2.4.25
* MariaDB 10.1.21
* PHP 5.6.30
* phpMyAdmin 4.6.5.2 |
|
|
|
|
Raven
|
Posted:
Fri Nov 03, 2017 9:22 am |
|
The first post explains how to get rid of the errors you posted in your original post about version 7. So the posted fixes don't work? |
|
|
|
|
mike63740
|
Posted:
Fri Nov 03, 2017 9:58 am |
|
I decided from the first post if I install PHP 5.6.30, I would get no errors and have no additional settings to make. Everything is back to normal now.
Raven wrote: | The first post explains how to get rid of the errors you posted in your original post about version 7. So the posted fixes don't work? |
I never tried the fixes for 7. It was a straight install without any editing. |
|
|
|
|
mike63740
|
Posted:
Fri Nov 03, 2017 10:08 am |
|
Raven wrote: | Mike, did you follow the instructions in the first post of this thread? |
Sorry. No I did not. |
|
|
|
|
neralex
|
Posted:
Sun Nov 05, 2017 10:09 am |
|
Note: I noticed that the mysql-functions are removed in php7 - it's supporting mysqli only. That means the whole INSTALLATION process is broken with this version! I'm working on a package for RavenNuke 2.5.1, which will work also with php7. For a fresh installation please don't use it as long the new package is released.
I come closer to some SQL-Errors, which returns while using mysql 5.6+. Some important default-values has been changed.
Some new defaults are based on the TIMESTAMP and DATETIME improvements. That means, default-values like '0000-00-00 00:00:00' for DATETIME fields or '0000-00-00' for DATE fields are not more allowed. The supported range is '1000-01-01' to '9999-12-31'. This affects some queries in the INSTALLATION process (already fixed in my package) and it needs a big check to all affected modules with related INSERT queries.
[ Only registered users can see links on this board! Get registered or login! ]
[ Only registered users can see links on this board! Get registered or login! ]
The 2nd big one is the default: sql_mode=only_full_group_by
Here an example of the Forums index:
Code:SQL Error : 1055 Expression #29 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'rn251php7.t.topic_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title FROM ((( nuke_bbforums f LEFT JOIN nuke_bbposts p ON p.post_id = f.forum_last_post_id ) LEFT JOIN nuke_users u ON u.user_id = p.poster_id ) LEFT JOIN nuke_bbtopics t ON t.topic_last_post_id = f.forum_last_post_id) GROUP BY f.forum_id ORDER BY f.cat_id, f.forum_order
|
Here is the full query:
php Code:$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
FROM ((( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = f.forum_last_post_id)
GROUP BY f.forum_id ORDER BY f.cat_id, f.forum_order";
|
After checking the mysql-docs I figured it out, that the field t.topic_id must be placed also in the GROUP BY clause.
[ Only registered users can see links on this board! Get registered or login! ]
[ Only registered users can see links on this board! Get registered or login! ]
php Code:$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
FROM ((( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = f.forum_last_post_id)
GROUP BY f.forum_id, t.topic_id ORDER BY f.cat_id, f.forum_order";
|
|
|
|
|
|
Doulos
Life Cycles Becoming CPU Cycles
Joined: Jun 06, 2005
Posts: 732
|
Posted:
Thu Nov 23, 2017 2:19 pm |
|
I updated to php7 following the above posts, but I can't seem to get it to work without commenting out the NukeSentinel portion in .htaccess. I haven't had time to look at why, yet. Probably something I did wrong, or didn't do right. |
|
|
|
|
neralex
|
Posted:
Thu Nov 23, 2017 11:25 pm |
|
What exactly do you mean, the CGI-Auth? Enabled error-reporting? Any php errors? |
|
|
|
|
Doulos
|
Posted:
Fri Nov 24, 2017 2:20 am |
|
No errors in log, Just a 500 http error. If I comment out the following code in .htaccess I can access the site and admin.phpCode: <Files admin.php>
<Limit GET POST PUT>
require valid-user
</Limit>
AuthName "Restricted"
AuthType Basic
AuthUserFile /home/mysite/public_html/.staccess
</Files>
|
.staccess does exist and is in the above location.
I have reverted back to php5.4 and will try again over the weekend - if I get time. |
|
|
|
|
Raven
|
Posted:
Fri Nov 24, 2017 12:30 pm |
|
Did you look in your system and Apache logs? |
|
|
|
|
Doulos
|
Posted:
Sat Nov 25, 2017 2:44 am |
|
|
|
|
Doulos
|
Posted:
Sat Nov 25, 2017 4:29 pm |
|
Never mind, I fixed it.
Rebuilt .htaccess and now it is working. Thanks. |
|
|
|
|
|