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

 ID:                 62858
 Updated by:         larue...@php.net
 Reported by:        michaelduff at yahoo dot com
 Summary:            Please remove 'final' restriction on
                     SimpleXMLElement::__construct
 Status:             Open
 Type:               Feature/Change Request
 Package:            SimpleXML related
 PHP Version:        5.4.6
 Block user comment: N
 Private report:     N

 New Comment:

there must be some reason for the author mark the constructor as final, like 
some 
work must be done before any user access to it.


Previous Comments:
------------------------------------------------------------------------
[2012-08-18 19:36:50] michaelduff at yahoo dot com

Description:
------------
The __construct() method on SimpleXMLElement is marked 'final', which prevents 
extension of the class for, say, XML-format-specific objects which augment 
otherwise empty incoming XML data.

The current workaround is to use __get and __set and company (which 
unfortunately means <?= $obj instanceof SimpleXMLElement ?> fails), and which 
is much slower -- or to use a static factory method which forces some XML in 
there (which is syntactically ugly imo.)

Not to shoot my request in the foot, but I forsee possible issues with these 
functions:

- simplexml_import_dom ( $node [, $class_name ] )
- simplexml_load_file ( string $filename [, string $class_name ] ... )
- simplexml_load_string ( string $data [, string $class_name ] ... )

However, perhaps it would suffice to require 'a compatible function signature' 
rather than to mark it final?



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



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

Reply via email to