|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63853 Some of the urls are not added in $url->addchild("loc",$mainurl);
Submitted: 2012-12-26 05:20 UTC Modified: 2014-12-30 10:41 UTC
From: sachinpkaushik at gmail dot com Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.4.10 OS: Fedora Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-12-26 05:20 UTC] sachinpkaushik at gmail dot com
I am trying to generate xml file for sitemap for google tracking of my site url.

I have a php file with the code mentioned(Please refer the code sent) which I am 
running on the command line with no arguments.

The code retrieves value in an array $venueArrayfrom the value recieved from the 
function $venue->getAll()

There is a foreach loop which retrieves the value from the array '$venueArray'.

In the foreach loop I have added a code to fetch url from array '$venueArray' 
element 'id':- 

 $mainurl =$venue->getUrl(array("venueId"=>$venueD['id']));

and puts it in the xml tags with the help of the code


and then the contents are appended in the file.

It seems that some of the urls are not added (url for example:ßer-saal) in the 
following code intended to add urls:-


Please provide me with the solution to my problem as soon as possible and also 
please let me know the changes which I should do in order to get urls in my xml 

Some of the urls are not added in $url->addchild("loc",$mainurl);

Test script:
/** some of the urls are not added in $url->addchild("loc",$mainurl); **/

$xmltext = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<urlset xmlns=\"\"></urlset>";

$xmlobj = simplexml_load_string($xmltext);	

/** Code to retrieve venue array **/	  
$venue = new record();	   

/** End of the Code to retrieve venue array **/

foreach($venueArray as $venueD){
			  /** Code to retrieve Url from venue array **/ 
			  $mainurl =$venue->getUrl(array("venueId"=>$venueD['id']));			
			   Example of the url generated
		    $url= $xmlobj->addChild("url");			



Expected result:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<urlset xmlns="">

Actual result:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<urlset xmlns="">


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-31 22:51 UTC] mail+php at requinix dot net
Given a modified version of your script where $mainurl is explicitly set to the 
URL you give (in UTF-8) I get the expected XML.

It seems $venueArray has only the one item otherwise you would have discovered a 
large bug in your code. Are you sure $venueArray and $mainurl have the values you 
expect? You need to debug your script, and if you discover a real bug in PHP 
itself while doing so then you can (re)open a bug report with more specific 
information and something we can actually use to reproduce the problem.

Also, this is not the place to get help with your code. Find an online forum or 
mailing list to ask for assistance. That lets the PHP devs focus on bugs and gives 
you the personalized feedback you may need.
 [2013-12-02 16:32 UTC]
-Status: Open +Status: Feedback
 [2013-12-02 16:32 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 02:01:30 2024 UTC