Bug #73717 [NEW]: return-types with NULL not handeled properly
| From: | spam2 at rhsoft dot net | Date: | Sun, 11 Dec 2016 21:07:29 +0000 |
| Subject: | Bug #73717 [NEW]: return-types with NULL not handeled properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205917@lists.php.net to get a copy of this message | ||
From: spam2 at rhsoft dot net
Operating system:
PHP version: 7.0.14
Package: Scripting Engine problem
Bug Type: Bug
Bug description:return-types with NULL not handeled properly
Description:
------------
Fatal error: Uncaught TypeError: Return value of
cl_forum::thread_last_timestamp() must be of the type integer, null
returned in
/mnt/data/www/thelounge.net/contentlounge/cms/modules/forum/api_forum.php:487
why in the world do i need return (int) here in no-strict-types mode
the whole purpose of the return type would be to save the manual casting
Test script:
---------------
public function thread_last_timestamp(int $thread_id=0): int
{
switch($thread_id)
{
case 0: return $this->db->fetch_row($this->db->query('select' .
SQL_SMALL_CACHE . 'max(fo_post_timestamp) from ' . sql_prefix .
'forum_posts;', 1, 0))[0];
default: return $this->db->fetch_row($this->db->query('select' .
SQL_SMALL_CACHE . 'max(fo_post_timestamp) from ' . sql_prefix .
'forum_posts where fo_post_tid=' . $thread_id . ';', 1, 0))[0];
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=73717&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73717&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73717&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73717&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73717&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73717&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73717&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73717&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73717&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73717&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73717&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73717&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73717&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73717&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73717&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73717&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73717&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73717&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73717&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73717&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73717&r=mysqlcfg