PHP7.1 json_encode() Float Issue

This drove me nuts for a bit until I finally found this bug which points you to this RFC which says Currently json_encode() uses EG(precision) which is set to 14. That means that 14 digits at most are used for displaying (printing) the number. IEEE 754 double supports higher precision and serialize()/var_export() uses PG(serialize_precision) which … Read more

Switch php versions on commandline ubuntu 16.04

Interactive switching mode sudo update-alternatives –config php sudo update-alternatives –config phar sudo update-alternatives –config phar.phar Manual Switching From PHP 5.6 => PHP 7.1 Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Apache: $ sudo a2dismod php5.6 $ sudo a2enmod php7.1 $ sudo service apache2 restart Command Line: … Read more

Preparing for removal of Mcrypt in PHP 7.2

You can’t convert it, because Rijndael-256 is not AES-256, and the OpenSSL extension doesn’t ship with Rijndael-256 support. AES-256 is Rijndael-128 with a 256-bit (32-byte) key. Unfortunately, you’ll have to re-encrypt all of your data. Edit: Also, the scheme you’re currently using has some problems: It lacks authentication (HMACs are the easiest way to do … Read more

Fatal error: Switch statements may only contain one default clause (php7)

You can not use a case statement inside a case. Try this corrected code switch ( $type ) { case ‘heading’: echo ‘</td></tr><tr valign=”top”><td colspan=”2″><h4>’ . $desc . ‘</h4>’; break; case ‘checkbox’: echo ‘<input class=”checkbox’ . $field_class . ‘” type=”checkbox” id=”‘ . $id . ‘” name=”‘ . $shortname_options . ‘[‘ . $id . ‘]’ . … Read more