Bug #78481 [NEW]: Can't use resource as typed param
| From: | momchil at bojinov dot info | Date: | Sat, 31 Aug 2019 08:26:14 +0000 |
| Subject: | Bug #78481 [NEW]: Can't use resource as typed param | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222502@lists.php.net to get a copy of this message | ||
From: momchil at bojinov dot info
Operating system: Windows 10
PHP version: 7.4.0beta4
Package: *General Issues
Bug Type: Bug
Bug description:Can't use resource as typed param
Description:
------------
I am trying to use resource for parameter type but I get TypeError
Test script:
---------------
$Picture = imagecreatetruecolor(100, 100);
class bla
{
public function forPChart(resource $picture, $X, $Y)
{
$this->createImage($picture);
}
}
(new bla())->forPChart($Picture, 0 ,0);
Expected result:
----------------
Actual result:
--------------
Fatal error: Uncaught TypeError: Argument 1 passed to bla::forPChart()
must be an instance of resource, resource given, called in
E:\xxx\test.php on line 13 and defined in E:\xxx\test.php:7
Stack trace:
#0 E:\xxx\test.php(13): bla->forPChart(Resource id #4, 0, 0)
#1 {main}
thrown in E:\xxx\test.php on line 7
--
Edit bug report at https://bugs.php.net/bug.php?id=78481&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78481&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78481&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78481&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78481&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78481&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78481&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78481&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78481&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78481&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78481&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78481&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78481&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78481&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78481&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78481&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78481&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78481&r=mysqlcfg