Key-size of encryption method
You're simply appending the userKey to your "sleutel" (aka key) in this piece of code: 

$sleutel = $this-&gt;sleutel . $this-&gt;userKey;


Problem is, doing that can result in $sleutel lengths beyond the expect 256 bits (32 bytes), or - as you are experiencing - less than the expected 256 bits (32 bytes/characters). 

As @CodesInChaos correctly mentioned in his comment:


  AES-256 uses a 256 bit or 32 byte key by definition. No more, no less.


So, to fix your problem, you will have to make sure the key you are passing to your cipher function is no more and no less than 32 bytes. 

To achieve that, you can simply choose to follow the usual path of encryption by taking your $sleutel and hash your key to the expected 256-bit length with (for example) MD5, like this:

$sleutel = md5($this-&gt;sleutel . $this-&gt;userKey);


or — if you prefer to choose another hash and a speedier function — you can use PHP's hash function, with it's multiple of available hashes to select from, like (for example) this:

$sleutel = hash('ripemd128', $this-&gt;sleutel . $this-&gt;userKey);


But… that's not the way I would recommend you to do it! Because, you don't want to use a weak hash like MD5 (which is known to have collisions), and you surely don't want to feed a weak hexadecimal character sequence to your cipher either, do you?

My Recommendation

Following current crypto standards, my recommendation is to use SHA256 the way it is supposed to be used in this case:

$sleutel = hash('sha256', $this-&gt;sleutel . $this-&gt;userKey, TRUE);


Notice that there's a 3rd parameter which is set to TRUE, which means $sleutel will contain 32 raw bytes (= binary characters) instead of 64 human-readable hexadecimal characters.

I'm sure that will fix your "short-key" related problems, as well as any potential "long-key" problems.