r91634 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91633‎ | r91634 | r91635 >
Date:10:46, 7 July 2011
Author:questpc
Status:deferred
Tags:
Comment:
MVC refactoring. Implemented max_attempts qpoll attribute
Modified paths:
  • /trunk/extensions/QPoll/ctrl/qp_abstractpoll.php (modified) (history)
  • /trunk/extensions/QPoll/ctrl/qp_abstractquestion.php (modified) (history)
  • /trunk/extensions/QPoll/ctrl/qp_poll.php (modified) (history)
  • /trunk/extensions/QPoll/ctrl/qp_pollstats.php (modified) (history)
  • /trunk/extensions/QPoll/ctrl/qp_question.php (modified) (history)
  • /trunk/extensions/QPoll/ctrl/qp_questionstats.php (modified) (history)
  • /trunk/extensions/QPoll/i18n/qp.i18n.php (modified) (history)
  • /trunk/extensions/QPoll/qp_eval.php (modified) (history)
  • /trunk/extensions/QPoll/qp_pollstore.php (modified) (history)
  • /trunk/extensions/QPoll/qp_user.css (modified) (history)
  • /trunk/extensions/QPoll/qp_user_rtl.css (modified) (history)
  • /trunk/extensions/QPoll/view/qp_pollstatsview.php (modified) (history)
  • /trunk/extensions/QPoll/view/qp_pollview.php (modified) (history)
  • /trunk/extensions/QPoll/view/qp_questionstatsview.php (modified) (history)
  • /trunk/extensions/QPoll/view/qp_questionview.php (modified) (history)

Diff [purge]

Index: trunk/extensions/QPoll/i18n/qp.i18n.php
@@ -54,6 +54,7 @@
5555 'qp_result_error' => 'Syntax error',
5656 'qp_vote_button' => 'Vote',
5757 'qp_vote_again_button' => 'Change your vote',
 58+ 'qp_submit_attempts_left' => '$1 {{PLURAL:$1|attempt|attempts}} left',
5859 'qp_polls_list' => 'List all polls',
5960 'qp_users_list' => 'List all users',
6061 'qp_browse_to_poll' => 'Browse to $1',
@@ -2316,6 +2317,7 @@
23172318 'qp_result_error' => 'Синтаксическая ошибка',
23182319 'qp_vote_button' => 'Проголосовать',
23192320 'qp_vote_again_button' => 'Переголосовать',
 2321+ 'qp_submit_attempts_left' => '{{PLURAL:$1|Осталась|Осталось|Осталось}} $1 {{PLURAL:$1|попытка|попытки|попыток}} ответа',
23202322 'qp_polls_list' => 'Список всех опросов',
23212323 'qp_users_list' => 'Список всех участников',
23222324 'qp_browse_to_poll' => 'Перейти к $1',
Index: trunk/extensions/QPoll/qp_user_rtl.css
@@ -1,4 +1,4 @@
2 -.qpoll .no_more_attempts { border: 1px solid gray; padding: 0.1em 0.5em 0.1em 0.5em; color: black; background-color: lightblue; margin-right: 1em; }
 2+.qpoll .attempts_counter { border: 1px solid gray; padding: 0.1em 0.5em 0.1em 0.5em; color: black; background-color: lightblue; margin-right: 1em; }
