Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Trivial patch: remove some warnings


Go to End


3 Posts   1971 Views

Avatar
Will

Google Summer of Code Hacker, 7 Posts

24 April 2007 at 10:09am

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

Avatar
Tim

Community Member, 201 Posts

2 May 2007 at 6:49pm

Thanks for this Will

Avatar
Andante

Community Member, 231 Posts

9 May 2007 at 2:59pm

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. :)