Hi,
First of all I want to say that this is a really nice library you've build here.
Now while I'm doing development and I'm listing all the errors, I've notice a few E_NOTICE that appear in the tincanapi_get_object function because the $internal_path its not being parse properly:
$path = explode('/', drupal_get_normal_path($internal_path));
e.g. drupal_get_normal_path($internal_path) can return /node/[node_id]?query=params
That way in $path[1] you will not get just the node_id but the node_id with the query_params and that is causing the above notices
A quick fix for this would be using php internal parse_url function:
$path = explode('/', drupal_get_normal_path(parse_url($internal_path, PHP_URL_PATH)));
I've also attach a patch file for this.
Thanks,
Cornel Les
Comments
Comment #2
darren ohThe patch fixes this bug correctly.
Comment #3
kenianbei commentedI think a better change would be to rather check that $path[1] is_numberic. That way subContent will preserve their id.
Comment #4
kenianbei commentedComment #5
kenianbei commentedComment #6
darren ohThe patch in #4 doesn’t help us get the correct value for $path[1] if the URL contains a query string. The original patch is still the correct solution.
Comment #7
kenianbei commentedSorry, I should have outlined in more detail what my purpose was.
For the H5P module, there is also subcontent, which will look like this:
http://localhost/node/1?subContentId=xxxxx-xxxx-xxxx-xxxx-xxxxxxxx
The first patch will strip this id out of the url, and the LRS will have no record or way to group by subcontent. With the first patch the object is saved in the LRS without any subcontent info, like this:
If you use the second patch, the LRS record will look like this:
It seems like tincanapi is processing subcontent farther down in the process otherwise the finished LRS record would be just:
Does that make sense? Perhaps we could also get some feedback from the tincanapi module maintainers?
Comment #8
kenianbei commented