If you try to delete a node with the command:

drush entity-delete node 1

You will get this error:

[error] Argument 2 passed to drush_entity_delete() must be of the type array, string given entity.drush.inc:809

[error] E_RECOVERABLE_ERROR encountered; aborting. To ignore recoverable errors, run again with --no-halt-on-error

[error] Drush command terminated abnormally due to an unrecoverable error.

Comments

adriancid created an issue. See original summary.

adriancid’s picture

StatusFileSize
new533 bytes
adriancid’s picture

Status: Active » Needs review
clemens.tolboom’s picture

Assigned: adriancid » clemens.tolboom

@adriancid thanks for reporting. I'm not sure your patch solves the invalid argument type? I'll check tomorrow

adriancid’s picture

@clemens.tolboom I test the code and it works for me, the problem is that if you use this command:
drush entity-delete node 1 2
the params are not an array are a string and in the code you have:

function drush_entity_delete($entity_type = NULL, array $ids = array()) {
  $ids = func_get_args();

So, you force the function to recieve an array. But the param is a string, and when you use the function func_get_args() you will have in the $ids var the array that you need for the call of your function _drush_entity_delete($entity_type, $ids); in the line 825

clemens.tolboom’s picture

Version: 7.x-5.x-dev » 8.x-6.x-dev
Assigned: clemens.tolboom » Unassigned
Status: Needs review » Fixed

I fixed it differently on 8.x-6.x

-function drush_entity_delete($entity_type = NULL, array $ids = array()) {
+function drush_entity_delete($entity_type = NULL, $ids = NULL) {

Pushed to 7.x-5.x branch too.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.