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

Remove 0 as request data #2068

Merged
merged 1 commit into from
May 24, 2022
Merged

Remove 0 as request data #2068

merged 1 commit into from
May 24, 2022

Conversation

franmomu
Copy link
Contributor

Checking errors found by PHPStan, there is this one, here the thing is that Request::getData() is supposed to return an array:

Elastica/src/Request.php

Lines 84 to 92 in 72a4598

/**
* Return request data.
*
* @return array Request data
*/
public function getData()
{
return $this->getParam('data');
}

This was added in #640 (8 years ago) and the test was removed in #932.

So I don't know if the 0 is a possible value so we should modify the return type of Request::getData() or this can be removed.

@ruflin
Copy link
Owner

ruflin commented May 23, 2022

@Tobion @leabaertschi I know #640 is years ago but do you remember by chance why we needed this and if it still applies today?

@leabaertschi
Copy link
Contributor

Sorry, I don't remember, I haven't worked with elasticseach in years.

@ruflin
Copy link
Owner

ruflin commented May 24, 2022

I did a quick test. I think the following was working in old versions of Elasticsearch for analyze: https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-analyze.html

curl -X GET "http://elastic:changeme@localhost:9200/_analyze?pretty" -H 'Content-Type: application/json' -d'0'

Looking at the current docs, it seems it is always an object that is expected: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html

Lets move forward with this.

@franmomu Can you add a changelog entry? Thanks for the cleanup.

@franmomu
Copy link
Contributor Author

done, thanks for checking into this!

@thePanz thePanz merged commit 3bcd0a6 into ruflin:master May 24, 2022
@thePanz
Copy link
Collaborator

thePanz commented May 24, 2022

Merged @franmomu , thanks!

@franmomu franmomu deleted the remove_comparison branch May 24, 2022 09:14
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.

4 participants