Skip to content
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

Fixes: a few issues found when running PHP 7.3 #12487

Merged
merged 6 commits into from
Sep 9, 2018
Merged

Fixes: a few issues found when running PHP 7.3 #12487

merged 6 commits into from
Sep 9, 2018

Conversation

josephzidell
Copy link

I tried running 2.x on PHP 7.3, and fixed a few simple issues, such as:

  • Issue with preg_match()
  • Undefined variables

* Issue with preg_match()
* Undefined variables
@markstory markstory added this to the 2.10.12 milestone Aug 21, 2018
}
if ($modifiedSince) {
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
} else {
$timeMatches = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could hoist these to line 1164 and do $etagMatches = $timeMatches = false.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if (empty($checks)) is now never empty

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garas How about we wrap in array_filter? if (empty(array_filter($checks)))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@garas garas Aug 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fails (in 3.6 branch).

Maybe

$checks = array();
if ($responseTag) {
            $checks[] = ...;
}
if ($modifiedSince...) {
            $checks[] = ...;
}
// no compact()

There is difference [ ] vs [false, false] here.

Port these changes to 3.6 too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified. I'll try to get to 3.6 later

Copy link
Member

@garas garas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail

@@ -95,6 +95,7 @@ public function trigger($callback, $params = array(), $options = array()) {
if (empty($this->_enabled)) {
return true;
}
$subject = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail here too.

Very similar problem.


To CakePHP Team: Why Travis tests are not running on 2.x?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To CakePHP Team: Why Travis tests are not running on 2.x?

I'm not sure. Travis used to run tests for 2.x Its possible that there is a problem with the configuration file, or perhaps we're trying to use an unsupported worker type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like travis ran tests for 2.x 8 days ago I'm not sure why it isn't running this pull request.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge this as this seems to be a Travis issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail here, so should be fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run tests:

lib/Cake/Console/cake test core AllTests

You can also run only some test cases like Utility/ObjectCollection or Network/CakeResponse

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot install PHPUnit 3.7, as I already have 7.3 installed on my machine. Can you help me here, by showing me the issue? Could not find it in the PR tools

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can install phpunit in CakePHP dir with composer require --dev phpunit/phpunit:"3.7.38"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a fix, and now both tests are passing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this get merged?

@@ -95,6 +95,7 @@ public function trigger($callback, $params = array(), $options = array()) {
if (empty($this->_enabled)) {
return true;
}
$subject = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail here, so should be fixed

@markstory markstory modified the milestones: 2.10.12, 2.10.13 Sep 3, 2018
@markstory
Copy link
Member

@josephzidell I will get this merged when I get a chance to run tests locally, as travis is not cooperating.

@markstory markstory self-assigned this Sep 8, 2018
@josephzidell
Copy link
Author

Thanks @markstory

@markstory markstory merged commit 2bea29d into cakephp:2.x Sep 9, 2018
@josephzidell
Copy link
Author

josephzidell commented Sep 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants