cornishpirate Posted April 29, 2016 Author Share Posted April 29, 2016 Dan, well it started as RC2a ! It's very heavily modified, both in terms of keeping it updated, secure, improving efficiency, making it responsive and extending facilities. However, it didn't take too much to make it run under PHP 7. I just made a point of ensuring all notices, warnings and errors from the log were dealt with. Alan PS Having a lifetime in software developement helped! Link to comment Share on other sites More sharing options...
Dan Cole Posted April 30, 2016 Share Posted April 30, 2016 @@cornishpirate A frankinstore eh? Well done. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
xinn2005 Posted January 13, 2017 Share Posted January 13, 2017 I just upgraded the PHP version to 7.0 for my website. While most warnings were fixed by replacing the old class constructors with __construct(), there are some pretty serious issues with the child class calling parent class constructors in the original code. For example, includes/classes/message_stack.php extends tableBox and has some code that created the "Call to undefined method" error: class tableBox { // class constructor function __construct($contents, $direct_output = false) { ... } } class messageStack extends tableBox { function __construct() { ... } function output($class) { .............. // the line below throws Call to undefined method error return $this->tableBox($output); } Replacing the line above with parent::__construct() didn't work. I would appreciate it if you could share your thoughts on this. Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted January 13, 2017 Share Posted January 13, 2017 I just upgraded the PHP version to 7.0 for my website. While most warnings were fixed by replacing the old class constructors with __construct(), there are some pretty serious issues with the child class calling parent class constructors in the original code. For example, includes/classes/message_stack.php extends tableBox and has some code that created the "Call to undefined method" error: class tableBox { // class constructor function __construct($contents, $direct_output = false) { ... } } class messageStack extends tableBox { function __construct() { ... } function output($class) { .............. // the line below throws Call to undefined method error return $this->tableBox($output); } Replacing the line above with parent::__construct() didn't work. I would appreciate it if you could share your thoughts on this. to be fair, you should use these boxes any more. shouldn t be too hard to find examples of how to rewrite these in modern div based code KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Dan Cole Posted January 13, 2017 Share Posted January 13, 2017 @@xinn2005 Cindy out of curiosity what version of osC are you using? Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
xinn2005 Posted January 13, 2017 Share Posted January 13, 2017 I am using v2.3.4. I guess I could replace the "boxes" with div based code but it would not change the hierarchy of the classes that caused the error. Link to comment Share on other sites More sharing options...
Dan Cole Posted January 13, 2017 Share Posted January 13, 2017 @@xinn2005 Cindy you might want to have a look and see what was done to fix it, if anything, on the EDGE version. I think it is PHP 7 ready. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
dr_lucas Posted January 13, 2017 Share Posted January 13, 2017 You can easily fix it. Read this: http://stackoverflow.com/questions/35128323/php-extended-class Did I help you? Click "Like" or "Thanks"! It's free of charge. :)My contributions:Total Configuration (newly updated 07/2018, for both osC 2.2 and 2.3.4.1 BS Frozen CE)User Tracking with Admin 1.0 (newly updated 07/2018)FedEx - Web Services v9, FAQ System , Who's Online Enhancement, Order Editor, MoneyBookers IPN, Ship in Cart (MS2), Admin Products Paging, Margin Report v1.00, 2Checkout INS / IPN (Instant Notification System) for MS2.2, Visitor Web Stats, Time Zone Offset - Adjust to match your location, Category Meta Tags Link to comment Share on other sites More sharing options...
xinn2005 Posted January 13, 2017 Share Posted January 13, 2017 @@Dan Cole Thanks for the info Dan! I was actually looking for the PHP7 compatible version. Another way to deal with it is to bypass calls to messageStack within create_account. Will see how these approaches work out. Appreciate your help! Link to comment Share on other sites More sharing options...
xinn2005 Posted January 13, 2017 Share Posted January 13, 2017 @dr_lucas Exactly the topic I've been searching for! I did some similar work but it didn't go through. Will take a closer look. Thanks a bunch! Link to comment Share on other sites More sharing options...
Dan Cole Posted January 13, 2017 Share Posted January 13, 2017 @@xinn2005 And you'll find EDGE here if you want to have a look at it or contribute to it. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Lioelx Posted January 14, 2017 Share Posted January 14, 2017 Hi all This is correct? Original code class cm_navbar { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function cm_navbar() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_NAVBAR_TITLE; $this->description = MODULE_CONTENT_NAVBAR_DESCRIPTION; if ( defined('MODULE_CONTENT_NAVBAR_STATUS') ) { $this->sort_order = MODULE_CONTENT_NAVBAR_SORT_ORDER; $this->enabled = (MODULE_CONTENT_NAVBAR_STATUS == 'True'); } } Changed code for php7.1 class cm_navbar { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_NAVBAR_TITLE; $this->description = MODULE_CONTENT_NAVBAR_DESCRIPTION; if ( defined('MODULE_CONTENT_NAVBAR_STATUS') ) { $this->sort_order = MODULE_CONTENT_NAVBAR_SORT_ORDER; $this->enabled = (MODULE_CONTENT_NAVBAR_STATUS == 'True'); } } The cange is line 21 Regards No external links here, thank you Link to comment Share on other sites More sharing options...
xinn2005 Posted January 14, 2017 Share Posted January 14, 2017 @@Lioelx Yes that was the correct fix. Link to comment Share on other sites More sharing options...
Lioelx Posted January 14, 2017 Share Posted January 14, 2017 Tanks @@xinn2005. Well put the 2.3.4 gold for php7 has a lot of work ... No external links here, thank you Link to comment Share on other sites More sharing options...
Dan Cole Posted January 14, 2017 Share Posted January 14, 2017 This might be of help.... https://github.com/BrockleyJohn/Responsive-osCommerce/wiki/PHP-7-changes Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Lioelx Posted January 14, 2017 Share Posted January 14, 2017 Tanks Dan No external links here, thank you Link to comment Share on other sites More sharing options...
xinn2005 Posted January 18, 2017 Share Posted January 18, 2017 Thanks for everybody's input. Here are the changes I made and tested successfully. In addition to the messageStack sub class I had to make similar modifications to the child classes defined in boxes.php such as infoBox, contentBox, etc. To be honest I found these classes around the "boxes" a bit confusing and over-complicated but at least they keep my website running at the moment. class tableBox { // class constructor function __construct() {...} // empty constructor function __tableBox($contents, $direct_output = false) { ... } // moved all code from the original constructor to this function } class messageStack extends tableBox { function __construct() { parent::__construct(); // other actions } function output($class) { $contents = parent::tableBlock($output); return $contents; } Link to comment Share on other sites More sharing options...
xinn2005 Posted January 18, 2017 Share Posted January 18, 2017 This might be of help.... https://github.com/BrockleyJohn/Responsive-osCommerce/wiki/PHP-7-changes Dan Dan - I had a quick look at the link above and found that the class constructor format, __construct(), required by PHP7 was not present in almost all classes. I modified my code because my hosting company upgraded the server environment to php7. I would assume that the oscommerce community should be aware of this fix. Again - I truly appreciate your timely help. Link to comment Share on other sites More sharing options...
Dan Cole Posted January 18, 2017 Share Posted January 18, 2017 Dan - I had a quick look at the link above and found that the class constructor format, __construct(), required by PHP7 was not present in almost all classes. I modified my code because my hosting company upgraded the server environment to php7. I would assume that the oscommerce community should be aware of this fix. Again - I truly appreciate your timely help. @@xinn2005 Hi Cindy, the changes required for php7 compatibility are a bit lost on me (actually more then a bit) but I'll reference @@BrockleyJohn who has been actively involved in that project so he is aware of this thread and your changes. Thanks for your input and posts. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
BrockleyJohn Posted January 20, 2017 Share Posted January 20, 2017 Dan - I had a quick look at the link above and found that the class constructor format, __construct(), required by PHP7 was not present in almost all classes. I modified my code because my hosting company upgraded the server environment to php7. I would assume that the oscommerce community should be aware of this fix. Again - I truly appreciate your timely help. @inn2005 Hi Cindy, you need to be looking in the php7 branch not the master branch to pick up these changes. Following the link previously given without changing branches will (currently) take you here: https://github.com/BrockleyJohn/Responsive-osCommerce/tree/php7_compatibility_01/ It's not actually a requirement of php7 to have the constructor defined, so you don't necessarily have a method __construct unless there is a need for it. You cannot have a method with the same name as the class unless you have a __construct method, though. That said, I don't remember any classes not having a constructor. If you have found any classes in this branch that are not php7 compliant please send me a link - it means I've made a mistake rebuilding a new branch to get rid of conflicts with master. Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
Lioelx Posted January 23, 2017 Share Posted January 23, 2017 Hi, wath is the correct code fro work whit php7 error: Deprecated: Function mcrypt_encrypt() is deprecated in /httpdocs/includes/modules/payment/apiRedsys/apiRedsysFinal.php on line 70 function encrypt_3DES($message, $key){ // Se establece un IV por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map("chr", $bytes)); //PHP 4 >= 4.0.2 // Se cifra $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv); //PHP 4 >= 4.0.2 return $ciphertext; } Regards No external links here, thank you Link to comment Share on other sites More sharing options...
BrockleyJohn Posted January 23, 2017 Share Posted January 23, 2017 Hi, wath is the correct code fro work whit php7 error: Deprecated: Function mcrypt_encrypt() is deprecated in /httpdocs/includes/modules/payment/apiRedsys/apiRedsysFinal.php on line 70 function encrypt_3DES($message, $key){ // Se establece un IV por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map("chr", $bytes)); //PHP 4 >= 4.0.2 // Se cifra $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv); //PHP 4 >= 4.0.2 return $ciphertext; } Regards Oh dear! You can replace the encryption with another that is supported eg. openssl_encrypt but whether that will work depends on whether it produces exactly the same encryption result (I've a feeling it doesn't) and what happens with the returned result. If you are just using it within the module to compare against something that has been passed to the payment provider and returned, then it might work. However, if it's used on the other side of the api you need to use the same encryption that they are using. Thirdly, if it's encrypting something that is stored (like a password) then all stored values will be junk if you change the encryption and should be removed or ignored. I think I came across Magento hitting this issue in their core code last year but I don't recall seeing what they did about it. Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
Lioelx Posted January 23, 2017 Share Posted January 23, 2017 Hello @@BrockleyJohn, I can not change the encryption, the tpv server is the one that uses. Redsys technical service (payment gateway) says to enable mcrypt on the server, it has always been enabled!!! Regards No external links here, thank you Link to comment Share on other sites More sharing options...
MrPhil Posted January 23, 2017 Share Posted January 23, 2017 According to http://php.net/manual/en/function.mcrypt-encrypt.php, the mcrypt library was abandoned a decade ago! No one should be using it. If Redsys insists on your using it, I would suggest that you start looking for another payment gateway -- this one is seriously insecure. Link to comment Share on other sites More sharing options...
BrockleyJohn Posted January 24, 2017 Share Posted January 24, 2017 Redsys technical service (payment gateway) says to enable mcrypt on the server, it has always been enabled!!! Tell them that mcrypt encryption is deprecated on php7 and soon it will be removed altogether. If they don't do anything about it very soon they won't have any php-based customers. In the meantime, start talking to some other providers. Check if their api works on php7. If there's not a payment module available for osc, one can be written but they're quite a lot of work so I don't suppose anyone will do it for free! If you need this working in the short term while you sort out a proper solution, it's possible to suppress deprecated notices so that the code still runs through properly. Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.