php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18319 is_a fails to match DOM classes
Submitted: 2002-07-12 12:43 UTC Modified: 2002-07-12 15:21 UTC
From: brblueser at uol dot com dot br Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.2.1 OS: Linux 2.4.19-pre1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
40 - 9 = ?
Subscribe to this entry?

 
 [2002-07-12 12:43 UTC] brblueser at uol dot com dot br
I searched the bug database for "is_a" but found no entries, so I thought I should post this here...

The code below always prints "failed!!!":

<?php
$dom = domxml_new_doc("<?xml version=\"1.0\"?" . "><me><name>Joe Cool</name><age>24</age><gender>male</gender></me>");
$elem = $dom->create_element("aaa");
// any of the if's below fails
if ( is_a( $elem, "DomElement" ) )
// if ( is_a( $elem, get_class( $elem ) ) )
{
   echo "OK\n";
}
else
{
   echo "failed!!!\n";
}
?>

My config line was:

./configure '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' \
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' \
'--includedir=/usr/include' '--libdir=/usr/lib' \
'--libexecdir=/usr/libexec' '--localstatedir=/var' \
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' \
'--infodir=/usr/share/info' '--prefix=/usr' \
'--with-config-file-path=/etc'  '--enable-force-cgi-redirect' \
'--disable-debug' '--enable-pic' '--disable-rpath' \
'--enable-inline-optimization' '--with-bz2' '--with-db3' \
'--with-exec-dir=/usr/bin' '--with-gd' '--with-gdbm=/usr' \
'--with-gettext' '--with-gmp' '--with-jpeg-dir=/usr' '--with-mm' \
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' \
'--with-xml' '--with-dom=/usr' '--with-expat-dir=/usr' '--with-zlib' \
'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-ftp' \
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' \
'--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' \
'--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' \
'--with-kerberos=/usr/kerberos' '--with-sybase=/usr/local/freetds' \
'--with-apxs=/usr/sbin/apxs' '--enable-cli'

The output of 'php -m' is:

costa:~/public_html php -m
Running PHP 4.2.1
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies

[PHP Modules]
yp
xml
wddx
sysvshm
sysvsem
sybase
standard
sockets
session
pspell
posix
pcre
openssl
mysql
gmp
gettext
gd
ftp
domxml
dba
ctype
bz2
bcmath
zlib
session mm

[Zend Modules]

-----
on the above example, replacing the test for

if ( get_class( $elem ) == "DomElement" )

works.

Let me know if you need more info.

Best,

Andre

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-12 15:21 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 22:01:28 2024 UTC