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

Fixed MacOS char issue #14836

Merged
merged 6 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed `Phalcon\Cli\Console` to pass current container to the `Phalcon\Mvc\ModuleDefinitionInterface::registerAutoloaders()` [#14787](https://github.com/phalcon/cphalcon/issues/14787) [@TimurFlush](https://github.com/TimurFlush)
- Fixed `Phalcon\Db\Dialect\Mysql::createTable()` to create default value with CURRENT_TIMESTAMP ON UPDATE/DELETE [#14797]
- Fixed `Phalcon\Storage\Adapter\*` to no longer accept the `serializer` option as it was clashing with the factory [#14828](https://github.com/phalcon/cphalcon/pull/14828)
- Fixed `Phalcon\Http\Request` to return the correct host on an `UnexpectedValueException` [#14763](https://github.com/phalcon/cphalcon/issues/14763)

# [4.0.3](https://github.com/phalcon/cphalcon/releases/tag/v4.0.3) (2020-01-25)
## Added
Expand Down
14 changes: 8 additions & 6 deletions phalcon/Http/Request.zep
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class Request extends AbstractInjectionAware implements RequestInterface
*/
public function getHttpHost() -> string
{
var host, strict;
var host, strict, cleanHost;

let strict = this->strictHostCheck;

Expand All @@ -459,25 +459,27 @@ class Request extends AbstractInjectionAware implements RequestInterface
/**
* Cleanup. Force lowercase as per RFC 952/2181
*/
let host = strtolower(
let cleanHost = strtolower(
trim(host)
);

if memstr(host, ":") {
let host = preg_replace("/:[[:digit:]]+$/", "", host);
if memstr(cleanHost, ":") {
let cleanHost = preg_replace("/:[[:digit:]]+$/", "", cleanHost);
}

/**
* Host may contain only the ASCII letters 'a' through 'z'
* (in a case-insensitive manner), the digits '0' through '9', and
* the hyphen ('-') as per RFC 952/2181
*/
if unlikely ("" !== preg_replace("/[a-z0-9-]+\.?/", "", host)) {
if unlikely ("" !== preg_replace("/[a-z0-9-]+\.?/", "", cleanHost)) {
throw new UnexpectedValueException("Invalid host " . host);
}
} else {
let cleanHost = host;
}

return (string) host;
return (string) cleanHost;
}

/**
Expand Down