1
0
Fork 0

Add backwards compatibility with node v4

Austin Schaffer 2020-02-14 11:44:20 -05:00
parent 98d9d208f6
commit bcfa7c061c
2 changed files with 4 additions and 5 deletions

View File

@ -21,7 +21,7 @@
},
"scripts": {
"postinstall": "./configure"
"postinstall": "./configure && if [ $(@NODE@ --version | sed 's/^v//' | cut -d. -f1) -ge \"12\" ]; then ln -s php-serialize ./node_modules/php; else rm -f node_modules/php; fi"
},
"dependencies": {

View File

@ -23,8 +23,7 @@
// php compatibility
var Class = require( 'easejs' ).Class,
phpS = require('php-serialize');
php = require( 'php' );
/**
* Stores/retrieves user PHP session data from memcached
@ -235,7 +234,7 @@ module.exports = Class.extend( require( '../../events' ).EventEmitter,
for ( var key in data )
{
newdata += key + '|' + phpS.serialize( data[ key ] );
newdata += key + '|' + php.serialize( data[ key ] );
}
_self._memcache.set( _self._id, newdata, 0, function()
@ -281,7 +280,7 @@ module.exports = Class.extend( require( '../../events' ).EventEmitter,
val = splits[ ++i ];
// the values are serialized PHP data; unserialize them
val = phpS.unserialize( val );
val = php.unserialize( val );
// add to the session data
session_data[ key ] = val;