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

kylebrowning’s picture

Status: Active » Closed (works as designed)

Basically 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...