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

PHP Warning: get_headers(): This function may only be used against URLs #4918

Open
26 opened this issue Jan 22, 2021 · 1 comment
Open

PHP Warning: get_headers(): This function may only be used against URLs #4918

26 opened this issue Jan 22, 2021 · 1 comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error

Comments

@26
Copy link

26 commented Jan 22, 2021

Setup

  • SMW version: 3.1.6
  • MW version: 1.31.6
  • PHP version: 7.0.33-0ubuntu0.16.04.16
  • DB system (MySQL, Blazegraph, etc.) and version: MySQL-5.7.32-0ubuntu0.16.04.1
  • Elasticsearch version: 5.6.16

Issue

This issue came to light after having found the cause of #4488. In the ElasticSearch file ingestion process, a call is made to the get_headers() function in the FileHandler class (here) using a URL that is based on $wgServer.

According to the documentation of $wgServer, MediaWiki supports setting it to a protocol-relative URL (e.g., //www.mediawiki.org). Doing this however causes the previously mentioned call to get_header() to fail, since it is unable to recognize the given URL as a valid URL:

PHP Warning:  get_headers(): This function may only be used against URLs

This causes the get_headers() function to return false, which causes the file ingestion to fail. This should not happen, since a protocol-relative $wgServer should be allowed.

Steps to reproduce the observation:

  • Set $wgServer to a protocol-relative URL (e.g. //www.mediawiki.org)
  • Enable experimental.file.ingest for ElasticStore
  • Run rebuildElasticIndex maintenance script
@26 26 added the bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error label Jan 22, 2021
@kghbln
Copy link
Member

kghbln commented Jan 24, 2021

Thanks for your elaborate report and your findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error
Projects
None yet
Development

No branches or pull requests

2 participants