New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usages of each() to avoid deprecated warnings in PHP 7.2 #13829

Merged
merged 17 commits into from Mar 27, 2018

Conversation

Projects
None yet
4 participants
@opengeek
Member

opengeek commented Mar 22, 2018

What does it do?

Replaces usages of each() in the core (as well as in xPDO and Smarty dependencies).

Why is it needed?

The each() function is deprecated in PHP 7.2 and causes warnings when encountered.

Related issue(s)/PR(s)

modxcms/xpdo#132
modxcms/xpdo#134

opengeek added some commits Jun 15, 2017

Merge remote-tracking branch 'xpdo/2.x' into 2.x
* xpdo/2.x:
  Make InnoDB the default engine for MySQL
  Add missing return statements to built-in validation classes
Merge remote-tracking branch 'xpdo/2.x' into 2.x
* xpdo/2.x:
  Generate engine into the map files for MySQL
Replace all deprecated while/each() loops with foreach() loops
each() is deprecated in PHP 7.2 and this will solve the deprecated warnings
Replace all deprecated while/each() loops with foreach() loops for PH…
…P 7.2 compat

Merge branch 'each-deprecated' into 2.x

* each-deprecated:
  Replace all deprecated while/each() loops with foreach() loops
  Fix unit tests for use with PHPUnit 4.3.x
Merge remote-tracking branch 'xpdo/2.x' into 2.x
* xpdo/2.x:
  Replace all deprecated while/each() loops with foreach() loops
  Update version for 2.7.0-dev
  Fix unit tests for use with PHPUnit 4.3.x
  Update version for 2.6.0-pl release
Missed one instance of each() in xPDO class + some in unit tests
NOTE: also fixes unit test for embedded escape chars on sqlite/sqlsrv
Merge remote-tracking branch 'xpdo/2.x' into 2.x
* xpdo/2.x:
  Missed one instance of each() in xPDO class + some in unit tests
Update xPDO to address deprecated usage of each() for PHP 7.2
Merge remote-tracking branch 'xpdo/2.x' into each-deprecated

* xpdo/2.x:
  Missed one instance of each() in xPDO class + some in unit tests
  Replace all deprecated while/each() loops with foreach() loops
  Update version for 2.7.0-dev
  Fix unit tests for use with PHPUnit 4.3.x
  Update version for 2.6.0-pl release
  Generate engine into the map files for MySQL
  Make InnoDB the default engine for MySQL
  Add missing return statements to built-in validation classes

@opengeek opengeek added this to the v2.6.2 milestone Mar 22, 2018

@OptimusCrime

This comment has been minimized.

Contributor

OptimusCrime commented Mar 22, 2018

Have you accidentally turned on some code transformation in your IDE?

Why is $foo[$bar]['baz'] changed to $foo[ $bar ][ 'baz' ]? There also seem to be a lot of other things in this PR.

@opengeek

This comment has been minimized.

Member

opengeek commented Mar 22, 2018

That is from the Smarty update @OptimusCrime — they apparently reformated their entire codebase. And updating Smarty has broken a unit test as well. Loud Sigh.

Update Smarty to 3.1.31
Addresses issue with deprecated warnings in PHP 7.2 from each() usage

@opengeek opengeek requested review from Alroniks, Mark-H and theboxer Mar 23, 2018

@Alroniks Alroniks self-assigned this Mar 27, 2018

@Alroniks Alroniks merged commit 33ff340 into modxcms:2.6.x Mar 27, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

Alroniks added a commit that referenced this pull request Mar 27, 2018

Replace usages of each() to avoid deprecated warnings in PHP 7.2 #13829
* upstream/pr/13829:
  Update Smarty to 3.1.31
  Update Snoopy class in magpieRSS to replace deprecated each() calls
  Replace all deprecated while/each() loops with foreach() loops for PHP 7.2 compat
  Missed one instance of each() in xPDO class + some in unit tests
  Replace all deprecated while/each() loops with foreach() loops
  Update version for 2.7.0-dev
  Fix unit tests for use with PHPUnit 4.3.x
  Update version for 2.6.0-pl release
  Generate engine into the map files for MySQL
  Make InnoDB the default engine for MySQL
  Add missing return statements to built-in validation classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment