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

X-HTTP-METHOD-OVERRIDE not worked. #12478

Closed
tanioka-takeshi opened this issue Dec 16, 2016 · 1 comment
Closed

X-HTTP-METHOD-OVERRIDE not worked. #12478

tanioka-takeshi opened this issue Dec 16, 2016 · 1 comment
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@tanioka-takeshi
Copy link

Expected and Actual Behavior

getMethod In Phalcon\Http\Request,

		if "POST" === requestMethod {
			let headers = this->getHeaders();
			if fetch overridedMethod, headers["X-HTTP-METHOD-OVERRIDE"] {
				let returnMethod = overridedMethod;
			} elseif this->_httpMethodParameterOverride {
				if fetch spoofedMethod, _REQUEST["_method"] {
					let returnMethod = spoofedMethod;
				}
			}
		}

You expects that headers variables contains uppercase "X-HTTP-METHOD-OVERRIDE".
But,

		for name, value in _SERVER {
			if starts_with(name, "HTTP_") {
				let name = ucwords(strtolower(str_replace("_", " ", substr(name, 5)))),
					name = str_replace(" ", "-", name);
				let headers[name] = value;
			} elseif isset contentHeaders[name] {
				let name = ucwords(strtolower(str_replace("_", " ", name))),
					name = str_replace(" ", "-", name);
				let headers[name] = value;
			}
		}

getHeaders method uses ucwords, so returns "X-Http-Method-Override".

Details

  • Phalcon version: > 3.0.0
@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

@sergeyklay sergeyklay assigned sergeyklay and unassigned sergeyklay Dec 24, 2016
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

3 participants