Unsupported operand types when call _getAllParams()
December 31, 2006 on 2:40 pm | In Zend Framework |I think it is a bug, however, it seems that I can’t login into Zend Framework Wiki today. Anyway, here is what I have found.
When I call _getAllParams() in FormController, like
Code (php)
-
$this->_getAllParams();
-
-
I got the error message as "unsupported operand types".
Finally, I found the problem in Zend\Controller\Request\Http.php line 601
Code (php)
-
590 /**
-
591 * Retrieve an array of parameters
-
592 *
-
593 * Retrieves a merged array of parameters, with precedence of userland
-
594 * params (see {@link setParam()}), $_GET, $POST (i.e., values in the
-
595 * userland params will take precedence over all others).
-
596 *
-
597 * @return array
-
598 */
-
599 public function getParams()
-
600 {
-
601 return $this->_params + $_GET + $_POST;
-
602 }
-
The reason is because $_GET and/or $_POST was NULL when getParams() was called.
Temporarily , I changed it as below:
Code (php)
-
public function getParams()
-
{
-
-
if ( null !== $_GET && null !== $_POST) {
-
return $this->_params + $_GET + $_POST;
-
} elseif ( null !== $_GET && null == $_POST) {
-
return $this->_params + $_GET;
-
} elseif ( null == $_GET && null !== $_POST) {
-
return $this->_params + $_POST;
-
}
-
return $this->_params;
-
}
6 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^
Hi,
Ihave a look on your code.
After migrate :
I don’t have issues with post.
I can’t get the get data and you don’t use in your code.
Have you a example ?
About your code.
You could do this :
#
if ( null !== $_GET) {
#
$this->_params += $_GET ;
}
the same with post
return $this->_params;
by
Berty
Comment by Berty — January 2, 2007 #
Thanks Berty,
I think I did that. Could you download my source code.
Under the root folder, open http.php, look at line 599 to 613
Thanks.
Jason
Comment by admin — January 2, 2007 #
Hi, Jason,
when I try to install your code, I find the following error, will you please tell me how could I debug? thanks.
Jeff
Fatal error: Uncaught exception ‘Zend_Controller_Dispatcher_Exception’ with message ‘”index.php” controller does not exist’ in /homepages/21/d187987284/htdocs/zend/library/Zend.php:229 Stack trace: #0 /homepages/21/d187987284/htdocs/zend/library/Zend/Controller/Dispatcher.php(386): Zend::exception(’Zend_Controller…’, ‘”index.php” con…’) #1 /homepages/21/d187987284/htdocs/zend/library/Zend/Controller/Front.php(725): Zend_Controller_Dispatcher->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 /homepages/21/d187987284/htdocs/zend/index.php(55): Zend_Controller_Front->dispatch() #3 {main} thrown in /homepages/21/d187987284/htdocs/zend/library/Zend.php on line 229
Comment by Jeff — January 4, 2007 #
Jeff,
I use Zend Studio to debug it.
But for your case, maybe the problem is related to the configuration.
if you debug it, please check $baseUrl after executing this statement:
$baseUrl = substr($_SERVER[’PHP_SELF’], 0,
strpos($_SERVER[’PHP_SELF’], ‘/index.php’));
if $baseUrl is not what you expected. please set it manually through \application\constant.php
Good luck!
Jason.
Comment by admin — January 4, 2007 #
I fixed this recently in subversion. Enjoy!
Comment by Matthew Weier O'Phinney — January 4, 2007 #
Thanks Matthew,
I saw it in revision in 2602. Your code is great!
Comment by admin — January 4, 2007 #