php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45853 instanceof fails to detect OCI-Lob correctly
Submitted: 2008-08-18 14:58 UTC Modified: 2008-08-19 09:04 UTC
From: cxscott at uk dot insight dot com Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 5.2.6 OS: Red Hat Linux (2.6.9-42.ELsmp)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cxscott at uk dot insight dot com
New email:
PHP Version: OS:

 

 [2008-08-18 14:58 UTC] cxscott at uk dot insight dot com
Description:
------------
instanceof fails to detect that an object is an instance of OCI-Lob (possibly due to the hyphen?)

deprecated function is_a() works correctly with a value of is

Reproduce code:
---------------
    $conn = oci_connect('username', 'password', 'database');

    $lob = oci_new_descriptor($conn, OCI_D_LOB);

    if ($lob instanceof OCI-Lob) {
        echo 'instanceof says $lob IS an OCI-Lob<br />';
    } else {
        echo 'instanceof says $lob is NOT an OCI-Lob!<br />';
    }

    if (is_a($lob, 'OCI-Lob')) {
        echo 'is_a says $lob IS an OCI-Lob<br />';
    } else {
        echo 'is_a says $lob is NOT an OCI-Lob!<br />';
    }

    echo '$lob is: ' . get_class($lob) . '<br />';

Expected result:
----------------
instanceof says $lob IS an OCI-Lob!
is_a says $lob IS an OCI-Lob
$lob is: OCI-Lob

Actual result:
--------------
instanceof says $lob is NOT an OCI-Lob!
is_a says $lob IS an OCI-Lob
$lob is: OCI-Lob

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-18 18:14 UTC] jani@php.net
Of course it does, - is not allowed char in class/variable/function/constant names.
 [2008-08-19 09:04 UTC] cxscott at uk dot insight dot com
Then I guess the issue is with the OCI-Lob class - which comes from PHP's OCI8 extension. If hyphen is not allowed in class names, why on Earth is it using a hyphen?!

Whichever way you cut it, it should be possible to do this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 09:01:28 2024 UTC