OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



php errors - getRoleId() on a non-object

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

php errors - getRoleId() on a non-object

Postby MarieNyst » Wed Jan 16, 2013 1:34 pm

Hi,

I encountered two similar php errors. (ojs 2.4.1)

First :
Sometimes, when I want to add a reviewer to article, I have this message :
Code: Select all
[b]PHP Fatal error:  Call to a member function getId() on a non-object in \classes\submission\sectionEditor\SectionEditorAction.inc.php on line 128[/b]
PHP Stack trace:
PHP   1. {main}() \\index.php:0
PHP   2. PKPApplication->execute() \\index.php:63
PHP   3. Dispatcher->dispatch() \\lib\\pkp\\classes\\core\\PKPApplication.inc.php:189
PHP   4. PKPPageRouter->route() \\lib\\pkp\\classes\\core\\Dispatcher.inc.php:133
PHP   5. PKPRouter->_authorizeInitializeAndCallRequest() \\lib\\pkp\\classes\\core\\PKPPageRouter.inc.php:266
PHP   6. call_user_func() \\lib\\pkp\\classes\\core\\PKPRouter.inc.php:370
PHP   7. SubmissionEditHandler->selectReviewer() \\lib\\pkp\\classes\\core\\PKPRouter.inc.php:370
PHP   8. SectionEditorAction->addReviewer() \\pages\\sectionEditor\\SubmissionEditHandler.inc.php:467


Second :
Sometimes, when I want to change the review form content (as a reviewer), I have this message :
Code: Select all
[b]Fatal error: Call to a member function getRoleId() on a non-object in "my_ojs_repository"\classes\submission\form\comment\EditCommentForm.inc.php on line 41[/b]
PHP Stack trace:
PHP   1. {main}() \\index.php:0
PHP   2. PKPApplication->execute() \\ojs_copy\\index.php:63
PHP   3. Dispatcher->dispatch() \\lib\\pkp\\classes\\core\\PKPApplication.inc.php:189
PHP   4. PKPPageRouter->route() \\lib\\pkp\\classes\\core\\Dispatcher.inc.php:133
PHP   5. PKPRouter->_authorizeInitializeAndCallRequest() \\lib\\pkp\\classes\\core\\PKPPageRouter.inc.php:266
PHP   6. call_user_func() \\lib\\pkp\\classes\\core\\PKPRouter.inc.php:370
PHP   7. SubmissionCommentsHandler->editComment() \\lib\\pkp\\classes\\core\\PKPRouter.inc.php:370
PHP   8. ReviewerAction->editComment() \\pages\\reviewer\\SubmissionCommentsHandler.inc.php:81
PHP   9. EditCommentForm->EditCommentForm() \\classes\\submission\\reviewer\\ReviewerAction.inc.php:414


I don't know if the two are linked but they are similar...
MarieNyst
 
Posts: 24
Joined: Thu Nov 29, 2012 9:35 pm

Re: php errors - getRoleId() on a non-object

Postby MarieNyst » Wed Jan 16, 2013 1:46 pm

well.. I found this in the apache error log :

just before the first one :
Code: Select all
client denied by server configuration: /wamp/www/my_journal, referer: /index.php/my_journal/editor/selectReviewer/437


just before the second one :
Code: Select all
client denied by server configuration: /wamp/www/my_journal
client denied by server configuration: /wamp/www/my_journal, referer: /index.php/my_journal/reviewer
client denied by server configuration: /wamp/www/my_journal, referer: /index.php/my_journal/reviewer/viewPeerReviewComments/437/6
client denied by server configuration: /wamp/www/my_journal, referer: /index.php/my_journal/reviewer
client denied by server configuration: /wamp/www/my_journal, referer: /index.php/my_journal/reviewer/postPeerReviewComment


but the directory "/wamp/www/my_journal" doesn't exists... :?

And if it's a configuration issu, why does it appear only sometimes... ?
MarieNyst
 
Posts: 24
Joined: Thu Nov 29, 2012 9:35 pm

Re: php errors - getRoleId() on a non-object

Postby MarieNyst » Wed Jan 16, 2013 2:47 pm

something new :
I found in the database, in table "journals" the column "path"
if I change this value by "test", the error becomes : client denied by server configuration: /wamp/www/test

But my journal is not in the wamp/www directory... He is on an other hard-drive. I don't understand why, sometimes, ojs want to access this path. but only sometimes, since the site is working :?
MarieNyst
 
Posts: 24
Joined: Thu Nov 29, 2012 9:35 pm

Re: php errors - getRoleId() on a non-object

Postby MarieNyst » Thu Jan 17, 2013 8:41 am

I think I've found the problem, but I'm not sure to be able of solving it easily...

