-
Notifications
You must be signed in to change notification settings - Fork 316
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
BUG: Command Line Undefined Variable Warning Notice Flood #2240
Comments
Hi @notjustcode-sp, actually, the warning flood happens because Elasticsearch doesn't send that info for the error you are having (it does for some others). The if/else is there to remove errored objects from the full list and works as expected. You do have a point though. The plugin shouldn't assume |
Hi @felipeelia, unfortunately #2243 does not fix the issue:
The if/else that removes errored objects is never reached because of the continue statement on line 941. This means that when we get to line 959 $index_objects does exist, but $item does not exist. It's the foreach on line 959 that's causing the flood we're reporting here. As previously stated, we're not sure why this foreach statement is using $item on line 960 as we don't know what the purpose of this foreach statement is. |
You are absolutely right, @notjustcode-sp, sorry. That Thanks! |
Success! No PHP warning flood:
We thought $item looked wrong, but didn't know enough about the code to fix it! Thanks! |
When performing a command line sync in blocks of 350 we get the following notice three times:
Warning: Request Entity Too Large
Followed by a warning flood:
PHP Notice: Undefined variable: item in elasticpress/includes/classes/Command.php on line 960
Followed by a further flood:
We can see that the $attempts for loop is hitting the continue statement on line 941 meaning that we never get to the if/else statement on line 944.
This means that when we get to line 959 $index_objects hasn't been reset (line 951) and $item does not exist (line 945) hence the warning flood.
Whilst the foreach of line 959 could be guarded with a check to see if $item is set, we're not sure whether this is appropriate as we don't understand enough about the code to know what this foreach is doing and why it's using $item.
Steps to Reproduce
Visit top level WP directory.
Run the command:
wp elasticpress index --setup
Observe the warning flood.
Expected behavior
Warning that the Request entity is too large without the flood of "undefined variable" warning messages.
Environment information
The text was updated successfully, but these errors were encountered: