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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 15:01:27 2025 UTC