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

WP-CLI index timers: Cast values to float #2820

Merged
merged 1 commit into from
Jun 7, 2022
Merged

Conversation

felipeelia
Copy link
Member

Description of the Change

Currently, if the sync takes long enough, an occasional Error: Index failed: Uncaught TypeError: number_format(): Argument #1 ($num) must be of type float, string given in /var/www/html/wp-content/plugins/elasticpress/includes/classes/Command.php:1545 will happen. That occurs because PHP's floats have a limit of digits and anything exceeding that limit will be cast to a string. This PR forces it to cast back to float, eventually dropping precision characters that wouldn't be needed anyway if the sync process is already taking this long.

Closes #2807

Changelog Entry

Fixed: Fatal error related to WP-CLI timers on long-running syncs.

Credits

Props @felipeelia @przestrzal

@felipeelia felipeelia added this to the 4.3.0 milestone Jun 2, 2022
@felipeelia felipeelia self-assigned this Jun 2, 2022
@felipeelia felipeelia modified the milestones: 4.3.0, 4.2.1 Jun 7, 2022
@felipeelia felipeelia merged commit 94f8cfe into develop Jun 7, 2022
@felipeelia felipeelia deleted the fix/issue-2807 branch June 7, 2022 17:33
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.

QUESTION: Sync crashes always after ~17 minutes
2 participants