Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error calling attributes() on SimpleXMLElement instances on PHP 5.2.0 and PHP 5.2.0-8+etch16. #34

Closed
GoogleCodeExporter opened this issue Dec 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

The following error on PHP 5.2.0-8+etch16 on Apache on Debian Etch:

Fatal error: Call to a member function attributes() on a non-object in
/var/www/vhosts/user.name/httpdocs/esapi-php/src/reference/DefaultSecurityConfig
uration.php
on line 166

The code that causes this is:

{{{
$_events = $this->_xml->xpath('/esapi-properties/IntrusionDetector/event');

foreach ($_events as $event) {

    $name = (string) $event[0]->attributes()->name;
    $count = (int) $event[0]->attributes()->count;
    $interval = (int) $event[0]->attributes()->interval;
}}}

`$_events` is an array of `SimpleXMLElement` and the error happens when we do:

`SimpleXMLElement[0]->attributes()`

This works:

`SimpleXMLElement->attributes()`

I've tested this on PHP 5.2.0-8+etch16 and PHP 5.2.9 on windows and propose
the attached patch as a fix.
It's worth noting that PHP 5.2.0-8+etch16 is the latest stable package of
PHP 5 for Debian Etch http://packages.debian.org/etch/php5 and seems to be
a popular platform for web hosting companies.

Original issue reported on code.google.com by jahboite@gmail.com on 14 Apr 2010 at 8:07

Attachments:

@GoogleCodeExporter
Copy link
Author

I've committed a fix for this in r736

Original comment by jahboite@gmail.com on 20 Apr 2010 at 9:54

  • Changed title: Fatal Error calling attributes() on SimpleXMLElement instances on PHP 5.2.0 and PHP 5.2.0-8+etch16.
  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant