Bug #63853 [Fbk->NoF]: Some of the urls are not added in $url->addchild("loc",$mainurl);

From: Date: Tue, 30 Dec 2014 10:41:56 +0000
Subject: Bug #63853 [Fbk->NoF]: Some of the urls are not added in $url->addchild("loc",$mainurl);
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189423@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63853&edit=1 ID: 63853 Updated by: php-bugs@lists.php.net Reported by: sachinpkaushik at gmail dot com Summary: Some of the urls are not added in $url->addchild("loc",$mainurl); -Status: Feedback +Status: No Feedback Type: Bug Package: DOM XML related Operating System: Fedora Linux PHP Version: 5.4.10 Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2013-12-02 16:32:08] mike@php.net 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. ------------------------------------------------------------------------ [2012-12-31 22:51:03] 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. ------------------------------------------------------------------------ [2012-12-26 05:20:40] sachinpkaushik at gmail dot com Description: ------------ 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 $url->addchild("loc",$mainurl); and then the contents are appended in the file. It seems that some of the urls are not added (url for example: http://mysite.com/dresden/769112-venue-theater-wechselbad-großer-saal) in the following code intended to add urls:- $url->addchild("loc",$mainurl); 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 file. Some of the urls are not added in $url->addchild("loc",$mainurl); Test script: --------------- <?php /** 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=\"http://www.sitemaps.org/schemas/sitemap/0.9\"></urlset>"; $xmlobj = simplexml_load_string($xmltext); /** Code to retrieve venue array **/ $venue = new record(); $venueArray=$venue->getAll(); /** 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 http://mysite.com/dresden/769112-venue-theater-wechselbad-großer-saal **/ $url= $xmlobj->addChild("url"); $url->addchild("loc",$mainurl); $url->addChild("lastmod",date('Y-m-d')); $url->addChild("changefreq","daily"); $url->addChild("priority","0.9"); $fp=fopen('test.xml',"a"); fwrite($fp,$xmlobj->asXML()); fclose($fp); } ?> Expected result: ---------------- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://mysite.com/dresden/769112-venue-theater-wechselbad-großer- saal</loc> <lastmod>2012-12-21</lastmod> <changefreq>daily</changefreq> <priority>0.9</priority> </url> </urlset> Actual result: -------------- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc/> <lastmod>2012-12-21</lastmod> <changefreq>daily</changefreq> <priority>0.9</priority> </url> </urlset> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63853&edit=1

« previous php.bugs (#189423) next »