Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Upgrading from PHP 5.3 to 5.5

Glen Mailer
October 05, 2013

Upgrading from PHP 5.3 to 5.5

A small talk on the experiences gained from migrating from PHP 5.3 to 5.5.

Glen Mailer

October 05, 2013
Tweet

More Decks by Glen Mailer

Other Decks in Programming

Transcript

  1. Upgrade a dev box
 Support 5.3 and 5.5
 Pass all

    tests
 Upgrade 1 Test env
 Upgrade CI
 Upgrade Test & Staging
 Incrementally Upgrade Live
  2. Check for new function, fall back to old one if

    (function_exists('opcache_reset')) { opcache_reset(); } else { apc_clear_cache(); }
  3. “The PHP api will retain compatibility with APC, as will

    common configuration options, providing a drop in replacement.” APCu
  4. Type-checked function function inc($int) { if (!is_int($int)) { throw new

    InvalidArgumentException( 'Expected int, got: ' . $int ); } return $int + 1; }
  5. Unit test for type-checked function /** * @dataprovider provideIncInvalid */

    function testIncRejectsInvalid($a) { try { inc($a); $this->fail('Expected exception'); } catch (InvalidArgumentException $ex) {} } function provideIncInvalid() { return array( null, true, "string", array() ); }
  6. Upgrade a dev box
 Support 5.3 and 5.5
 Pass all

    tests
 Upgrade 1 Test env
 Upgrade CI
 Upgrade Test & Staging
 Incrementally Upgrade Live
  7. Upgrade a dev box
 Support 5.3 and 5.5
 Pass all

    tests
 Upgrade 1 Test env
 Upgrade CI
 Upgrade Test & Staging
 Incrementally Upgrade Live