33 .qpoll .question { margin-right:2em; }
44 .qpoll .margin { padding-right:20px; }
55 .qpoll .header .questionId {font-size: 1.1em; font-weight: bold; float: right;}
Index: trunk/extensions/QPoll/ctrl/qp_abstractpoll.php
@@ -66,10 +66,6 @@
6767
6868 # current state of poll parsing (no error)
6969 var $mState = '';
70 - # optional address of the poll which must be answered first
71 - var $dependsOn = '';
72 - # optional template used to interpret user vote in the Special:Pollresults page
73 - var $interpretation = '';
7470 # // true, when the poll is posted (answered)
7571 var $mBeingCorrected = false;
7672
@@ -108,12 +104,6 @@
109105 # it is required to be set manually via id="value" parameter
110106 # ( used only in "declaration" mode )
111107 $this->mPollId = array_key_exists('id', $argv) ? trim( $argv['id'] ) : null;
112 - if ( array_key_exists('dependance', $argv) ) {
113 - $this->dependsOn = trim( $argv['dependance'] );
114 - }
115 - if ( array_key_exists('interpretation', $argv) ) {
116 - $this->interpretation = trim( $argv['interpretation'] );
117 - }
118108 }
119109
120110 /**
@@ -133,7 +123,7 @@
134124 # increase the order_id counter for the future successfully declared polls
135125 # (remember, we're in declaration mode, where 'order_id' is important
136126 self::$sOrderId++;
137 - # renderPoll() assumes that the poll is not being submitted and is correctly declared
 127+ # view->renderPoll() assumes that the poll is correctly declared
138128 return $this->view->renderPoll();
139129 }
140130 }
Index: trunk/extensions/QPoll/ctrl/qp_abstractquestion.php
@@ -14,31 +14,32 @@
1515 var $mCategorySpans = Array();
1616 var $mCommonQuestion = ''; // GET common question of the poll
1717 var $mProposalText = Array(); // an array of question proposals
18 - var $mBeingCorrected = false; // true, when user is posting this question via the poll's form
1918 var $alreadyVoted = false; // whether the selected user has already voted this question ?
2019
2120 # statistics
2221 var $Percents = null;
2322
 23+ # question's parent controller
 24+ var $poll;
2425 # question's view
2526 var $view;
2627
2728 /**
2829 * Constructor
2930 * @public
 31+ * @param $poll an instance of question's parent controller
3032 * @param $view an instance of question view "linked" to this question
31 - * @param $beingCorrected boolean
3233 * @param $questionId the identifier of the question used to gernerate input names
3334 */
34 - function __construct( qp_AbstractView $view, $beingCorrected, $questionId ) {
 35+ function __construct( qp_AbstractPoll $poll, qp_AbstractView $view, $questionId ) {
3536 global $wgRequest;
3637 $this->mRequest = &$wgRequest;
3738 $this->mQuestionId = $questionId;
38 - $this->mBeingCorrected = $beingCorrected;
3939 $this->mProposalPattern = '`^[^\|\!].*`u';
4040 $this->mCategoryPattern = '`^\|(\n|[^\|].*\n)`u';
4141 $view->setController( $this );
4242 $this->view = $view;
 43+ $this->poll = $poll;
4344 }
4445
4546 /**
@@ -90,4 +91,8 @@
9192 return false;
9293 }
9394
 95+ function applyStateToParent() {
 96+ $this->poll->mState = $this->getState();
 97+ }
 98+
9499 } /* end of qp_AbstractQuestion class */
Index: trunk/extensions/QPoll/ctrl/qp_pollstats.php
@@ -42,7 +42,7 @@
4343 */
4444 class qp_PollStats extends qp_AbstractPoll {
4545
46 - function __construct( $argv, $view ) {
 46+ function __construct( $argv, qp_PollStatsView $view ) {
4747 parent::__construct( $argv, $view );
4848 $this->pollAddr = trim( $argv['address'] );
4949 # statistical mode is active, but qp_Setup::$global_showresults still can be false
@@ -58,7 +58,7 @@
5959 $this->mState = "error";
6060 return self::fatalError( 'qp_error_id_in_stats_mode' );
6161 }
62 - if ( $this->dependsOn !== '' ) {
 62+ if ( isset( $this->dependsOn ) && $this->dependsOn !== '' ) {
6363 $this->mState = "error";
6464 return self::fatalError( 'qp_error_dependance_in_stats_mode' );
6565 }
@@ -93,6 +93,7 @@
9494 # first pass: parse the headers
9595 foreach ( $this->pollStore->Questions as &$qdata ) {
9696 $question = new qp_QuestionStats(
 97+ $this,
9798 qp_QuestionStatsView::newFromBaseView( $this->view ),
9899 $qdata->type,
99100 $qdata->question_id
Index: trunk/extensions/QPoll/ctrl/qp_poll.php
@@ -42,8 +42,39 @@
4343 */
4444 class qp_Poll extends qp_AbstractPoll {
4545
46 - function __construct( $argv, $view ) {
 46+ # optional address of the poll which must be answered first
 47+ var $dependsOn = '';
 48+ # optional template used to interpret user vote in the Special:Pollresults page
 49+ var $interpretation = '';
 50+ # maximal count of attepts of answer submission ( < 1 for infinite )
 51+ var $maxAttempts = 0;
 52+
 53+ function __construct( $argv, qp_PollView $view ) {
4754 parent::__construct( $argv, $view );
 55+ # dependance attr
 56+ if ( array_key_exists('dependance', $argv) ) {
 57+ $this->dependsOn = trim( $argv['dependance'] );
 58+ }
 59+ # interpretation attr
 60+ if ( array_key_exists('interpretation', $argv) ) {
 61+ $this->interpretation = trim( $argv['interpretation'] );
 62+ }
 63+ # max_attempts attr
 64+ $this->maxAttempts = qp_Setup::$max_submit_attempts;
 65+ if ( array_key_exists('max_attempts', $argv) ) {
 66+ $this->maxAttempts = intval( trim( $argv['max_attempts'] ) );
 67+ # do not allow to specify more submit attempts than is set by global level in qp_Setup
 68+ if ( qp_Setup::$max_submit_attempts > 0 &&
 69+ # also does not allow to set infinite number ( < 1 ) when global level is finite ( > 0 )
 70+ ( $this->maxAttempts < 1 ||
 71+ $this->maxAttempts > qp_Setup::$max_submit_attempts ) ) {
 72+ $this->maxAttempts = qp_Setup::$max_submit_attempts;
 73+ }
 74+ }
 75+ # negative values are possible however meaningless (0 is infinite, >0 is finite)
 76+ if ( $this->maxAttempts < 0 ) {
 77+ $this->maxAttempts = 0;
 78+ }
4879 # order_id is used to sort out polls on the Special:PollResults statistics page
4980 $this->mOrderId = self::$sOrderId;
5081 # Determine if this poll is being corrected or not, according to the pollId
@@ -111,6 +142,21 @@
112143 }
113144
114145 /**
 146+ * Please call after the poll has been loaded but before it's being submitted
 147+ * @return int number of attempts left (1..n); true for infinite number; false when no attempts left
 148+ */
 149+ function attemptsLeft() {
 150+ if ( $this->maxAttempts > 0 ) {
 151+ $result = $this->maxAttempts - $this->pollStore->attempts;
 152+ if ( $result > 0 ) {
 153+ return $result;
 154+ }
 155+ return false;
 156+ }
 157+ return true;
 158+ }
 159+
 160+ /**
115161 * Parses the text enclosed in poll tag
116162 * Votes, when user have submitted data successfully
117163 * @param $input - text enclosed in poll tag
@@ -121,7 +167,7 @@
122168 # parse the input; generates $this->questions[] array
123169 $this->parseQuestions( $input );
124170 # check whether the poll was successfully submitted
125 - if ( $this->pollStore->noMoreAttempts() ) {
 171+ if ( $this->attemptsLeft() === false ) {
126172 # user has no attempts left, refuse to submit and
127173 # will show the message in $this->view->renderPoll()
128174 return false;
@@ -271,8 +317,8 @@
272318 # @return question object with parsed headers and no data loaded
273319 function parseQuestionHeader( $header, $body ) {
274320 $question = new qp_Question(
 321+ $this,
275322 qp_QuestionView::newFromBaseView( $this->view ),
276 - $this->mBeingCorrected,
277323 ++$this->mQuestionId
278324 );
279325 # parse questions common question and XML attributes
Index: trunk/extensions/QPoll/ctrl/qp_questionstats.php
@@ -11,12 +11,13 @@
1212 /**
1313 * Constructor
1414 * @public
 15+ * @param $poll an instance of question's parent controller
1516 * @param $view an instance of question view "linked" to this question
1617 * @param $type type of question (taken from DB)
1718 * @param $questionId the identifier of the question used to gernerate input names
1819 */
19 - function __construct( qp_QuestionStatsView $view, $type, $questionId ) {
20 - parent::__construct( $view, false, $questionId );
 20+ function __construct( qp_PollStats $poll, qp_QuestionStatsView $view, $type, $questionId ) {
 21+ parent::__construct( $poll, $view, $questionId );
2122 $this->mType = $type;
2223 }
2324
Index: trunk/extensions/QPoll/ctrl/qp_question.php
@@ -207,7 +207,7 @@
208208 break;
209209 }
210210 # Determine if the input had to be checked.
211 - if ( $this->mBeingCorrected && $this->mRequest->getVal( $name ) == $value ) {
 211+ if ( $this->poll->mBeingCorrected && $this->mRequest->getVal( $name ) == $value ) {
212212 $inp[ 'checked' ] = 'checked';
213213 }
214214 if ( $this->answerExists( $inputType, $proposalId, $catId ) !== false ) {
@@ -215,7 +215,7 @@
216216 }
217217 if ( array_key_exists( 'checked', $inp ) ) {
218218 if ( $this->mSubType == 'unique' ) {
219 - if ( $this->mBeingCorrected && !$this->isUniqueProposalCategoryId( $proposalId, $catId ) ) {
 219+ if ( $this->poll->mBeingCorrected && !$this->isUniqueProposalCategoryId( $proposalId, $catId ) ) {
220220 $text = $this->view->bodyErrorMessage( wfMsg( 'qp_error_non_unique_choice' ), 'NA' ) . $text;
221221 unset( $inp[ 'checked' ] );
222222 QP_Renderer::addClass( $row[ $catId ], 'error' );
@@ -263,7 +263,7 @@
264264 }
265265 }
266266 # If the proposal was submitted but unanswered
267 - if ( $this->mBeingCorrected && !array_key_exists( $proposalId, $this->mProposalCategoryId ) ) {
 267+ if ( $this->poll->mBeingCorrected && !array_key_exists( $proposalId, $this->mProposalCategoryId ) ) {
268268 # if there was no previous errors, hightlight the whole row
269269 if ( $this->getState() == '' ) {
270270 foreach( $row as &$cell ) {
@@ -333,7 +333,7 @@
334334 # Determine if the input has to be checked.
335335 $input_checked = false;
336336 $text_answer = '';
337 - if ( $this->mBeingCorrected && $this->mRequest->getVal( $name ) !== null ) {
 337+ if ( $this->poll->mBeingCorrected && $this->mRequest->getVal( $name ) !== null ) {
338338 if ( $inputType == 'text' ) {
339339 $text_answer = trim( $this->mRequest->getText( $name ) );
340340 if ( strlen( $text_answer ) > qp_Setup::MAX_TEXT_ANSWER_LENGTH ) {
@@ -394,7 +394,7 @@
395395 throw new Exception( 'qp_error' );
396396 }
397397 # If the proposal was submitted but unanswered
398 - if ( $this->mBeingCorrected && !array_key_exists( $proposalId, $this->mProposalCategoryId ) ) {
 398+ if ( $this->poll->mBeingCorrected && !array_key_exists( $proposalId, $this->mProposalCategoryId ) ) {
399399 $prev_state = $this->getState();
400400 $text = $this->view->bodyErrorMessage( wfMsg( 'qp_error_no_answer' ), 'NA' ) . $text;
401401 # if there was no previous errors, hightlight the whole row
Index: trunk/extensions/QPoll/qp_user.css
@@ -42,7 +42,7 @@
4343 .qpoll .script_view { font-family: monospace, "Courier New"; white-space:pre; overflow:auto; color:black; background-color: lightgray; border-right: 1px solid darkgray; border-top: 1px solid darkgray; border-bottom: 1px solid darkgray; padding: 0.5em; }
4444
4545 /* LTR part (RTL is included from separate file */
46 -.qpoll .no_more_attempts { border: 1px solid gray; padding: 0.1em 0.5em 0.1em 0.5em; color: black; background-color: lightblue; margin-left: 1em; }
 46+.qpoll .attempts_counter{ border: 1px solid gray; padding: 0.1em 0.5em 0.1em 0.5em; color: black; background-color: lightblue; margin-left: 1em; }
4747 .qpoll .question { margin-left:2em; }
4848 .qpoll .margin { padding-left:20px; }
4949 .qpoll .header .questionId { font-size: 1.1em; font-weight: bold; float: left; }
Index: trunk/extensions/QPoll/qp_pollstore.php
@@ -870,18 +870,12 @@
871871 $qp_users_polls = self::$db->tableName( 'qp_users_polls' );
872872 $short = self::$db->addQuotes( $this->interpAnswer->short );
873873 $long = self::$db->addQuotes( $this->interpAnswer->long );
874 - $stmt = "INSERT INTO {$qp_users_polls} (uid,pid,short_interpretation,long_interpretation)\n VALUES ( " . intval( $this->last_uid ) . ", " . intval( $this->pid ) . ", {$short}, {$long} )\n ON DUPLICATE KEY UPDATE attempts = attempts + 1, short_interpretation = {$short} , long_interpretation = {$long}";
 874+ $this->attempts++;
 875+ $stmt = "INSERT INTO {$qp_users_polls} (uid,pid,short_interpretation,long_interpretation)\n VALUES ( " . intval( $this->last_uid ) . ", " . intval( $this->pid ) . ", {$short}, {$long} )\n ON DUPLICATE KEY UPDATE attempts = " . intval( $this->attempts ) . ", short_interpretation = {$short} , long_interpretation = {$long}";
875876 self::$db->query( $stmt, __METHOD__ );
876877 }
877878 }
878879
879 - /**
880 - * Please call after the poll has been loaded but before it's being submitted
881 - */
882 - function noMoreAttempts() {
883 - return qp_Setup::$max_submit_attempts > 0 && $this->attempts >= qp_Setup::$max_submit_attempts;
884 - }
885 -
886880 # when the user votes and poll wasn't previousely voted yet, it also creates the poll structures in DB
887881 function setUserVote() {
888882 if ( $this->pid !==null &&
Index: trunk/extensions/QPoll/view/qp_pollstatsview.php
@@ -68,7 +68,7 @@
6969 # render the question statistics only when showResuls isn't 0 (suppress stats)
7070 if ( $question->view->showResults['type'] != 0 ) {
7171 if ( $this->perRow > 1 ) {
72 - $write_col[] = array( '__tag'=>'td', 'valign'=>'top', 0=>$question->view->renderQuestion( $this->ctrl ), '__end'=>"\n" );
 72+ $write_col[] = array( '__tag'=>'td', 'valign'=>'top', 0=>$question->view->renderQuestion(), '__end'=>"\n" );
7373 if ( $this->currCol == 1 ) {
7474 $write_row[] = array( '__tag'=>'tr', 0=>$write_col, '__end'=>"\n" );
7575 $write_col = Array();
@@ -77,7 +77,7 @@
7878 $this->currCol = $this->perRow;
7979 }
8080 } else {
81 - $write_row[] = $question->view->renderQuestion( $this->ctrl );
 81+ $write_row[] = $question->view->renderQuestion();
8282 }
8383 }
8484 # question object is not needed anymore
Index: trunk/extensions/QPoll/view/qp_pollview.php
@@ -67,7 +67,7 @@
6868 foreach ( $this->ctrl->questions as &$question ) {
6969 $question->view->renderInterpErrors( $this->ctrl->pollStore->interpAnswer );
7070 if ( $this->perRow > 1 ) {
71 - $write_col[] = array( '__tag'=>'td', 'valign'=>'top', 0=>$question->view->renderQuestion( $this->ctrl ), '__end'=>"\n" );
 71+ $write_col[] = array( '__tag'=>'td', 'valign'=>'top', 0=>$question->view->renderQuestion(), '__end'=>"\n" );
7272 if ( $this->currCol == 1 ) {
7373 $write_row[] = array( '__tag'=>'tr', 0=>$write_col, '__end'=>"\n" );
7474 $write_col = Array();
@@ -76,7 +76,7 @@
7777 $this->currCol = $this->perRow;
7878 }
7979 } else {
80 - $write_row[] = $question->view->renderQuestion( $this->ctrl );
 80+ $write_row[] = $question->view->renderQuestion();
8181 }
8282 # question object is not needed anymore
8383 unset( $question );
@@ -143,7 +143,8 @@
144144 $submitBtn[ 'disabled' ] = 'disabled';
145145 }
146146 }
147 - if ( $this->ctrl->pollStore->noMoreAttempts() ) {
 147+ $atLeft = $this->ctrl->attemptsLeft();
 148+ if ( $atLeft === false ) {
148149 $submitBtn[ 'disabled' ] = 'disabled';
149150 }
150151 # disable submit button in preview mode & printable version
@@ -154,8 +155,10 @@
155156 $p = array( '__tag'=>'p' );
156157 $p[] = $submitBtn;
157158 # output no more attempts message, when applicable
158 - if ( $this->ctrl->pollStore->noMoreAttempts() ) {
159 - $p[] = array( '__tag'=>'span', 'class'=>'no_more_attempts', qp_Setup::specialchars( wfMsg( 'qp_error_no_more_attempts' ) ) );
 159+ if ( $atLeft === false ) {
 160+ $p[] = array( '__tag'=>'span', 'class'=>'attempts_counter', qp_Setup::specialchars( wfMsg( 'qp_error_no_more_attempts' ) ) );
 161+ } elseif ( $atLeft !== true ) {
 162+ $p[] = array( '__tag'=>'span', 'class'=>'attempts_counter', qp_Setup::specialchars( wfMsgExt( 'qp_submit_attempts_left', array( 'parsemag' ), intval( $atLeft ) ) ) );
160163 }
161164
162165 $qpoll_form[] = &$p;
Index: trunk/extensions/QPoll/view/qp_questionstatsview.php
@@ -52,19 +52,14 @@
5353 return method_exists( $ctrl, 'statsParseBody' );
5454 }
5555
56 - /**
57 - * Unfortunately, rendering of question also conditionally modifies state of poll
58 - * @param $poll instance of poll controller associated with current question ctrl/view
59 - * @modifies $poll
60 - */
61 - function renderQuestion( qp_AbstractPoll $poll ) {
 56+ function renderQuestion() {
6257 # check whether the current global showresults level allows to display statistics
6358 if ( qp_Setup::$global_showresults == 0 ||
6459 (qp_Setup::$global_showresults <= 1 && !$this->ctrl->alreadyVoted) ) {
6560 # suppress the output
6661 return '';
6762 }
68 - return parent::renderQuestion( $poll );
 63+ return parent::renderQuestion();
6964 }
7065
7166 /*** cell templates ***/
Index: trunk/extensions/QPoll/view/qp_questionview.php
@@ -322,10 +322,10 @@
323323 }
324324 # todo: figure out how to split this part to separate function
325325 # this part is unneeded for question stats controller,
326 - # which should never have $this->ctrl->mBeingCorrected === true
 326+ # which should never have $this->ctrl->poll->mBeingCorrected === true
327327 if ( $spanState->cellsLeft <= 1 ) {
328328 # end of new span
329 - if ( $this->ctrl->mBeingCorrected &&
 329+ if ( $this->ctrl->poll->mBeingCorrected &&
330330 !$spanState->wasChecked &&
331331 $this->ctrl->mRequest->getVal( $name ) != $value ) {
332332 # the span (a part of proposal) was submitted but unanswered
@@ -404,10 +404,9 @@
405405
406406 /**
407407 * todo: unfortunately, rendering the question also conditionally modifies state of poll controller
408 - * @param $poll instance of poll controller associated with current question ctrl/view
409 - * @modifies $poll
 408+ * @modifies parent controller
410409 */
411 - function renderQuestion( qp_AbstractPoll $poll ) {
 410+ function renderQuestion() {
412411 $output_table = array( '__tag'=>'table', '__end'=>"\n", 'class'=>'object' );
413412 # Determine the side border color the question.
414413 if ( $this->ctrl->getState() != '' ) {
@@ -417,7 +416,7 @@
418417 $output_table['class'] = 'error_mark';
419418 }
420419 # set poll controller state according to question controller state
421 - $poll->mState = $this->ctrl->getState();
 420+ $this->ctrl->applyStateToParent();
422421 }
423422 $output_table[] = array( '__tag'=>'tbody', '__end'=>"\n", 0=>$this->renderTable() );
424423 $tags = array( '__tag'=>'div', '__end'=>"\n", 'class'=>'question',
Index: trunk/extensions/QPoll/qp_eval.php
@@ -160,7 +160,7 @@
161161 'desc' => 'Disallow visibility of globals in local scope'
162162 ),
163163 array(
164 - 'code' => 'return isset( $selfCheck );',
 164+ 'code' => 'return $selfCheck == 1;',
165165 'badresult' => true,
166166 'desc' => 'Disallow access to extension\'s locals in the eval scope'
167167 ),
@@ -235,8 +235,12 @@
236236 # there is an error in sample
237237 return 'Sample error:' . $sourceCode['desc'];
238238 }
 239+ # suppres PHP notices because some tests are supposed to generate them
 240+ $old_reporting = error_reporting( E_ALL & ~E_NOTICE );
 241+ $test_result = eval( $destinationCode );
 242+ error_reporting( $old_reporting );
239243 # compare eval() result with "insecure" bad result
240 - if ( eval( $destinationCode ) === $sourceCode['badresult'] ) {
 244+ if ( $test_result === $sourceCode['badresult'] ) {
241245 return $sourceCode['desc'];
242246 }
243247 } else {

Status & tagging log