You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I rely heavily on generating nids for my objects, so that id'd are not guessable.
I ran into a weird problem that I could not lookup object from my database by their nid.
I have used this in the past too and never had a problem.
But now I found that I was passing the just generated nid to a function, to fetch the object I just saved. It uses the sha1() function which returns 40byte strings. However since the default mysql.sql had the column set as varchar(32) the nids were truncated to 32 bytes. Therefore all my queries returned false.
I'm not sure if this is an oversight and the database columns should be altered, or if something changed that I don't know about.
The text was updated successfully, but these errors were encountered:
I think I have found the culprit. Instead of sha1, the newNid function previously used md5(), which is 32bytes. This explains why my other projects were working fine.
So I do think the database script should be updated. And maybe add documentation to the newNid() function on how many bytes it generates.
So, I rely heavily on generating nids for my objects, so that id'd are not guessable.
I ran into a weird problem that I could not lookup object from my database by their nid.
I have used this in the past too and never had a problem.
But now I found that I was passing the just generated nid to a function, to fetch the object I just saved. It uses the sha1() function which returns 40byte strings. However since the default mysql.sql had the column set as varchar(32) the nids were truncated to 32 bytes. Therefore all my queries returned false.
I'm not sure if this is an oversight and the database columns should be altered, or if something changed that I don't know about.
The text was updated successfully, but these errors were encountered: