Fix error number is detected wrongly in tracker mode by tsteur · Pull Request #14571 · matomo-org/matomo · GitHub
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

Fix error number is detected wrongly in tracker mode #14571

Merged
merged 3 commits into from
Jun 26, 2019
Merged

Fix error number is detected wrongly in tracker mode #14571

merged 3 commits into from
Jun 26, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jun 25, 2019

Eg when the error is Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry, it would detect 2300 instead of 1062.
fix DEV-1683

Eg when the error is `Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry`, it would detect 2300 instead of 1062.
fix DEV-1683
@tsteur tsteur added the Needs Review PRs that need a code review label Jun 25, 2019
@tsteur tsteur added this to the 3.10.0 milestone Jun 25, 2019
same behaviour as for regular DB
@tsteur
Copy link
Member Author

tsteur commented Jun 25, 2019

Now PDO and MySQLi uses same code in tracker and regular mode. Ideally would refactor it to use the same method in the background. Not sure if I find time.

@tsteur
Copy link
Member Author

tsteur commented Jun 25, 2019

Now reusing same code and added a basic test

return $match[1] == $errno;
}
return false;
return \Piwik\Db\Adapter\Pdo\Mysql::isPdoErrorNumber($e, $errno);
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the \Piwik\Db\Adapter\Pdo\... classes need to be required in /piwik.php now?

Copy link
Member

Choose a reason for hiding this comment

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

will merge now but @tsteur if this needs an update please go ahead and merge it in a separate PR

Copy link
Member Author

Choose a reason for hiding this comment

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

@diosmosis not sure what you mean? The files will be auto loaded if that's what you mean?

Copy link
Member

Choose a reason for hiding this comment

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

I thought autoloading wasn't used in the tracker side for performance (hence the require_onces in PIWIK_INCLUDE_PATH/piwik.php). I guess it is used?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is definitely used as it's needed for all the plugins etc. those requires could likely be removed.

@mattab mattab merged commit acb892f into 3.x-dev Jun 26, 2019
@mattab mattab deleted the dev-1683 branch June 26, 2019 02:45
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants