title: How do I make openssl_encrypt pad the input to the required block size?
body: <p>My code works if I manually pad my string to the length of 32.<br>
  My question is: Is there a way to make the openSSL pad the data, or do I always have to do it for it?  </p>
  
  <p>Working:</p>
  
  <pre><code> openssl_encrypt ("my baba is over the ocean1111111", 'AES-256-CBC', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV);
  </code></pre>
  
  <p>Not working:</p>
  
  <pre><code>openssl_encrypt ("my baba is over the ocean", 'AES-256-CBC', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV);
  </code></pre>
  
  <p>I solve this currently by self padding:  </p>
  
  <pre><code>$pad = 32 - (strlen("my baba is over the ocean") % 32);
  $clear = "my baba is over the ocean" . str_repeat(chr($pad), $pad); //encrypt this string
  </code></pre>