Closed (works as designed)
Project:
Services
Version:
6.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2011 at 14:09 UTC
Updated:
22 Jul 2011 at 20:25 UTC
When creating a REST resource with hook_services_resources() and requesting an argument in the retrieve action of type int, it is allowing strings to be passed through. Further, the int is sent to the callback as a string.
<?php
$res = array(
'profile' => array(
'retrieve' => array(
'help' => 'Retrieves a user\'s brain',
'callback' => 'brain_api_brain_retrieve',
'access callback' => 'user_access',
'access arguments' => array('access content'),
'access arguments append' => false,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'The user id of the brain to get',
'source' => array('path' => '0'),
'optional' => false,
'default value' => NULL,
)
),
),
Comments
Comment #1
kylebrowning commentedBasically typecasting maintanence is a bitch and PHP does a pretty good job of handling this.
http://www.php.net/manual/en/language.types.string.php#language.types.st...