WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#34558 closed defect (bug) (invalid)

PasswordHash uses PHP 4 style constructor

Reported by: mordauk Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Users Keywords:
Focuses: Cc:
PR Number:

Description

The PasswordHash class has a PHP 4 style constructor which results in deprecated notices being thrown in PHP 7:

/**
 * PHP4 constructor.
 */
public function PasswordHash( $iteration_count_log2, $portable_hashes ) {
	self::__construct( $iteration_count_log2, $portable_hashes );
}
Methods with the same name as their class will not be constructors in a future version of PHP; PasswordHash has a deprecated constructor

In 4.3, PHP4 style constructors were removed for WP_Widget. I'd love to see this get removed from PasswordHash as well, though I'm not entirely sure it being an upstream library means we just wait until they update it or we go ahead and resolve it here and push back upstream.

Change History (4)

#1 @jorbin
4 years ago

  • Keywords reporter-feedback added

In [32990] we modified Password hash to have the __construct method, while keeping the PasswordHash function. This was to ensure there was no breakage. None of our uses of PasswordHash directly call the php4 style constructor (that I can tell). It *should* only be used if someone is subclassing PasswordHash and calling the php4 style constructor.

How were you able to get the deprecation notice? I haven't seen it my running of PHP7.

Last edited 4 years ago by jorbin (previous) (diff)

#2 @mordauk
4 years ago

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

I was seeing it in Travis.ci: https://travis-ci.org/pippinsplugins/restrict-content-pro/jobs/88548967

I just realized it's on only WP < 4.3 so this is invalid. Thanks for the quick look!

#3 @netweb
4 years ago

  • Milestone Awaiting Review deleted

#4 @netweb
4 years ago

  • Keywords reporter-feedback removed
Note: See TracTickets for help on using tickets.