I have just come across this problem while programmatically creating nodes with a path. The node saves with no language '' and the path saves with LANGUAGE_NONE. This meant that the alias was not being set correctly.
Would it be a better approach to set the default language in node_schema() to be LANGUAGE_NONE?
I don't think nodes are supposed to have an empty string for a language, ever.
What would it mean to simultaneously have a LANGUAGE_NONE constant and also "no language", what's the difference? when would I want to use one and not the other.
It sounds like there's a bug elsewhere leading to nodes without a language string being created, and so we need some steps to reproduce this.
@JeremyFrench, would you be able to dig up a code sample of the programatic node creation that led to this error appearing?
Looking at d8, I can see that the default for 'langcode' for nodes is still ''. While we might argue over what should go there, LANGUAGE_NONE seems like it would be a better option than an empty string (which is never valid as I understand).
Comments
Comment #1
MichaelCole commentedlang.patch queued for re-testing.
Comment #2
JeremyFrench commentedI have just come across this problem while programmatically creating nodes with a path. The node saves with no language '' and the path saves with LANGUAGE_NONE. This meant that the alias was not being set correctly.
Would it be a better approach to set the default language in node_schema() to be LANGUAGE_NONE?
Comment #3
thedavidmeister commentedI don't think nodes are supposed to have an empty string for a language, ever.
What would it mean to simultaneously have a LANGUAGE_NONE constant and also "no language", what's the difference? when would I want to use one and not the other.
It sounds like there's a bug elsewhere leading to nodes without a language string being created, and so we need some steps to reproduce this.
@JeremyFrench, would you be able to dig up a code sample of the programatic node creation that led to this error appearing?
Looking at d8, I can see that the default for 'langcode' for nodes is still ''. While we might argue over what should go there, LANGUAGE_NONE seems like it would be a better option than an empty string (which is never valid as I understand).
Comment #4
thedavidmeister commentedComment #5
thedavidmeister commentedI was wrong, I was looking at the 'node_access' table in d8, not 'node'. This just needs more info then in d7.