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

Problem with @value elements ... #3

Closed
AlgyTaylor opened this issue Jul 27, 2016 · 6 comments
Closed

Problem with @value elements ... #3

AlgyTaylor opened this issue Jul 27, 2016 · 6 comments

Comments

@AlgyTaylor
Copy link

Heya,

Awesome work by both the original author & yourself 👍

Anyway, I've found what appears to be a bug. When parsing this

array (
    "hpo" => array (
        "HP_0012759" => array (
            "term" => "Neurodevelopmental abnormality",
            "@attributes" => array (
                "present" => "na"
            ),
            "onset" => array (
                "@attributes" => array (
                    "units" => "years"
                ),
                "@value" => NULL
            )
        )
    )
)

I get an exception Message: [Array2XML] Illegal character in tag name. tag: @value in node: onset

Cheers,
Algy

@rquadling
Copy link
Member

Can you supply the XML that you used to build this please?

@AlgyTaylor
Copy link
Author

Heya, that was the value I'd entered in to Array2XML - I didn't use XML2Array beforehand.

@rquadling
Copy link
Member

OK. Change NULL to ''. Does it work?

@rquadling
Copy link
Member

Aha! I see the issue.

if (isset($arr['@value'])) {

When $arr['@value'] === null this test fails.

Should work with array_key_exists.

@rquadling
Copy link
Member

Fix on the way.

@rquadling
Copy link
Member

Done.

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

No branches or pull requests

2 participants