drush pm update breaks drush so it wont work anymore
| Project: | Drush |
| Version: | 5.x-1.4 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
I am running on drupal 6.4 with drush ..... well, not sure. below is the .info file....
; $Id: drush.info,v 1.8.2.1 2008/08/11 00:36:25 weitzman Exp $
name = Drush
description = "drush (the drupal shell) provides a command line interface for Drupal."
package = Drush
core = 6.x
; Information added by drupal.org packaging script on 2008-12-07
version = "6.x-1.x-dev"
core = "6.x"
project = "drush"
datestamp = "1228608245"
The problem I am having is that drush will update itself into a state where it no longer works and throws all kind of php errors. What i want to know is if it is possible to have drush skip itself in the update process. drush has worked perfectly until just a few days ago. using svn i have restored the drush scripts to a state where they work and i want to keep it there at that rev and not progress. im not sure if this is an issue or not but i wasn't sure where to ask.

#1
That version is very old and has a few known bugs - could you please delete the old version (together with any drush_extras you might have installed) and try http://drupal.org/node/435004 instead?
#2
First of all, im am surprised and impressed at the speed i got a response.
but when i use that version i get the following error message....
PHP Notice: Undefined variable: options in /var/www/htdocs/employee/sites/all/modules/drush/includes/command.inc on line 71
PHP Notice: Undefined index: custom in /var/www/htdocs/employee/sites/all/modules/drush/includes/context.inc on line 93
PHP Notice: Constant DRUSH_PM_NO_VERSION already defined in /var/www/htdocs/employee/sites/all/modules/drush/commands/pm/pm.drush.inc on line 34
PHP Notice: Undefined index: path in /var/www/htdocs/employee/sites/all/modules/drush/includes/environment.inc on line 417
PHP Notice: Undefined index: pass in /var/www/htdocs/employee/sites/all/modules/drush/includes/environment.inc on line 477
PHP Notice: Undefined index: SERVER_PROTOCOL in /var/www/htdocs/employee/sites/all/modules/badbehavior/bad-behavior/core.inc.php on line 117
PHP Notice: Undefined offset: 1 in /var/www/htdocs/employee/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 47
PHP Notice: Undefined offset: 1 in /var/www/htdocs/employee/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 47
The command 'drush.php pm update' could not be executed. [error]
and i didn't get any of that before updating the code.
----------------------------------
edit: the OS is centOS 5 is that helps or make any difference. I get the same error messages as above when using Ubuntu 8.04 server AMD 64
----------------------------------
edit (again): disabling the badBehavior module gets rid of the errors from that module so those are in no way related to the problem i am having
#3
after messing around with arguments, i have more to tell....
this is what i get with the verbose option on pm update
NOTE: A code update for the Drupal core is available.
Drupal itself can't yet be updated by this tool. Please update Drupal manually.
No code updates available. [ok]
The command could not be executed succesfully (returned: [error]
Fatal error: Call to undefined function json_encode() in /var/www/htdocs/employee/sites/all/modules/drush/includes/backend.inc
on line 76
, code: 255)
An error occurred at function : pm_post_update [error]
#4
allright, i fixed it.
here was the problem for future reference. I was running a version of php that was older than 5.2.0. pre 5.2.0 doesn't have the json_encode() and json_decode() which this module relies upon. depending on your version of your OS, you can apt-get update php or yum update php or up2date php but some you have to install the jason module by hand. google for your individual OS and find out how to do it.
issue can be closed. thanks :)
#5
#6
I get a similar error regarding JSON on PHP 5.2.4.
No code updates available. [ok]
The external command could not be executed due to an application [error]
error.
The command could not be executed succesfully (returned: [error]
Fatal error: Call to undefined function json_encode() in
/usr/local/drush/includes/backend.inc on line 76
PHP Fatal error: Call to undefined function json_encode() in
/usr/local/drush/includes/backend.inc on line 76
, code: <em>255</em>)
An error occurred at function : drush_pm_post_update [error]
Xserve-1:/Library/WebServer/Documents/drupal root# php -v
PHP 5.2.4 (cli) (built: Aug 31 2007 23:40:28)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
#7
@dmjossel - drush update runs drush updatedb as a separate process call - it looks like that call is not finding your php 5.2+ version for some reason, but is finding an older version instead (http://us.php.net/json_encode - was introduced in 5.2). I would suggest checking into what php version is being found by that process and why.
#8
Having also been bitten by this just now, with PHP 5.2.10 on FreeBSD, it's worth noting that json commands might have been introduced in 5.2, but they are part of an extension. You need to be sure you install/enable that extension (or add the right part to your ./configure incantation if you compile from source) to get the json_* commands, even on 5.2+
The FreeBSD Port is called php5-json, for example.
#9
A simple check could be added at the top of drush.php after php version check:
if (!extension_loaded("json")) {die("Your PHP installation does not include json extension. Drush requires this extension to run some commands.\n");
}
It seems hard to me add this check on each command that will use
drush_invoke_backend.#10
Thanks AnotherHowie #8 did the trick.