User not recognized via Parse \ ParseUser but exists in $ _SESSION

I am currently writing a site built in PHP using Parse.com to store site data. I've used parse on several projects before and some of the functions fit very well. Now I am facing an issue where the logged in user cannot be detected properly.

<?php
  use Parse\ParseClient;
  use Parse\ParseObject;
  use Parse\ParseQuery;
  use Parse\ParseGeoPoint;
  use Parse\ParseUser;


  ParseClient::initialize('Omitted', 'Omitted', 'Omitted');
  (... truncated)

  function get_user(){
    //BROKEN.
    //TODO: Fix
    $currentUser = ParseUser::getCurrentUser();
    if ($currentUser) {
        return $currentUser->getObjectId();
    } else {
        return false;
    }
  }

  (... truncated)
?>

      

This code is only slightly modified from that in the PHP examples given by parsing, but seems to return false regardless of the Written state

A session of the session is called to ensure that the session is started, and the call print_r($_SESSION)

dumps a dump that includes the corresponding custom object.

I realize this is probably something stupid that I missed, but any pointers in the right direction would be greatly appreciated.

0


source to share


1 answer


For reference here - I used a Windows dedicated server that was configured in a slightly non-standard way. We've since migrated from a Windows server because Windows - and the barrage of unrelated issues meant it was easier to use CentOS.

This issue was resolved by explicitly calling the session syntax session sorting tool - ParseClient::setStorage( new ParseSessionStorage() );



This was unexpected, as the global store $_SESSION

contained the relevant information - but the parsing would not pick it up until the session store was set up.

0


source







All Articles