Skip to content

Commit

Permalink
Fix: GETPOST can not always be used to replace isset.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 20, 2012
1 parent 880276f commit 2ab1a01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/comm/action/fiche.php
Expand Up @@ -483,7 +483,7 @@ function setdatefields()
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent=-1;
if (GETPOST('percentage'))
if (isset($_GET['percentage']) || isset($_POST['percentage']))
{
$percent=GETPOST('percentage');
}
Expand Down

4 comments on commit 2ab1a01

@hregis
Copy link
Contributor

@hregis hregis commented on 2ab1a01 Aug 20, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't uderstand !
GETPOST return 0 if value 0 or empty if empty !
you can use if (GETPOST('percentage') >= 0)

@marcosgdf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But he is talking about isset, not about if it is empty or not

@hregis
Copy link
Contributor

@hregis hregis commented on 2ab1a01 Aug 20, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but GETPOSTt already use an "isset"
more in this context "percentage" return (-1, 0, or >0)
So (GETPOST('percentage') >= 0) is okay

@eldy
Copy link
Member Author

@eldy eldy commented on 2ab1a01 Aug 22, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.