Jump to content

Timeline for PHP7 updates to 2.x?


rickm
 Share

Recommended Posts

Hi,

I'm in the middle of setting up a new PW site and cloned in master from github, but was a bit surprised to see that ProcessWire isnt yet PHP7 compatible.

I mean, it works. But at the top of every page you get a depreciated notice:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Wire has a deprecated constructor in /<path>/wire/core/Wire.php on line 51

Is there any timeframe for when PW will be updated to PHP7? This looks like a fairly minor thing to fix, it's just a bit surprising it's not already done.

There's a very strong push to get people updated to PHP7 in the development community, and all the major hosts seem to be pushing it too, likely due to its lower resource usage, and speed improvements.

If this is something not yet planned, I take it I'd be ok to submit a pull request on github with some, if not all the updates needed to get this compatible with PHP7?

Cheers :)

Link to comment
Share on other sites

That's not really something that would need to be fixed, as the file it's refering to does not use the wire() function as constructor. It's already the right way, but it seems php7 is not picking up that fact because there's no __construct() function present.

  • Like 4
Link to comment
Share on other sites

  • 1 month later...

Not the most beautiful solution but you can just add an empty construct to the Wire class to suppress the deprecation notice like

public function __construct(){}

I don't believe this should cause any trouble in PW (haven't tried it myself), though I wouldn't personally use this in production as I would assume you would just turn off deprecation notice in production. I can understand it being frustrating to have the notice show up in dev when debug is on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...