Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001397 [Quercus] minor always 10-09-06 17:38 01-04-07 13:58
Reporter dberry View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.0.21
Summary 0001397: Putting intval() around a SimpleXMLElement node returns a '1'
Description Converting a numeric xml element using intval() causes the value to become 1.
Additional Information <?php
// This is a test to find out what is causing problems with the xmldata
?>

<html>
<head>
</head>

<body>
<?php
$xml = simplexml_load_file("http://localhost:8080/platform/BadEmptyElement.xml"); [^]

echo("
============================== Test 1 ==================================

");

foreach ($xml->events->event as $event)
{
    
    syslog(LOG_ERR,"=================With intval() ===========================");
    syslog(LOG_ERR,"key_event_id=<".intval($event->key_event_id[0]).">");
    syslog(LOG_ERR,"event_owner=<".intval($event->event_owner[0]).">");
    syslog(LOG_ERR,"event_type=<". intval($event->event_type[0]).">");
    echo("
=================With intval() ===========================
");
    echo("key_event_id=&lt;". intval($event->key_event_id[0])."&gt;
");
    echo("event_owner=&lt;". intval($event->event_owner[0])."&gt;
");
    echo("event_type=&lt;". intval($event->event_type[0])."&gt;
");
    
    
    syslog(LOG_ERR,"=================Without intval() ===========================");
    syslog(LOG_ERR,"key_event_id=<".$event->key_event_id[0].">");
    syslog(LOG_ERR,"event_owner=<".$event->event_owner[0].">");
    syslog(LOG_ERR,"event_type=<". $event->event_type[0].">");
    echo("=================Without intval() ===========================
");
    echo("key_event_id=&lt;". $event->key_event_id[0]."&gt;
");
    echo("event_owner=&lt;". $event->event_owner[0]."&gt;
");
    echo("event_type=&lt;". $event->event_type[0]."&gt;
");
    
    
        
}

/*
echo("
=========================== Test 2 =============================

");

$xml2 = simplexml_load_file("http://localhost:8080/platform/BadCDATAElement.xml"); [^]

foreach ($xml2->events->event as $event2)
{
    echo("key_event_id=&lt;". $event2->key_event_id."&gt;
");
    echo("event_name=&lt;". $event2->event_name."&gt;
");
    echo("event_owner=&lt;". $event2->event_owner."&gt;
");
    echo("event_type=&lt;". $event2->event_type."&gt;
");
    echo("event_description=&lt;".$event2->event_description."&gt;
");
    echo("event_geographic_area=&lt;". $event2->event_geographic_area."&gt;
");
    echo("event_dcreated=&lt;". $event2->event_dcreated."&gt;
");
    echo("event_dstarted=&lt;". $event2->event_dstarted."&gt;
");
    echo("event_dstopped=&lt;". $event2->event_dstopped."&gt;
");
    echo("event_resource_accepted=&lt;". $event2->event_resource_accepted."&gt;
");
    echo("event_facility=&lt;". $event2->event_facility."&gt;

");
        
}
*/
?>
</body>
</html>
Attached Files

- Relationships

- Notes
(0001540)
dberry
10-09-06 17:39

here is the xml for the enclosed test code

<?xml version='1.0' encoding='ISO-8859-1'?>
<response>
    <request>getEvents</request>
    <status>
        <code>0</code>
        <desc>success</desc>
    </status>
    <events>
        <event>
            <key_event_id>388</key_event_id>
            <event_name>add</event_name>
            <event_owner>517</event_owner>
            <event_type>12</event_type>
            <event_description>add</event_description>
            <event_geographic_area></event_geographic_area>
            <event_dcreated>2006-09-06 10:34:45.0</event_dcreated>
            <event_dstarted>2006-09-06 10:34:45.0</event_dstarted>
            <event_dstopped />
            <event_resource_accepted>0</event_resource_accepted>
            <event_facility>1</event_facility>
        </event>
        <event>
            <key_event_id>379</key_event_id>
            <event_name>don't</event_name>
            <event_owner>517</event_owner>
            <event_type>15</event_type>
            <event_description>don't touch @ this</event_description>
            <event_geographic_area />
            <event_dcreated>2006-09-06 10:34:45.0</event_dcreated>
            <event_dstarted>2006-09-06 10:34:45.0</event_dstarted>
            <event_dstopped></event_dstopped>
            <event_resource_accepted>0</event_resource_accepted>
            <event_facility>1</event_facility>
        </event>
        <event>
            <key_event_id>390</key_event_id>
            <event_name>don't you like to do something &amp; something?</event_name>
            <event_owner>517</event_owner>
            <event_type>6</event_type>
            <event_description>/0/n/b/'///r/t1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./!@#$%^&amp;*()_QWERTYUIOP{}|ASDFGHJKL:</event_description>
            <event_geographic_area />
            <event_dcreated>2006-09-06 10:34:45.0</event_dcreated>
            <event_dstarted>2006-09-06 10:34:45.0</event_dstarted>
            <event_dstopped />
            <event_resource_accepted>0</event_resource_accepted>
            <event_facility>1</event_facility>
        </event>
    </events>
</response>
 
(0001702)
ferg
01-04-07 13:58

php/1x20
 

- Issue History
Date Modified Username Field Change
10-09-06 17:38 dberry New Issue
10-09-06 17:39 dberry Note Added: 0001540
01-04-07 13:58 ferg Note Added: 0001702
01-04-07 13:58 ferg Assigned To  => ferg
01-04-07 13:58 ferg Status new => closed
01-04-07 13:58 ferg Resolution open => fixed
01-04-07 13:58 ferg Fixed in Version  => 3.1.1


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker