Summary: | www/oscommerce: patch to make compatible with php70+ | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Greg Quinlan <gwq_uk> | ||||
Component: | Individual Port(s) | Assignee: | Dmitry Marakasov <amdmi3> | ||||
Status: | Closed Overcome By Events | ||||||
Severity: | Affects Many People | CC: | w.schwarzenfeld | ||||
Priority: | --- | ||||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
www/oscommerce||2018-12-30|Has expired: Works only with EOL php 5.6. Thanks, yes I am aware and did have it working (on that version). What I want to achieve is to fix all the depreciated PHP code/commands from PHP5.6 (working) to PHP7+ (not working) in the existing (current) oscommerce PHP code. I could not find the official oscommerce 2.3.4.1 source code on gthub.com! That would have been my preference! I want to see if wen@FreeBSD.org has any influence over oscommerce's development team (to merge my changes). This isn't difficult, but obviously not a priority for them. https://www.oscommerce.de/Products Maybe you try v2.4.0 beta ? Did not see that... After a quick glance they have made the exactly the some changes.. :) there are files that don't exist (anymore) between versions, extra code (of course) and they missed this one. ./catalog/includes/classes/navigation_history.php code: (starting at line 133) function unserialize($broken) { for(reset($broken);$kv=each($broken);) { // ^^^^ $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } This should be: code: function unserialize($broken) { foreach ($broken as $k => $v) { $kv = [$k, $v]; } $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } I mean the exact same changes. (where "each()" neeeded to be removed and replaced with "foreach()") so I VERY confident in my patches! :) And all that extra code most be regression tested, that will take a long time. oscommerce was removed from the ports collection. |
Created attachment 201689 [details] Both files that can be extracted using "tar xzf both_files.tgz" Background: For some time the oscommerce port has been ignored due to compatibility problems with php70+. The main issue is that "each()" has been "deprecated" from php70+ and oscommerce uses it extensively. I downloaded the latest oscommerce from oscommerce.com which at the time was version 2.3.4.1 . After looking at the effected code and carefully translating each command that used "each()" to use "foreach()" instead. Which has been available since php4.?! === #This code example 1: reset($array); while (list($key, ) = each($array)) { #Is updated to this code example 1: foreach(array_keys($array) as $key) { === #This code example 2: reset($array); while (list(, $value) = each($array)) { #Is updated to this code example 2 foreach($array as $value) { === # This code example 3 reset($array); while (list($key, $value) = each($array)) { #Is updated to example 3 foreach($array as $key => $value) { === Thses are the proposed fixes to all the effected files in oscommerce2.3.4.1 Attached are the "diff -u" (patches_oscommerce_php7_each.tgz) and actual patched files ending in "<file>.patched" (patched_files_oscommerce_php7_each.tgz) Please look at the code carefully! Thanks for your help. There is also a list of the patched files called "files_patched". I have also installed (from packages) php73-mysqli-7.3.1_1 # The mysqli shared extension for php Note: I still get the error: "Unknown extension mysql for PHP 73."