path to reach the site is : "my_server/alias/index.php/my_journal"
"my_server/alias/" : apache handle it and find the "index.php"
"my_journal" : this name is in my database, table 'journals', column 'path'

So, ojs keep the first part of the path and handle wih the part after "index.php"

I think that sometimes, for unknown reason, ojs try to reach "my_server/my_journal"
MarieNyst
 
Posts: 24
Joined: Thu Nov 29, 2012 9:35 pm

Re: php errors - getRoleId() on a non-object

Postby wyowen » Thu Jan 17, 2013 7:44 pm

pages\reviewer\SubmissionCommentsHandler.inc.php

function editComment($args, &$request) {
// $articleId = (int) array_shift($args);
// $commentId = (int) array_shift($args);
//
//
// if (!$commentId) $commentId = null;
//
// $reviewId = (int) $request->getUserVar('reviewId');
//
// $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
// $this->validate($request, $reviewId);
// $this->setupTemplate(true);
//
// $articleDao =& DAORegistry::getDAO('ArticleDAO');
// $article = $articleDao->getArticle($articleId);
//
// $articleCommentDao=& DAORegistry::getDAO('ArticleCommentDAO');
//
// $comment=$articleCommentDao->getMostRecentArticleComment($articleId);
// ReviewerAction::editComment($this->$article, $comment, $reviewId);
/**
* MEPAN add.
* Solve reviewers review comments cannot be modified
* @param $args array
* @param $request object
*/
$articleId = (int) array_shift($args);//
$commentId = (int) array_shift($args);//
if (!$commentId) $commentId = null;//

$reviewId = (int) $request->getUserVar('reviewId');//

$this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));//
$this->validate($request);
$this->setupTemplate(true);//
$comment =& $this->comment;

$articleDao =& DAORegistry::getDAO('ArticleDAO');//
$article = $articleDao->getArticle($articleId);//
ReviewerAction::editComment($article,$comment,$reviewId );
}

/**
* Save comment.
* @param $args array
* @param $request object
*/
wyowen
 
Posts: 1
Joined: Thu Jan 17, 2013 7:20 pm

Re: php errors - getRoleId() on a non-object

Postby MarieNyst » Fri Jan 18, 2013 7:18 am

Hi wyowen,

thank you for your answer,
but if it could solve the review comment edition, the other issues are still here. Well, I cannot check if your solution works, because I cannot add a reviewer to article... :?

Similar error is launched when I suppress a comment. And the "client denied" error appear when I want to reach the page to add announcement too. (blank page though)

edit :
php error when I wanted to assign a reviewer came from there were no file. If someone have time to write a little more user friendly error message.

So wyowen, I tested your solution. I can reach the edit comment form, but when I want to save modification, I've the exact same error.
Though, the page seems to be slower with this modification. (well I prefer a slow page that works than a fast that doesn't work :roll: )

edit :

Problem solved, thank you wyowen ! :)
I made a similar modification in the "saveComment" method.

If someone need it, my submissionCommentHandler.inc.php :
Code: Select all
/**
    * Edit comment.
    * @param $args array
    * @param $request PKPRequest
    */
   function editComment($args, &$request) {
      $articleId = (int) array_shift($args);
      $commentId = (int) array_shift($args);
      if (!$commentId) $commentId = null;

      $reviewId = (int) $request->getUserVar('reviewId');

      $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
      $this->validate($request);
      $this->setupTemplate(true);
      $comment =& $this->comment;

      $articleDao =& DAORegistry::getDAO('ArticleDAO');
      $article = $articleDao->getArticle($articleId);

      ReviewerAction::editComment($article, $comment, $reviewId);
   }

   /**
    * Save comment.
    * @param $args array
    * @param $request object
    */
   function saveComment($args, $request) {
      $articleId = (int) $request->getUserVar('articleId');
      $commentId = (int) $request->getUserVar('commentId');
      $reviewId = (int) $request->getUserVar('reviewId');

      $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
      $this->validate($request);
      $this->setupTemplate(true);

      // If the user pressed the "Save and email" button, then email the comment.
      $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;

      $articleDao =& DAORegistry::getDAO('ArticleDAO');
      $article = $articleDao->getArticle($articleId);

      ReviewerAction::saveComment($article, $this->comment, $emailComment, $request);

      // Refresh the comment
      $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
      $comment =& $articleCommentDao->getArticleCommentById($commentId);

      // Redirect back to initial comments page
      if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
         $request->redirect(null, null, 'viewPeerReviewComments', array($articleId, $comment->getAssocId()));
      }
   }
MarieNyst
 
Posts: 24
Joined: Thu Nov 29, 2012 9:35 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 6 guests