Category Archives: problem

Don’t forget to exit after a redirect

Last weekend I discovered something I was not aware that it works that way: that code defined after a redirect is executed. A simple example: class UsersController extends AppController { function beforeFilter() { // not logged in, so redirect to the login page $this->redirect(‘/login’); } function delete($id) { $this->User->delete($id); } } This example redirects _and_ […]

ssh_exchange_identification: Connection closed by remote host

Today, as I tried to access a server with SSH, I got the following error: ssh_exchange_identification: Connection closed by remote host After some searching I found a solution: I have had to add the following line to /etc/hosts.allow: ssh: And voilĂ , it works.

Be careful with file uploads

In a comment lamby pointed out a possible security hole in the code of my post “File upload with CakePHP”. He is right, if you know the location of app/config/database.php you can retrieve the database settings including the password. In the following I will show you the original code, the exploit, and a possible solution. […]

A small bug in the advanced validation approach

I already wrote that I had problems with the validation after upgrading to version 1.0 of CakePHP. At that time, I thought it was a bug in Model->save(), and fixed that “bug”. But it transpired that it was in fact a bug in the advanced validation approach I described in an earlier post and in […]

Upgrading to version 1.0 III

I have found the second and last cause of my upgrading problems: there is a small bug in Model->save() which prevented the validation of the model fields. You find a patch on So, with that patch applied, all my tests run without failures. Hooray! Update (2006-05-06): It transpired that the bug was in the […]

Upgrading to version 1.0 II

Well, I could identify one cause for the problems I encountered after upgrading to version 1.0 of CakePHP. It is a bugfix in CakePHP which breaks my code ;-) This bugfix adds for associated models without data an empty array to the results array when you do a find. But in my code I checked […]

Upgrading to version 1.0

Today, I updated to version 1.0 ( according to version.txt) of CakePHP (yeah, I know, I am lame, but due to problems with Eclipse I was not able to keep up with the trunk in the last days). But nonetheless, I was surprised to see a lot of my tests fail after the update: 6 […]

$this->model->recursive could cause a bug in your application

If you have updated to the latest version of trunk ( and you use something like $this->model->recursive = 2; $this->model->findAll(); in your code, it is possible that you have a bug in your application as the findAll() does no longer return all the data you expect. I think, the reason for that behavior is that […]

Don’t use special characters in your root password

Today, I learned that it is not really a good idea to use special characters in a root password. I have had an “at” sign in the root password of my machine. Everything worked fine. Up to the update of today. It messed up my system: the mouse didn’t work (and still doesn’t), and the […]

Oh my blob!

I never used blobs before with MySQL, and so I had to learn painful that there are several types of blobs available in MySQL: TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB. And that is the way I had to learn it: In my app the user can upload files, and these files are stored in the database. […]