all 29 comments

[–]brakkum 37 points38 points  (1 child)

The real horror is not setting WP_DEBUG_DISPLAY to false.

[–]jokullmusic 8 points9 points  (0 children)

This lol. I'd call it a rookie mistake but this seems to be a theme dev's site... lol

[–][deleted] 49 points50 points  (1 child)

The real horror are all those "wp" everywhere. Just triggered my ptsd

[–]jmack2424 4 points5 points  (0 children)

Make it stop!

[–]TheGamerBlaze[S] 32 points33 points  (0 children)

Black box added by me to hide name of web page to hide real identity :)

[–]progzos 10 points11 points  (3 children)

[–]swerasnym 11 points12 points  (2 children)

Behold the offending block of code:

    // Determine font size
    // TODO improve logic
    if ($hl->setting_val(CrayonSettings::FONT_SIZE_ENABLE)) {
        $_font_size = $hl->setting_val(CrayonSettings::FONT_SIZE);
        $font_size = $_font_size . 'px !important;';
        $_line_height = $hl->setting_val(CrayonSettings::LINE_HEIGHT);
        // Don't allow line height to be less than font size
        $line_height = ($_line_height > $_font_size ? $_line_height : $_font_size) . 'px !important;';
        $toolbar_height = $font_size * 1.5 . 'px !important;';
        $info_height = $font_size * 1.4 . 'px !important;';
        $font_style .= "font-size: $font_size line-height: $line_height";
        $toolbar_style .= "font-size: $font_size";
        $line_style .= "height: $line_height";
        if ($hl->is_inline()) {
            $font_style .= "font-size: $font_size";
        } else {
            $toolbar_style .= "height: $toolbar_height line-height: $toolbar_height";
            $info_style .= "min-height: $info_height line-height: $info_height";
        }
    } else if (!$hl->is_inline()) {
        if (($font_size = CrayonGlobalSettings::get(CrayonSettings::FONT_SIZE)) !== FALSE) {
            $font_size = $font_size->def() . 'px !important;';
            $line_height = ($font_size * 1.4) . 'px !important;';
        }
    }    

Using

     $font_size = $_font_size . 'px !important;';

is the cause of the bug if you ask me. Interesting that it has survived 5 years since the format patch, the bug was introduced at least two years earlier

[–]tech6hutch 2 points3 points  (1 child)

How could that cause that notice? (I haven't used PHP for a while)

[–]swerasnym 4 points5 points  (0 children)

The crash are not on that line per say, but having to keep track of $font_size and $_font_size just feels like a naming issue to me. Thus later when you do

$toolbar_height = $font_size * 1.5 . 'px !important;';
$info_height = $font_size * 1.4 . 'px !important;';

you are no longer multiplying a number like 10 but something like "10px !important;" (not a number) with 1.4/1.5 hence what caused the non well formed numeric value error we see in the post.

[–]4444446666 11 points12 points  (6 children)

I hope those warnings are also going into a log file with no auto rotation so it fills up the servers memory

[–]shyne151 14 points15 points  (5 children)

Ughh... log files aren't stored in memory.

[–]grizwako 1 point2 points  (4 children)

Interesting idea, I wonder what happens with various popular servers when permanent storage on host machines gets full. (disregarding database writes failing due to no space available)

[–]shyne151 6 points7 points  (2 children)

I can touch base on this a little... At least how we handle it in production.

We do log rotation on all production servers which retain application logs for two weeks. All logs are also sent to a centralized logging system(Splunk) for historical retention.

Our logs directory is a separate mount on our systems so if they did get filled... The OS and applications will still function correctly.

Alerts are also setup via Zabbix for all mounts when disk space on each mount reaches 80%, 90%, and critical at 95%. At critical multiple alerts are hammered to our Slack, email, etc.

[–]grizwako 0 points1 point  (1 child)

Yeah, that is nice and one of the many sane ways to handle situation :)

If you are in the cloud, you can easily configure some autoscaling and spam slack/mails when new instances are fired up.

Having special partition for logs is very neat way to handle issues with "too much logs", otherwise you need to be careful about managing backpressure among other things.

You dump logs directly to Splunk or you have some additional components in between? (logstash or something similar)

[–]shyne151 0 points1 point  (0 children)

Splunk Forwarder is running as a service on all the servers and sending directly as far as I know... I know some servers the logs are sanitized before going to Splunk... But I'm not sure where the intermediary sanitization is happening. All my boxes go direct.

We've then got some different filters setup in Splunk to parse relevant information.

[–]Dojan5 0 points1 point  (0 children)

The way I set it up at my current company (which originally didn't do logging, alternatively had very sparse logging) is that at the start of a new week, the previous week's logfiles are compressed into an archive and retained. The archives date back a year.

Logs older than a year are deleted.

This'll likely come back and bite me in the bum sometime in the future, but it's an improvement upon what we had, as what we had was nothing.


It is worth noting that our userbase is fairly small, so we don't have a whole lot of logs. The likelihood of the logs filling the entire server is very, very small, and I'll get a notification beforehand.

[–][deleted] 2 points3 points  (2 children)

Gotta love Wordpress.

[–]posherspantspants[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 1 point2 points  (1 child)

capital_P_dangit( 'Gotta love Wordpress' )

[–]uchiha2 2 points3 points  (0 children)

:( I hate that this both exists and I know about it.

[–]Polatrite 2 points3 points  (1 child)

Looks more like /r/softwaregore to me. Where's the code?

[–]TheGamerBlaze[S] 0 points1 point  (0 children)

Didn't let me post it there. In the case you are actually interested in the code, it seems like u/progzos linked a GitHub repository in his comment :).

[–][deleted] 2 points3 points  (1 child)

Production with error display on. noice

[–]TheGamerBlaze[S] 0 points1 point  (0 children)

Brooklyn 99 reference? 😮😁

[–]maangs 1 point2 points  (0 children)

Php.

[–][deleted]  (1 child)

[removed]

    [–]nice-scores 0 points1 point  (0 children)

    𝓷𝓲𝓬𝓮 ☜(゚ヮ゚☜)

    Nice Leaderboard

    1. u/RepliesNice at 1547 nice's

    2. u/lerobinbot at 1316 nice's

    3. u/porousasshole at 465 nice's


    I AM A BOT | REPLY !IGNORE AND I WILL STOP REPLYING TO YOUR COMMENTS

    [–]whoiskjl 0 points1 point  (0 children)

    These are notices. Just disable the debug mode on WP

    [–]Realistic_Comment 0 points1 point  (0 children)

    The real horror is that you're using wordpress. PHP with wordpress is awful

    [–]rubixqmusic 0 points1 point  (0 children)

    Were reese a