Skip to content

Commit 55528d8

Browse files
author
Ruben Bridgewater
committed
Revert 228573b
Not inheriting from the prototype is a BC
1 parent fe00bf2 commit 55528d8

File tree

5 files changed

+10
-18
lines changed

5 files changed

+10
-18
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Features
1111
- The JS parser is from now on the new default as it is a lot faster than the hiredis parser
1212
- This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible.
1313

14+
Bugfixes
15+
16+
- Reverted support for `__proto__` (v.2.6.0-2) to prevent and breaking change
17+
1418
Deprecations
1519

1620
- The `parser` option is deprecated and should be removed. The built-in Javascript parser is a lot faster than the hiredis parser and has more features

lib/rawObject.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
'use strict';
22

3-
var RawObject = require('./rawObject');
4-
53
// hgetall converts its replies to an Object. If the reply is empty, null is returned.
64
// These function are only called with internal data and have therefore always the same instanceof X
75
function replyToObject (reply) {
86
// The reply might be a string or a buffer if this is called in a transaction (multi)
97
if (reply.length === 0 || !(reply instanceof Array)) {
108
return null;
119
}
12-
var obj = new RawObject();
10+
var obj = {};
1311
for (var i = 0; i < reply.length; i += 2) {
1412
obj[reply[i].toString('binary')] = reply[i + 1];
1513
}

test/commands/hgetall.spec.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ describe("The 'hgetall' method", function () {
2222
});
2323

2424
it('handles simple keys and values', function (done) {
25-
client.hmset(['hosts', '__proto__', '1', 'another', '23', 'home', '1234'], helper.isString('OK'));
25+
client.hmset(['hosts', 'hasOwnProperty', '1', 'another', '23', 'home', '1234'], helper.isString('OK'));
2626
client.HGETALL(['hosts'], function (err, obj) {
27-
if (!/^v0\.10/.test(process.version)) {
28-
assert.strictEqual(3, Object.keys(obj).length);
29-
assert.strictEqual('1', obj.__proto__.toString()); // eslint-disable-line no-proto
30-
}
27+
assert.strictEqual(3, Object.keys(obj).length);
28+
assert.strictEqual('1', obj.hasOwnProperty.toString());
3129
assert.strictEqual('23', obj.another.toString());
3230
assert.strictEqual('1234', obj.home.toString());
3331
done(err);

test/pubsub.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ describe('publish/subscribe', function () {
204204

205205
it('subscribe; close; resubscribe with prototype inherited property names', function (done) {
206206
var count = 0;
207-
var channels = ['__proto__', 'channel 2'];
208-
var msg = ['hi from channel __proto__', 'hi from channel 2'];
207+
var channels = ['channel 1', 'channel 2'];
208+
var msg = ['hi from channel 1', 'hi from channel 2'];
209209

210210
sub.on('message', function (channel, message) {
211211
var n = Math.max(count - 1, 0);

0 commit comments

Comments
 (0)