Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9326 closed defect (fixed)

path variable is set to null because of json_decode

Reported by: Simon Speich Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.4
Component: DojoX Data Version: 1.3.1
Keywords: FileStore, php, demos, data Cc:
Blocked By: Blocking:

Description

In the file filestore_dojotree.php and filestore_dojoxdata.php on line 55 the $path variable is not a json encoded string. Therefore the function json_decode() returns NULL and subdirectories are never displayed, because the line 58

if (!is_string($path)) {

is always false! Solution: Just omit the function call in line 55 and use

$path = $_GET['path']

and everything works as expected.

//See if a specific file was requested, or if it is just a query for files.
$path = false;
if (array_key_exists("path", $_GET)) {
  $path = $_GET['path'];
  // line below would return NULL
  // $path = json_decode($_GET['path']);
}
// line below always evaluates to false because json_decode sets the $path to NULL!
if (!is_string($path)) {

Change History (4)

comment:1 Changed 10 years ago by Jared Jurkiewicz

This is working fine for me on dojocampus: http://docs.dojocampus.org/dojox/data/FileStore

I see it making many calls with path set and it's loading data from the server fine.

comment:2 Changed 10 years ago by Jared Jurkiewicz

So, the json_decode function works here. Though you are right, path isn't JSON encoded, so shouldn't need that call.

Note I tested on a basic PHP.net PHP install.

comment:3 Changed 10 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [17601]) Minor tweak to PHP files for FileStore?. fixes #9326

comment:4 Changed 10 years ago by Jared Jurkiewicz

Milestone: tbd1.4
Note: See TracTickets for help on using tickets.