locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

array_multisort throws "Unable to delete property."

oleg-andreyev opened this issue · comments

Browser: PhantomJS
Code:

'use strict`
array_multisort(["productIds[]", "_"], 'SORT_ASC', ["productIds[]=977385529", "_=1502965788347"])

Error: array_multisort.js:171 Unable to delete property.
delete sortKeys[i]

Ref.: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Third, strict mode makes attempts to delete undeletable properties throw (where before the attempt would simply have no effect):

'use strict';
delete Object.prototype; // throws a TypeError

after creating sortArrs[0], we're creating sortArrs[2] instead of sortArrs[1], and because sequences is broken (not 0,1,2...) sortArrs.length will be 3, instead of 2

We've found another issue but under Edge:

Calling delete on '0' is not allowed in strict mode

Near this line:

if (arguments[i].hasOwnProperty(k)) {
                                delete arguments[i][k];
                            }

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 14 days.

Attempting something here: #472

No promises :)