Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a user with an empty login name #66

Open
NandoSangenetto opened this issue Feb 19, 2020 · 9 comments
Open

Cannot create a user with an empty login name #66

NandoSangenetto opened this issue Feb 19, 2020 · 9 comments

Comments

@NandoSangenetto
Copy link

NandoSangenetto commented Feb 19, 2020

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:
image

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.

@NandoSangenetto
Copy link
Author

On my 467 line I have $a = $this->process_author( $author[1] );.

@NandoSangenetto
Copy link
Author

NandoSangenetto commented Feb 19, 2020

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>

@ocean90
Copy link
Member

ocean90 commented Mar 7, 2020

Can you share the full XML file which was causing the error?

@DrLightman
Copy link

DrLightman commented Mar 19, 2020

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

@DrLightman
Copy link

@ocean90 ^

@emiliodallatorre
Copy link

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.

@DrLightman
Copy link

Why closed? Has it been fixed in official importer?

@luigitek
Copy link

Not fixed yet, I had the same issue, this solution fixed it for me
#66 (comment)

Thanks!

@cwahlfeldt
Copy link

2024 and just had this issue. #66 (comment) this fixed my issue

@dd32 dd32 reopened this Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants