Make WordPress Core

Opened 11 years ago

Closed 8 years ago

#16754 closed enhancement (fixed)

PHP5-port - srand()

Reported by: hakre Owned by: dd32
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.1
Component: Formatting Keywords: has-patch commit
Focuses: Cc:


No need to seed the random number generator.

See srand() for details.

Related: #16753

Attachments (3)

16754.patch (447 bytes) - added by hakre 11 years ago.
Probably this just was forgotten
18999.diff (1.2 KB) - added by crrobi01 10 years ago.
16754.diff (1.3 KB) - added by duck_ 8 years ago.

Download all attachments as: .zip

Change History (17)

11 years ago

Probably this just was forgotten

#1 @nacin
11 years ago

  • Type changed from defect (bug) to enhancement

10 years ago

#2 @crrobi01
10 years ago

  • Version changed from 3.1 to 3.3
  • Removed srand()
  • There's no reason to do floor(rand()) when rand() always returns an integer.
  • Renamed $emailNOSPAMaddy to $email_no_spam_addy to match Coding Standards
  • Replaced "$i = $i + 1" with "$i++" which is more common in WordPress

#3 @SergeyBiryukov
10 years ago

  • Version changed from 3.3 to 3.1

Version field indicates when the enhancement was initially suggested.

#4 @c3mdigital
8 years ago

  • Keywords close added; has-patch removed
  • Resolution set to maybelater
  • Status changed from new to closed

#5 @SergeyBiryukov
8 years ago

  • Component changed from General to Formatting
  • Keywords close removed
  • Milestone Awaiting Review deleted

#6 @SergeyBiryukov
8 years ago

  • Milestone set to 3.7
  • Resolution maybelater deleted
  • Status changed from closed to reopened

Actually, removing srand() and floor() seems valid here. It's removing obsolete and redundant code, not just a readability enhancement.

#7 @SergeyBiryukov
8 years ago

  • Keywords has-patch added

#8 @dd32
8 years ago

  • Keywords commit added

Agreed, Lets just clean this entire function up.

#9 @dd32
8 years ago

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

In 25055:

Remove some PHP4-ness from the antispambot() function, and update it to match some modern coding standards. Props hakre and crrobi01 for initial patches. Fixes #16754

#10 @buffler
8 years ago

It's not going to affect the functionality but it does look like there's a typo in the docblock - line 1487 reads @param int $extra_entrpoy rather than @param int $extra_entropy

#11 @dd32
8 years ago

In 25058:

Correct a typo in a docblock in [25055]. Props buffler. See #16754

8 years ago

#12 @duck_
8 years ago

I'd argue that $extra_entropy is a misleading name for the variable. 16754.diff switches to $hex_encoding and uses array style character access instead of substr().

#13 @dd32
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I agree that it's not exactly a great name, and am fine with it being changed (anything was better than $mailto)

At first, $hex_encoding doesn't feel right, because it just randomly hex's characters, it doesn't turn it on for the entire link, but at the same time, it does what it says on the box, enables some hex encoding.

#14 @dd32
8 years ago

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

In 25146:

Use a better variable name in antispambot() introduced with [25055]. Props duck_ Fixes #16754

Note: See TracTickets for help on using tickets.