Download & Extend

Warning: XMLWriter::openUri(): Empty string as source in XMLSitemapWriter->openUri()

Project:XML sitemap
Version:7.x-2.x-dev
Component:xmlsitemap.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

If you are receiving this error then please ensure that your files directory has write permissions for the httpd service. The most secure setting would be to ensure the group for the files directory is the same as the httpd service owner and give the group on the files directory read, write and execute permissions. If you have the correct permissions and still receive this error then please tell us in a comment below.

ORIGINAL SUMMARY:
I have set up a Drupal 7.12 on a local LAMP running on Debian for a restailying of a site of mine.

Trying to use XML sitemap 7.x-2.0-rc1 and I get the following error while trying to generate the sitemap:
Warning: XMLWriter::openUri(): Empty string as source in XMLSitemapWriter->openUri() (line 40 of /srv/www/silicongadget.com/public_html/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc).

Please tell me if you need any particular info.

Comments

#1

#2

I get the same error. Running Drupal 7.14, 7.x-2.0-rc1, on a Centos multi-site installation.

#3

Version:7.x-2.x-dev» 7.x-2.0-rc1

I got the same issue on CentOS as well.

#4

Version:7.x-2.0-rc1» 7.x-2.x-dev

Please do not change the Version parameter.

#5

I got the same error message just after enabling the module:
Warning: XMLWriter::openUri(): Empty string as source in XMLSitemapWriter->openUri() (line 40 of /var/www/drupal/sites/all/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc).

#6

I was also getting this error when enabling the module. It turns out that my public:// directory (usually sites/default/files, but may differ based on your site settings) did not have the proper permissions and wasn't writable, so the xmlsitemap directory that needs to get created does not get created so the argument passed through XMLSitemapWriter->openUri() path doesn't exist.

I resolved this simply by setting the permissions of my public:// directory to be writable by the web server user (www-data in my case).

Hope it helps!

#7

@kaidjohnson: Thanks for the update. Based on your resolution I updated the issue summary.

#8

Having this issue on Drupal 7.15 install with XML Sitemap 7.x-2.0-rc2 and with the sites default download method set to 'Amazon Simple Storage Service'. When dumping the $uri variable used in public function openUri($uri) in xmlsitemap.xmlsitemap.inc, this is set to 's3://xmlsitemap/NXhscRe04…..'. In the xmlsitemap admin settings the sitemap cache directory is set to s3://xmlsitemap, where the S3// cannot be changed.

Could this be the problem? Should the path not be set to the public file system path, default 'sites/default/files'? Unfortunately I don't have enough knowledge to come up with a patch, but hopefully this will help finding a speedy solution.

Happy New Year, by the way.

#9

@vanvemden: What is the owner:group and permissions for sites/SITE/files or sites/default/files?

#10

@earnie: Permissions for sites/default/files is set to 755. Owner and group are set to the account name used to do the Drupal install on the server (which is also the same owner/group for all the other directories). As other modules (e.g. Ctools and CSS injector) had no trouble adding subdirectories in the sites/default/files/ folder, I thought this could not be the problem. Thanks for any help you can provide.

#11

Seems to be an issue when default stream is s3:// as @vanvemden pointed out. Not sure if the problem lies with the xmlsitemap or amazon s3 module though.

Resolved with this hack for now:

<?php
function xmlsitemap_file_build_uri($path) {
 
$uri = 'public://' . $path;
  return
file_stream_wrapper_uri_normalize($uri);
}

/**
* @} End of "defgroup xmlsitemap_api"
*/
function xmlsitemap_get_directory(stdClass $sitemap = NULL) {
 
$directory = &drupal_static(__FUNCTION__);

  if (!isset(
$directory)) {
   
$directory = variable_get('xmlsitemap_path', 'xmlsitemap');
  }

  if (!empty(
$sitemap->smid)) {
    return
xmlsitemap_file_build_uri($directory . '/' . $sitemap->smid);
  }
  else {
    return
xmlsitemap_file_build_uri($directory);
  }
}
?>

#12

@borgenk: Thank you, thank you! It worked!

#13

Can you work that into a proper patch, please? Also what are the timing differences before and after the patch with http://?

#14

created a patch based on #11

AttachmentSizeStatusTest resultOperations
xmlsitemap-s3-open-uri-1554488-14.patch795 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch xmlsitemap-s3-open-uri-1554488-14.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#15

Status:active» needs review

Patches "need review".

Thanks, @r_smylski!

#16

Status:needs review» needs work

The last submitted patch, xmlsitemap-s3-open-uri-1554488-14.patch, failed testing.

#17

You need to use ``git diff'' in order to for the test environment to be happier.

#18

re-worked patch

AttachmentSizeStatusTest resultOperations
s3-open-uri-1554488-18.patch972 bytesIgnored: Check issue status.NoneNone
nobody click here