php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80640 imagecreatetruecolor returns GDimage object instead of resource
Submitted: 2021-01-18 10:29 UTC Modified: 2021-05-24 22:39 UTC
From: petzold dot mx at gmail dot com Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 8.0Git-2021-01-18 (snap) OS: debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: petzold dot mx at gmail dot com
New email:
PHP Version: OS:

 

 [2021-01-18 10:29 UTC] petzold dot mx at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.imagecreatetruecolor
---
returntype Change with php8 is not mentioned

imagecreatetruecolor returns an GdImage Object instead of a resource


Test script:
---------------
$image = imagecreatetruecolor(10,10);

if (!is_resource($image)) { 
die('Unable to generate image: not a resource'); 
}

Expected result:
----------------
true

Actual result:
--------------
false

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-18 11:48 UTC] cmb@php.net
-Package: *Programming Data Structures +Package: GD related
 [2021-01-18 11:48 UTC] cmb@php.net
Indeed, that is not documented in the manual proper; only the
migration guide notes the resource to object migration[1].

[1] <https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object>
 [2021-01-18 11:48 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-05-24 22:39 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 12:01:29 2025 UTC