Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#29527 closed defect (bug) (fixed)

Number of available updates showing as NaN after completing updates

Reported by: circuuz's profile circuuz Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.1 Priority: normal
Severity: normal Version: 4.0
Component: Plugins Keywords: reporter-feedback has-patch
Focuses: administration Cc:

Description

When a single plugin or several plugins is updated the notification of how many updates are available on the "Updates" panel in the admin menu is showing as NaN.
This bug reveals itself both when updating from "update-core.php" and "plugins.php".

See screenshots below:
http://f.cl.ly/items/2h2t1r0r191V453Q013r/Ska%CC%88rmavbild%202014-09-05%20kl.%2009.19.10.png
http://f.cl.ly/items/0M0g3n0N1s3U0Z2v1e0h/Ska%CC%88rmavbild%202014-09-05%20kl.%2009.25.41.png

Attachments (4)

29527_gowp.png (30.5 KB) - added by karpstrucking 11 years ago.
29527.diff (471 bytes) - added by jdgrimes 11 years ago.
Check for NaN
29527_before.png (162.0 KB) - added by RMarks 11 years ago.
Before NaN
29527_after.png (101.6 KB) - added by RMarks 11 years ago.
After NaN

Download all attachments as: .zip

Change History (16)

#1 @karpstrucking
11 years ago

  • Component changed from Menus to Posts, Post Types
  • Keywords reporter-feedback added

I wasn't able to re-create this on a fresh 4.0 installation. In your screenshot, the plugin you are updating appears to be a premium plugin, not one hosted in the WP.org repository - I suspect this may be related. Can you try to re-create using a plugin from WP.org and/or a different premium plugin?

#2 @circuuz
11 years ago

  • Keywords close added
  • Resolution set to invalid
  • Status changed from new to closed

I wasn't actually related to the premium plugin but actually to my custom theme.
Can't blame core for that :)

#3 @karpstrucking
11 years ago

In my office we always blame "Chris" when things go awry (we don't have a "Chris").

#4 @ocean90
11 years ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted

#5 @nacin
11 years ago

Hi circuuz, could you share what your theme was doing, so we have a better idea on how this broke for you?

#6 @SergeyBiryukov
11 years ago

  • Component changed from Posts, Post Types to Plugins
  • Focuses administration added

#7 @jdgrimes
11 years ago

  • Keywords reporter-feedback added
  • Resolution invalid deleted
  • Status changed from closed to reopened

I just accidentally reproduced this on trunk. I wasn't using the default theme, so it is possible that it theme related in this case as well, but I doubt it. It doesn't happen every time — just once so far.

I'd like to second nacin's query: circuuz, could you share more info on what was causing this?

@jdgrimes
11 years ago

Check for NaN

#8 @jdgrimes
11 years ago

29527.diff checks if the count is NaN before updating it.

I'm not sure why this happens, but I have a hunch that it is caused by the update count being empty when the page is loaded. That could happen if the updates transients were to get flushed, and the update APIs didn't respond with any updates. In my case, I think that might be happening because I was testing a custom API for retrieving updates for a plugin. I enabled it to get the update, but I disabled it again before running the update.

So, it's possible the only way that a user could cause this is if they are hacking around with stuff. On the other hand it's a rather trivial patch. I'll leave the decision on whether it's needed up to y'all. :-)

#9 @jdgrimes
11 years ago

  • Keywords has-patch added

#10 @SergeyBiryukov
11 years ago

  • Milestone set to 4.1

#11 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from reopened to closed

In 29960:

In wp.updates.decrementCount(), only display the count if it's a valid non-negative integer.

props jdgrimes.
fixes #29527.

@RMarks
11 years ago

Before NaN

@RMarks
11 years ago

After NaN

#12 @RMarks
11 years ago

I see this is closed, but I also saw people asking how this occurred and if this was related to another plugin. I came across this on a production multisite running 4.0. I had 4 updates pending: 3 for themes and 1 for a plugin. I updated the plugin and then used the update now links shown under each of the following themes: TwentyTwelve, TwentyThirteen, and TwentyFourteen. After updated TwentyFourteen, I saw the NaN next to Updates. Screenshots are above.

Note: See TracTickets for help on using tickets.