Doc #80491 [Opn->Nab]: curl_init() returns object instead of resource

From: Date: Mon, 07 Dec 2020 14:19:17 +0000
Subject: Doc #80491 [Opn->Nab]: curl_init() returns object instead of resource
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18206@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80491&edit=1

 ID:                 80491
 Updated by:         kocsismate@php.net
 Reported by:        ricardo at banak dot com
 Summary:            curl_init() returns object instead of resource
-Status:             Open
+Status:             Not a bug
 Type:               Documentation Problem
 Package:            cURL related
 Operating System:   Centos 7.9.2009
 PHP Version:        8.0.0
 Block user comment: N
 Private report:     N

 New Comment:

It is the result of an intentional change: https://php.watch/versions/8.0/resource-CurlHandle
(but I could have linked the related upgrading note).

Please note that PHP 8.0 migrated quite a few other resources to objects as well. You can refer to
the documentation or https://github.com/php/php-tasks/issues/6 for
more information.


Previous Comments:
------------------------------------------------------------------------
[2020-12-07 14:16:53] cmb@php.net

That is a deliberate change[1].

[1] <https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object>

------------------------------------------------------------------------
[2020-12-07 14:12:01] ricardo at banak dot com

Description:
------------
Documentation states curl_init() as:

curl_init ([ string $url = NULL ] ) : resource

but the result is an object, not a resource.

Test script:
---------------
$ch = curl_init();

if (is_object($ch)) {
    echo '$ch is an object';
} 

if (is_resource($ch)) {
    echo '$ch is a resource';
} 




Expected result:
----------------
Expected:
$ch is a resource

Currently:
$ch is an object



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80491&edit=1


Thread (7 messages)

« previous php.doc.bugs (#18206) next »