I'm getting the following errors when attempting to log in through Drupalgap in the iOS simulator:

First, I get the following resource errors in the Safari debugger. However, these do not affect operation as far as I can tell (just noting them in order to be complete).

[Error] Failed to load resource: The requested URL was not found on this server. (jquery.mobile-1.4.2.min.map, line 0)
[Error] Failed to load resource: The requested URL was not found on this server. (jquery.min.map, line 0)

Then I log in to the site via the app with a valid username and password.

[Log] POST: http://myserver.com/?q=drupalgap/user/login.json (console-via-logger.js, line 173)
[Log] 200 - OK (console-via-logger.js, line 173)
[Log] POST (ERROR): http://myserver.com/?q=drupalgap/user/login.json - 200 - OK (console-via-logger.js, line 173)

But then I get this error message (Drupal.services.call - onload - SyntaxError: JSON Parse error: Unexpected EOF)

console-via-logger.js:173POST: http://myserver.com/?q=drupalgap/user/login.json
console-via-logger.js:173200 - OK
console-via-logger.js:173POST (ERROR): http://myserver.com/?q=drupalgap/user/login.json - 200 - OK
console-via-logger.js:173
console-via-logger.js:173X-Styx-Build-Num: 904
Date: Mon, 13 Apr 2015 08:00:39 GMT
Via: 1.1 varnish
X-Styx-Version: StyxGo
X-Styx-Build-Sha: 7bb2d8bfad3980a9e38d528bfd8348ce61cc0c42
Age: 0
X-Powered-By: PHP/5.5.23
Connection: keep-alive
Content-Length: 0
X-Varnish: 710369466
X-Styx-Build-Date: Wed Apr  8 00:26:15 UTC 2015
X-Pantheon-Endpoint: 2c1830ae-a962-46b8-844a-5cbd437bb525
Server: nginx
Content-Type: application/json
X-Styx-Req-Id: styx-23b4e292c80324eac692488e5b987708
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Set-Cookie: SESSc174e48130bebc8918171e28d211c321=xmYs-b4Y0kkOsNGUZiIkeIih-iZ2yLj045kkyowf574; path=/; domain=.myserver.com; httponly
Accept-Ranges: bytes
X-Pantheon-Styx-Hostname: styxe3d2930f
console-via-logger.js:173

Drupal.services.call - onload - SyntaxError: JSON Parse error: Unexpected EOF

I didn't experience this problem before, so I tried to roll back a couple weeks in version control, but I still had the same problem after clearing caches and rebuilding. Any pointers about where to look further for the cause of this problem would be much appreciated.

Comments

tyler.frankenstein’s picture

Status: Active » Postponed (maintainer needs more info)

Have you tried updating to the development snapshot of jDrupal? https://easystreet3.com/jDrupal/download

I believe this me be related to this commit: https://github.com/easystreet3/jDrupal/commit/add9bb12b378ac5e691f95dd55...

ptmkenny’s picture

I downloaded the dev version of jDrupal-min, placed it in my www directory, changed the link in index.html to point to it, rebuilt my app, reset the iOS simulator, and then tried to test it again-- unfortunately, I received the same error.

[Log] POST: http://myserver.com/?q=dg/user/login.json (console-via-logger.js, line 173)
[Log] 200 - OK (console-via-logger.js, line 173)
[Log] POST (ERROR): http://myserver.com/?q=dg/user/login.json - 200 - OK (console-via-logger.js, line 173)

[Log] X-Styx-Build-Num: 904
 (console-via-logger.js, line 173)
Date: Mon, 13 Apr 2015 14:02:15 GMT
Via: 1.1 varnish
X-Styx-Version: StyxGo
X-Styx-Build-Sha: 7bb2d8bfad3980a9e38d528bfd8348ce61cc0c42
Age: 0
X-Powered-By: PHP/5.5.23
Connection: keep-alive
Content-Length: 0
X-Varnish: 3364236029
X-Styx-Build-Date: Wed Apr  8 00:26:15 UTC 2015
X-Pantheon-Endpoint: 2c1830ae-a962-46b8-844a-5cbd437bb525
Server: nginx
Content-Type: application/json
X-Styx-Req-Id: styx-086d0395b149041693dd89807e2a5903
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Set-Cookie: SESSc174e48130bebc8918171e28d211c321=NOnGm6HtC4O70sVh4XGHjXiDSNpp_l0YXL0zdfRwpLI; path=/; domain=.myserver.com; httponly
Accept-Ranges: bytes
X-Pantheon-Styx-Hostname: styx803cea0c

[Log] Drupal.services.call - onload - SyntaxError: JSON Parse error: Unexpected EOF (console-via-logger.js, line 173)
ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active
tyler.frankenstein’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, try the non minified version of jDrupal (the minified dev snapshot can be behind sometimes).

Very strange how it says a POST error with a 200 OK.

ptmkenny’s picture

Title: Upon login, Drupal.services.call - onload - SyntaxError: JSON Parse error: Unexpected EOF » PHP 5.5 upon login, Drupal.services.call - onload - SyntaxError: JSON Parse error: Unexpected EOF
Status: Postponed (maintainer needs more info) » Active

Ok, so I downloaded the non-minified dev version of jDrupal, placed it in my www directory, changed the link in index.html to point to it, rebuilt my app, reset the iOS simulator, and then tried to test it again-- and unfortunately, I received the same error.

BUT, then I remembered a couple weeks ago I had upgraded my dev server from PHP 5.3 to 5.5-- and so I switched it back from 5.5 to 5.3, reset everything, and tried again-- this time, I was able to log in without any problem.

So, this is no longer an urgent request (as I can just roll back to PHP 5.3), but at some point it would be nice to figure out what is behind the incompatibility with 5.5.

tyler.frankenstein’s picture

Category: Support request » Task
Status: Active » Needs work

Good catch. I'm guessing it has to do with the use of & in function parameter declarations with the drupalgap.module file(s).

i.e. this

function hello_world(&$foo) { }

should become:

function hello_world($foo) { }

But it'd be nice to do this in a way that accommodate later versions of PHP, while maintaining compatibility with D7's minimum requirements.