wordpress-importer
wordpress-importer copied to clipboard
Cannot create a user with an empty login name
Hello, I was importing 16 files generated with the wp-cli tool and also I was importing it with the same tool.
All files were imported fine except 2 files the 13th and the 16th.
Those are the errors that occured:

I tried to go the parsers.php file on the line it mentions but I don't think that the problem resides in this file but in the exporter somehow.
I just want to know what kind of information can lead to this error, to se if I can fix it in the WXR (xml) file and also file an issue about it on the exporter.
On my 467 line I have $a = $this->process_author( $author[1] );.
It only worked when I changed the <wp:author>'s content to be in the same line, like:
<wp:author><wp:author_id>237</wp:author_id><wp:author_login>John Doe</wp:author_login><wp:author_email>[email protected]</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
Can you share the full XML file which was causing the error?
Same here. I had that very same error message:
Cannot create a user with an empty login name
But my XML contained all valid users with proper usernames, so I was very uncertain on the cause.
Spent a whole afternoon researching. Also, on my dev machine the import worked, whereas on the production server did not.
Finally, after enabling:
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
A long series of this notice came up on screen during the import:
Notice: Undefined offset: 1 in /var/www/html/wp-content/plugins/wordpress-importer/parsers/class-wxr-parser-regex.php on line 61
The line is:
if ( false !== strpos( $importline, '<wp:author>' ) ) {
preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
>> $a = $this->process_author( $author[1] ); <<
$this->authors[$a['author_login']] = $a;
continue;
}
I put a debug code before it such like this:
if(!isset($author[1])) { echo $importline; exit; }
I relaunched the import and as expected it quitted with this text:
Starting the import process...
<pre>228685:1152 internal error: Huge input lookup
</pre><p><strong>Si è verificato un errore nella lettura di questo file WXR</strong><br />I dettagli sono indicati sopra. L'importatore ora riproverà con un parser diverso...</p><wp:author>
Googling "php Huge input lookup" gave me this thread:
https://wordpress.org/support/topic/fix-for-warning-xml-error-1-internal-error-huge-input-lookup/
Where "britt" guy links this other thread:
https://wordpress.org/support/topic/warning-xml-error-1-internal-error-huge-input-lookup-1/
So I applied the suggested fix in /plugins/wordpress-importer/parsers/class-wxr-parser-simplexml.php line 23 to make it look like:
$success = $dom->loadXML( file_get_contents( $file ), LIBXML_PARSEHUGE );
Relaunched the import and it's running now, no more crash with that subtle message.
note: the size of the XML file itself is ~14MB
@ocean90 ^
It only worked when I changed the
<wp:author>'s content to be in the same line, like:<wp:author><wp:author_id>237</wp:author_id><wp:author_login>John Doe</wp:author_login><wp:author_email>[email protected]</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
This has been the solution of my problem too. As I had several files to import, and almost 15k articles, I created a small script which may help many of you: it works on Python3 and put all author data on the same line. After editing my files with it, I got my import working perfectly.
You can find it here.
Why closed? Has it been fixed in official importer?
Not fixed yet, I had the same issue, this solution fixed it for me https://github.com/WordPress/wordpress-importer/issues/66#issuecomment-588432713
Thanks!
2024 and just had this issue. https://github.com/WordPress/wordpress-importer/issues/66#issuecomment-601303129 this fixed my issue