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

TypeError: Cannot read property 'length' of undefined, npm.js:7319

loretoparisi opened this issue · comments

/phpjs/build/npm.js:7319
      return string.length;
                   ^

TypeError: Cannot read property 'length' of undefined
    at exports.strlen (/phpjs/build/npm.js:7319:20)
    at Object.lineLabel (/functions.js:129:91)
    at Object.tests.addTests.block (/node-api.js:360:26)
    at runAllTests (/node-api.js:64:21)
    at Object.<anonymous> (/node-api.js:367:9)
    at Object.<anonymous> (/node-api.js:369:4)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

that should be in

exports.strlen = function (string) {
  var str = string + '';
    var i = 0,
      chr = '',
      lgth = 0;

    if (!this.php_js || !this.php_js.ini || !this.php_js.ini['unicode.semantics'] || this.php_js.ini[
      'unicode.semantics'].local_value.toLowerCase() !== 'on') {
      return string.length;
    }

Thanks for reporting! This was fixed while transitioning to Locutus. Also see http://locutus.io/2016/05/announcing-locutus/