WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#26671 closed defect (bug) (invalid)

dashboard activity notice: A non well formed numeric value encountered

Reported by: ruud@… Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Administration Keywords:
Focuses: Cc:

Description

Hi all,

I stumbled upon this notice in the new Dashboard Activity panel, but couldn't find any related bug (yet) so posting it here anyway.

Notice: A non well formed numeric value encountered in /htdocs/wp-admin/includes/dashboard.php on line 603

Looking at it, it seems that
$time = get_the_time( 'U' ); shouldn't be used in this case, because $time will be a string instead of an integer.

On the next line:
if ( date( 'Y-m-d', $time ) == $today ) {
$time is used, and should be an numeric, and clearly isn't.

I'm guessing that get_the_time( 'U' ); is used to receive the current Unix epoch.
If that is supposed to be the case, then the patch added will solve this.

Attachments (1)

dashboard.php.patch (506 bytes) - added by ruud@… 7 years ago.
wp_dashboard_recent_posts patch

Download all attachments as: .zip

Change History (11)

@ruud@…
7 years ago

wp_dashboard_recent_posts patch

#1 @ruud@…
7 years ago

  • Cc ruud@… added

#2 @ruud@…
7 years ago

  • Keywords has-patch added

#3 @ruud@…
7 years ago

  • Component changed from General to Administration

#4 @ruud@…
7 years ago

  • Keywords dev-feedback added

#5 @markoheijnen
7 years ago

  • Keywords needs-patch added; has-patch dev-feedback removed

The patch doesn't work since the function is used to retrieve the time of a post and not the current time.
I think it's fine that get_the_time() returns a string. But we maybe could use intval or strtotime

Last edited 7 years ago by markoheijnen (previous) (diff)

#6 @ruud@…
7 years ago

Ah I see, that makes sense indeed.
get_the_time() is supposed to return a string, or was is recently changed as well?

#7 @ruud@…
7 years ago

OK, I found the problem: there is a conflict with the qTranslate plugin (it probably hooks into the get_the_time or get_post_time filters.. disactivating this plugin alleviates the problem.

This bug is no longer!

#8 @ruud@…
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#9 @markoheijnen
7 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted

#10 @ruud@…
7 years ago

note to Marko: dacht al, dit kan niet waar zijn..

Note: See TracTickets for help on using tickets.