Russell (zimzat) wrote,

  • Mood:
  • Music:

!isset($var) == is_null($var) == ($var === NULL)

*groans* I want to really hurt PHP right now.

First I spent many hours getting SFTP installed. I've been trying to do that for a while now but couldn't figure out how to get the phpize script installed without compiling PHP by hand, something I really didn't want to do. While looking for something else earlier I saw someone mention that Ubuntu kept the phpize script in the php4-dev package in the repository. For some reason that didn't show up the last time I looked, or something. Anyway, I finally got it installed and added the SSH extension. I then started to gut my update script only to find out, half-way into this, that I couldn't connect to Imperial Kingdom's SSH server via PHP for some reason; it worked from the command line and KDE/Kate, just not PHP. So I gave up on that, for a while at least.

During all this, I made it so the update script had the capability to save the data in itself. When I tested it loading the data from itself with no preset data it said everything was just fine. Now, this is bad because it should be telling me everything needed uploaded. Several hours later, the NULL variable type is biting me in the butt, again. An unset variable is considered of the type NULL, so is_null will both error and return true, while a variable explicitly set to NULL is also considered unset. While this would make you think the variable is technically unset now, if serialized it actually returns NULL rather than nothing at all, however there's no other way to check if a variable is NULL other than serializing it first and checking the output of that. Both unset and null variables are consider null and unset.

So now I have to decide what other value I might use to signify a directory vs a file in the array. I think I'll go with (bool) true. Bleh.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened