Fix an empty arrays condition and optimize a bit.

@ Fixed a crash in array_multisort() that happened when empty arrays
@ were passed to it. (Andrei)
This commit is contained in:
Andrei Zmievski 2000-04-28 14:01:08 +00:00
parent ddc36fb776
commit 105be1513d

View File

@ -2152,6 +2152,15 @@ PHP_FUNCTION(array_multisort)
}
}
/* If all arrays are empty or have only one entry,
we don't need to do anything. */
if (array_size < 1) {
efree(ARRAYG(multisort_flags));
efree(arrays);
efree(args);
RETURN_TRUE;
}
/* Create the indirection array. This array is of size MxN, where
M is the number of entries in each input array and N is the number
of the input arrays + 1. The last column is NULL to indicate the end