Jump to content



Photo
- - - - -

PHP 7


  • Please log in to reply
63 replies to this topic

#41   Lioelx

Lioelx
  • Members
  • 164 posts
  • Real Name:Lionel
  • Gender:Male
  • Location:Spain

Posted 14 January 2017 - 18:23

Tanks Dan


No external links here, thank you


#42   xinn2005

xinn2005
  • Members
  • 7 posts
  • Real Name:Cindy Na
  • Gender:Female
  • Location:United States

Posted 18 January 2017 - 06:38

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;

    }  



#43   xinn2005

xinn2005
  • Members
  • 7 posts
  • Real Name:Cindy Na
  • Gender:Female
  • Location:United States

Posted 18 January 2017 - 06:48

This might be of help....

 

https://github.com/B...i/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. 



#44   Dan Cole

Dan Cole
  • Community Sponsor
  • 1,676 posts
  • Real Name:Dan Cole
  • Gender:Male
  • Location:Ontario, Canada

Posted 18 January 2017 - 12:32

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


Edited by Dan Cole, 18 January 2017 - 12:32.


#45   BrockleyJohn

BrockleyJohn
  • Community Sponsor
  • 495 posts
  • Real Name:John Ferguson
  • Gender:Male
  • Location:sarf Landin

Posted 20 January 2017 - 14:49

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/B...mpatibility_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.

Edited by BrockleyJohn, 20 January 2017 - 14:50.

BS Edge for PHP7 - here on github: https://github.com/B...i/PHP-7-changes

Bootstrap addons - one per branch on github: https://github.com/B...iew-of-Branches

 

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later integration at 2.3.x


#46   Lioelx

Lioelx
  • Members
  • 164 posts
  • Real Name:Lionel
  • Gender:Male
  • Location:Spain

Posted 23 January 2017 - 18:30

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


#47   BrockleyJohn

BrockleyJohn
  • Community Sponsor
  • 495 posts
  • Real Name:John Ferguson
  • Gender:Male
  • Location:sarf Landin

Posted 23 January 2017 - 19:16

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.


Edited by BrockleyJohn, 23 January 2017 - 19:17.

BS Edge for PHP7 - here on github: https://github.com/B...i/PHP-7-changes

Bootstrap addons - one per branch on github: https://github.com/B...iew-of-Branches

 

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later integration at 2.3.x


#48   Lioelx

Lioelx
  • Members
  • 164 posts
  • Real Name:Lionel
  • Gender:Male
  • Location:Spain

Posted 23 January 2017 - 19:53

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


#49   MrPhil

MrPhil
  • Members
  • 7,012 posts
  • Real Name:Phil
  • Gender:Male

Posted 23 January 2017 - 23:16

According to http://php.net/manua...ypt-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.



#50   BrockleyJohn

BrockleyJohn
  • Community Sponsor
  • 495 posts
  • Real Name:John Ferguson
  • Gender:Male
  • Location:sarf Landin

Posted 24 January 2017 - 08:10

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.


BS Edge for PHP7 - here on github: https://github.com/B...i/PHP-7-changes

Bootstrap addons - one per branch on github: https://github.com/B...iew-of-Branches

 

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later integration at 2.3.x


#51   Lioelx

Lioelx
  • Members
  • 164 posts
  • Real Name:Lionel
  • Gender:Male
  • Location:Spain

Posted 24 January 2017 - 10:53

Hi, I've talked to Redsys and they're working on compatibility with php7. I will continue using php5.6 for now.
Thank you very much


No external links here, thank you


#52   cornishpirate

cornishpirate
  • Members
  • 136 posts
  • Real Name:Alan
  • Location:Cornwall, England

Posted 26 February 2017 - 10:52

Very interesting summary of PHP performance increase over the versions:

 

https://www.phpclass...-evolution.html

 

Real incentive to move to PHP 7 !

 

See also the potential for what may be PHP 8.



#53   burt

