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

[BUG]: object return type hint leads to fatal error #14987

Closed
sergeyklay opened this issue May 2, 2020 · 1 comment · Fixed by #14988
Closed

[BUG]: object return type hint leads to fatal error #14987

sergeyklay opened this issue May 2, 2020 · 1 comment · Fixed by #14988
Assignees
Labels
bug A bug report status: low Low

Comments

@sergeyklay
Copy link
Contributor

It seems object return type hint isn't properly handled by Zephir.

public function withRequestTarget(var requestTarget) -> object
{
if unlikely preg_match("/\s/", requestTarget) {
throw new InvalidArgumentException(
"Invalid request target: cannot contain whitespace"
);
}
return this->cloneInstance(requestTarget, "requestTarget");
}

At least for the following code:

$request = new Phalcon\Http\Message\ServerRequest();
$newInstance = $request->withRequestTarget('/test');

I get the following error:

PHP Fatal error:  Return value of Phalcon\Http\Message\AbstractRequest::withRequestTarget() 
must be an instance of NULL, instance of Phalcon\Http\Message\ServerRequest returned
in Unknown on line 0

As I can see object return type hint is just a stub and never had a real handler inside Zephir.

@sergeyklay sergeyklay added bug A bug report status: unverified Unverified labels May 2, 2020
@sergeyklay sergeyklay self-assigned this May 2, 2020
@sergeyklay sergeyklay removed the status: unverified Unverified label May 2, 2020
sergeyklay added a commit that referenced this issue May 3, 2020
@sergeyklay sergeyklay linked a pull request May 3, 2020 that will close this issue
5 tasks
@sergeyklay
Copy link
Contributor Author

Fixed in 4.0.x branch

niden pushed a commit that referenced this issue May 16, 2020
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant