bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[php 8] Base::instance()->status() - Error raised for 'unknown' HTTP status codes

pauljherring opened this issue · comments

commented
$ /usr/bin/php8.0 -r '$f3=require("lib/fatfree/lib/base.php"); error_reporting(0); $f3->status(550);'
Fatal error: Uncaught Error: Undefined constant self::HTTP_550 in /var/www/html/site/lib/fatfree/lib/base.php:1205
Stack trace:
#0 /var/www/html/site/lib/fatfree/lib/base.php(1205): constant()
#1 Command line code(1): Base->status()
#2 {main}
  thrown

===================================
ERROR 500 - Internal Server Error
Fatal error: Uncaught Error: Undefined constant self::HTTP_550 in /var/www/html/site/lib/fatfree/lib/base.php:1205
Stack trace:
#0 /var/www/html/site/lib/fatfree/lib/base.php(1205): constant()
#1 Command line code(1): Base->status()
#2 {main}
  thrown

(Substitute any other number that isn't specifically defined in https://github.com/bcosca/fatfree/blob/master/lib/base.php#L52)

Feel free to create a pull request against bcosca/fatfree-core that is adding missing standardized status codes. As far as I know there is no feature to add custom status codes. If you want to send a custom code, use header() and handle further processing manually.