We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

$this->request->getPut() returns empty array

public function putAction() {        
            if ($this->request->isPut() == true) {
                $data = $this->request->getPut();
                }
}

When I use this method, I recieve an ampty array in variable $data. So I use $this->request->getRawBody(), but it can't be use anywhere. What I am doing wrong?

This code is working correct at another Ubuntu with same configuration. I havecomplete comapare php modules, php.ini, nginx.conf and host.conf. So I dont know what ot do.

$ php -v
 PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57) 
 Copyright (c) 1997-2014 The PHP Group
 Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
$ nginx -v
 nginx version: nginx/1.8.0
nginx host config:
 server {
    listen  80;
    server_name  main.dev;

    root    /home/c0nstruct0r/Sites/work/main/public;

        index index.php;

    charset utf-8;

    rewrite_log  on;
    client_max_body_size 5M;
    access_log  /var/log/nginx/main_access.log;
    error_log   /var/log/nginx/main_error.log;
    location / {

  if (-f $request_filename) {
 break;
  }

  if (!-e $request_filename) {

 rewrite ^(.+)$ /index.php?_url=$1 last;
 break;
  }
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include   fastcgi_params;
        fastcgi_buffers 256 16k;
    }
 }

What version of Phalcon are you using? How is formatted the raw body in the request?

edited Jun '15

phalcon version : 2.0.3

$inputData = $this->request->getRawBody();  // here $inputData = 'id=55804d27d8de843e058b459f&title=product+group+title'
parse_str($inputData, $data); // and I working with $data