diff -rup drush-orig/drush.php drush/drush.php --- drush-orig/drush.php 2009-10-26 02:26:36.000000000 +0000 +++ drush/drush.php 2009-12-30 12:10:41.000000000 +0000 @@ -5,7 +5,6 @@ * @file * drush is a PHP script implementing a command line shell for Drupal. * - * @requires PHP CLI 5.2.0, or newer. */ // Terminate immediately unless invoked as a command line script @@ -13,11 +12,7 @@ if (!drush_verify_cli()) { die('drush.php is designed to run via the command line.'); } -// Check supported version of PHP. -define('DRUSH_MINIMUM_PHP', '5.2.0'); -if (version_compare(phpversion(), DRUSH_MINIMUM_PHP) < 0) { - die('Your command line PHP installation is too old. Drush requires at least PHP ' . DRUSH_MINIMUM_PHP . "\n"); -} +require_once('JSON.php'); define('DRUSH_BASE_PATH', dirname(__FILE__)); define('DRUSH_COMMAND', $GLOBALS['argv'][0]); diff -rup drush-orig/includes/backend.inc drush/includes/backend.inc --- drush-orig/includes/backend.inc 2009-10-26 02:26:37.000000000 +0000 +++ drush/includes/backend.inc 2009-12-30 12:18:42.000000000 +0000 @@ -73,7 +73,8 @@ function drush_backend_output() { // Return the options that were set at the end of the process. $data['context'] = drush_get_merged_options(); if (!drush_get_context('DRUSH_QUIET')) { - printf(DRUSH_BACKEND_OUTPUT_DELIMITER, json_encode($data)); + $json = new Services_JSON(); + printf(DRUSH_BACKEND_OUTPUT_DELIMITER, $json->encode($data)); } } @@ -102,7 +103,8 @@ function drush_backend_parse_output($str } if ($output) { - $data = json_decode($output, TRUE); + $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $data = $json->decode($output); if (is_array($data)) { if ($integrate) { _drush_backend_integrate($data); @@ -167,7 +169,8 @@ function _drush_proc_open($cmd, $data = $process = proc_open($cmd, $descriptorspec, $pipes, null, null, array('context' => $context)); if (is_resource($process)) { if ($data) { - fwrite($pipes[0], json_encode($data)); // pass the data array in a JSON encoded string + $json = new Services_JSON(); + fwrite($pipes[0], $json->encode($data)); // pass the data array in a JSON encoded string } $info = stream_get_meta_data($pipes[1]); @@ -438,7 +441,8 @@ function _drush_backend_get_stdin() { $string = stream_get_contents($fp); fclose($fp); if (trim($string)) { - return json_decode($string, TRUE); + $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + return $json->decode($string); } return FALSE; } Only in drush: JSON.php