Make WordPress Core

Opened 16 years ago

Closed 13 years ago

#16754 closed enhancement (fixed)

PHP5-port - srand()

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

Description

No need to seed the random number generator.

See ​srand() for details.

Related: #16753

Attachments (3)

16754.patch​ (447 bytes ) - added by hakre 16 years ago.
Probably this just was forgotten
18999.diff​ (1.2 KB ) - added by crrobi01 15 years ago.
16754.diff​ (1.3 KB ) - added by duck_ 13 years ago.

Download all attachments as: .zip

Change History (17)

@hakre
16 years ago

Probably this just was forgotten

#1 @nacin
16 years ago

  • Type defect (bug) → enhancement

#2 @crrobi01
15 years ago

  • Version 3.1 → 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
15 years ago

  • Version 3.3 → 3.1

Version field indicates when the enhancement was initially suggested.

#4 @c3mdigital
13 years ago

  • Keywords close added; has-patch removed
  • Resolution → maybelater
  • Status new → closed

#5 @SergeyBiryukov
13 years ago

  • Component General → Formatting
  • Keywords close removed
  • Milestone Awaiting Review

#6 @SergeyBiryukov
13 years ago

  • Milestone → 3.7
  • Resolution maybelater
  • Status closed → reopened

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

#7 @SergeyBiryukov
13 years ago

  • Keywords has-patch added

#8 @dd32
13 years ago

  • Keywords commit added

Agreed, Lets just clean this entire function up.

#9 @dd32
13 years ago

  • Owner set to dd32
  • Resolution → fixed
  • Status reopened → 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
13 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
13 years ago

In 25058:

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

#12 @duck_
13 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
13 years ago

  • Resolution fixed
  • Status closed → 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
13 years ago

  • Resolution → fixed
  • Status reopened → 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.