burt

    I drink and I know things

  • Community Team
  • 12,492 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 26 February 2017 - 11:34

Changing the codebase to deal with php7 is next on the to-do list.

Need help with that please.  Coding/Testing etc.


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#54   14steve14

14steve14
  • Members
  • 4,385 posts
  • Real Name:Steve
  • Gender:Male
  • Location:Dorset UK

Posted 26 February 2017 - 12:00

@burt

 

Would love to help Gary but on checking, my host has yet to add php7 as an option. Sorry.


REMEMBER BACKUP, BACKUP AND BACKUP

 

Find information about the bootstrap community version here

 

Make it idiot proof and someone will make a better idiot.


#55   Dan Cole

Dan Cole
  • Community Sponsor
  • 1,676 posts
  • Real Name:Dan Cole
  • Gender:Male
  • Location:Ontario, Canada

Posted 26 February 2017 - 12:53

@burt  I'm limited to Gary....my main hosting package doesn't have an option to change to php 7 and I don't think my test host does either but I'll check that and let you know.

 

Dan

 

PS:  Checked test hosting account and it is not an option there either.


Edited by Dan Cole, 26 February 2017 - 12:56.


#56   Lioelx

Lioelx
  • Members
  • 164 posts
  • Real Name:Lionel
  • Gender:Male
  • Location:Spain

Posted 26 February 2017 - 16:36

Changing the codebase to deal with php7 is next on the to-do list.

Need help with that please.  Coding/Testing etc.

Hi, @burt,

I have php7.1 installed on my vps. I volunteer to test.

My shop is optimized with pack  https://github.com/B...mpatibility_01/ for php7 and work well.

Regards


No external links here, thank you


#57   cornishpirate

cornishpirate
  • Members
  • 136 posts
  • Real Name:Alan
  • Location:Cornwall, England

Posted 26 February 2017 - 16:54

PHP 7 is available with xampp.

#58   inra311

inra311
  • Members
  • 37 posts
  • Real Name:Ingo
  • Gender:Male

Posted 28 February 2017 - 18:51

A general question: I am using the latest 'Master' version (gburton responsive master) and wonder in how far it is supposed to run under PHP 7 or not? at this time

 

At least, I switched to PHP 7.0 for a short test and was pleased to see that the shop, and also all my various wordpress websites, were still running, no white screens or error messages. I then went back to 5.6 as I could not afford intensive testing with the live shop at the moment.

 

What do you think, what to expect? And should I rather try 7.0 sooner or better wait a while?



#59   John W

John W

    Woof Woof!

  • Members
  • 626 posts
  • Real Name:John W.
  • Gender:Male
  • Location:Orlando, Fl

Posted 28 February 2017 - 22:04

I've been running 7.07 on my local machine but i just updated it to 7.16 32 bit and then up to 7.16 64 bit.  There are new vesions of xdebug for 7.0 and 7.1 both in 32 and 64 bit.

 

One thing i did serveral years ago following the advice of Apachehaus and Apache Lounge (recomended on php.net for windows 64bit Apache) is to set up Apache on it's on and php on it's own, as well as mysql on it's own.  Not as hard as you might think and the flexibility to change versions is really easy.  You can keep diferent php versions and and I can switch pretty quickly.  I aslo created a cmd file that i got from Xdebug so when I have an error I can click on the link and it opens up the file in netbeans on the error line. 

 

I can help with testing and maybe coding some, but i have the attention span of a housefly.


I'm not really a dog.


#60   BrockleyJohn

BrockleyJohn
  • Community Sponsor
  • 495 posts
  • Real Name:John Ferguson
  • Gender:Male
  • Location:sarf Landin

Posted 28 February 2017 - 22:09

I'm happy to set up an account in my hosting for anyone who wants to do community testing - just let me know. Only snag is it's in UK


BS Edge for PHP7 - here on github: https://github.com/B...i/PHP-7-changes

Bootstrap addons - one per branch on github: https://github.com/B...iew-of-Branches

 

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later integration at 2.3.x