Hi there,

first of all, thank you for developing and releasing sabre/xml. I really 
think its an excellent XML parser.

I just installed the latest Sabre/XML version (2.0.0) using Compooser on my 
PHP 7.0.4 server and i am trying your basic READING examples as on 
http://sabre.io/xml/reading/. The first part, including the chapter 
"Key-Value XML structures", work flawlessly.

However, the chapter "Stripping the XML namespaces" does not work anymore.

My php file looks as follows (basically a copy & past from 
http://sabre.io/xml/reading/):

<?php

define("ROOT",$_SERVER["DOCUMENT_ROOT"]);
define("DATA",ROOT."/data/");

include (ROOT.'/vendor/autoload.php');

$file = DATA.'/books.xml';

$xml = file_get_contents($file);

$service = new Sabre\Xml\Service();
$service->elementMap = [
    '{http://example.org/books}book' => function(Reader $reader) {
        return Sabre\Xml\Deserializer\keyValue($reader, 
'http://example.org/books');
    }
];

print_r($service->parse($xml));

?>


This gives me the following error:

 Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be 
an instance of Reader, instance of Sabre\Xml\Reader given in /home/he052rz5/
www/home/data/sabretest.php:14 Stack trace: #0 [internal function]: 
{closure}(Object(Sabre\Xml\Reader)) #1 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Reader.php(229): 
call_user_func(Object(Closure), Object(Sabre\Xml\Reader)) #2 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Reader.php(161): 
Sabre\Xml\Reader->parseCurrentElement() #3 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Element/Base.php(82): 
Sabre\Xml\Reader->parseInnerTree() #4 [internal function]: 
Sabre\Xml\Element\Base::xmlDeserialize(Object(Sabre\Xml\Reader)) #5 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Reader.php(229): 
call_user_func(Array, Object(Sabre\Xml\Reader)) #6 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Reader.php(71): 
Sabre\Xml\Reader->parseCurrentElement() #7 
/home/he052rz5/www/home/vendor/sabre/xml/lib/Service.php(112): 
Sabre\Xml\Reader->parse() #8 
/home/he052rz5/www/home/data/sabretest.php(19): S in 
/home/he052rz5/www/home/data/sabretest.php on line 14



I thought it may be related to PHP 7, because I have found a similar error 
(albeit from a differ application) here: 
https://wordpress.org/support/topic/php-7-related-error/

Thank you very much your help in advance.

Christoph

-- 
You received this message because you are subscribed to the Google Groups 
"SabreDAV Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sabredav-discuss/36b9bbcb-e9cc-4c64-a908-05556bd99ec9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to