Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Trivial patch: remove some warnings

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1598 Views
  • Will
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Trivial patch: remove some warnings Link to this post

    Hey guys,

    I have php showing all warning on my box, and there are a few that seem to pop up on all of the silverstripe pages. (this is on 2.0.1)

    All of them are from using variables without making sure they exist.

    in sapphire/core/manifestBuilder.php (line 30)
    < || $_GET['buildmanifest'] || $_GET['flush'];
    ---
    > || (isset($_GET['buildmanifest']) && $_GET['buildmanifest'])
    > || (isset($_GET['flush']) && $_GET['flush']);

    in sapphire/core/control/ContentController.php (line 182)
    > $archiveLink = "";

    in sapphire/core/control/ContentNegotiator.php (line 19)
    < } else if($_GET['forceFormat']) {
    ---
    > } else if(isset($_GET['forceFormat']) && $_GET['forceFormat']) {

    same file (line 27)
    < if(!$q[$preference]) $q[$preference] = $format;
    ---
    > if(!isset($q)) $q = array();
    > if(!isset($q[$preference]) || !$q[$preference]) $q[$preference] = $format;

    in sapphire/main.php (line 19)
    < if($_REQUEST['trace']) apd_set_pprof_trace();
    ---
    > if(isset($_REQUEST['trace']) && $_REQUEST['trace']) apd_set_pprof_trace();

    Hope that helps,
    --Will

  • Tim
    Avatar
    Core Development Team
    201 Posts

    Re: Trivial patch: remove some warnings Link to this post

    Thanks for this Will

  • Andy
    Avatar
    230 Posts

    Re: Trivial patch: remove some warnings Link to this post

    Cheers! I went through SilverStripe a few months ago and fixed as many php warnings as I could, but there are still a number that went unnoticed. If you notice anymore, please let me know.

    1598 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.