This post is for anyone having a problem using VDaemon for web form validation getting the error message “VDaemon Error: Can’t unserialize validators information.“
I moved the site using VDaemon to a new server and started getting the error message.
Old Server:
VDaemon: 2.3.0
OS (from command “cat /etc/issue”): CentOS release 4.5 (Final)
Apache: 2.0.46 (Red Hat)
PHP: 4.4.2
New Server:
VDaemon: 2.30
OS (from command “cat /etc/issue”): Red Hat Enterprise Linux ES release 3 (Taroon Update 9)
Apache: 2.0.63 (Unix)
PHP: 5.25
The problem was in the vdaemon.php file in the function VDValidate().
There are two specific instances in the function where the line “$sErrMsg = VD_E_UNSERIALIZE;” is setting the error message.
There is a string comparison on the “if” statements before each line. From old server to new server the value being returned by the PHP “get_class” function in the “if” statement is returning a different case. My old server was returning a strictly lower case value and my new server is not.
The surest way to handle this error no matter what case your environment delivers the results is to force a comparison of same case to same case. I used the PHP “strtolower” function to convert the “get_class” result to lower case and *then* compare it to the string listed in the “if” statement. The text strings being compared (“cvdvalruntime” and “xmlnode”) were already in lower case on my distribution of VDaemon but if they are not strictly lower case in your code, change them to lower case.
Here are the two lines that I changed:
Before: if (!$oRuntime || get_class($oRuntime) != ‘cvdvalruntime’ || !is_array($oRuntime->aNodes))
After: if (!$oRuntime || strtolower(get_class($oRuntime)) != ‘cvdvalruntime’ || !is_array($oRuntime->aNodes))
Before: if (get_class($oRuntime->aNodes[$nIdx]) != ‘xmlnode’)
After: if (strtolower(get_class($oRuntime->aNodes[$nIdx])) != ‘xmlnode’)
This fixed it for me.
If this helped you out, leave a comment! 🙂
Thanks., it work for me.
Thanks! Worked for my new server as well. Great fix!
Thank you. It worked for us as well. Nice work!