Deprecate php4 style constructors
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors. The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD). This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used. In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..." Upstream: https://wiki.php.net/rfc/remove_php4_constructors Props jdgrimes, netweb, jorbin See #31982 Built from https://develop.svn.wordpress.org/trunk@32990 git-svn-id: http://core.svn.wordpress.org/trunk@32961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -49,7 +49,10 @@ class IXR_Value {
|
||||
var $data;
|
||||
var $type;
|
||||
|
||||
function IXR_Value($data, $type = false)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $data, $type = false )
|
||||
{
|
||||
$this->data = $data;
|
||||
if (!$type) {
|
||||
@@ -69,6 +72,13 @@ class IXR_Value {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Value( $data, $type = false ) {
|
||||
self::__construct( $data, $type );
|
||||
}
|
||||
|
||||
function calculateType()
|
||||
{
|
||||
if ($this->data === true || $this->data === false) {
|
||||
@@ -194,11 +204,21 @@ class IXR_Message
|
||||
// The XML parser
|
||||
var $_parser;
|
||||
|
||||
function IXR_Message($message)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $message )
|
||||
{
|
||||
$this->message =& $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Message( $message ) {
|
||||
self::__construct( $message );
|
||||
}
|
||||
|
||||
function parse()
|
||||
{
|
||||
// first remove the XML declaration
|
||||
@@ -386,7 +406,10 @@ class IXR_Server
|
||||
var $message;
|
||||
var $capabilities;
|
||||
|
||||
function IXR_Server($callbacks = false, $data = false, $wait = false)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $callbacks = false, $data = false, $wait = false )
|
||||
{
|
||||
$this->setCapabilities();
|
||||
if ($callbacks) {
|
||||
@@ -398,6 +421,13 @@ class IXR_Server
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Server( $callbacks = false, $data = false, $wait = false ) {
|
||||
self::__construct( $callbacks, $data, $wait );
|
||||
}
|
||||
|
||||
function serve($data = false)
|
||||
{
|
||||
if (!$data) {
|
||||
@@ -600,7 +630,10 @@ class IXR_Request
|
||||
var $args;
|
||||
var $xml;
|
||||
|
||||
function IXR_Request($method, $args)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct($method, $args)
|
||||
{
|
||||
$this->method = $method;
|
||||
$this->args = $args;
|
||||
@@ -620,6 +653,13 @@ EOD;
|
||||
$this->xml .= '</params></methodCall>';
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Request( $method, $args ) {
|
||||
self::__construct( $method, $args );
|
||||
}
|
||||
|
||||
function getLength()
|
||||
{
|
||||
return strlen($this->xml);
|
||||
@@ -653,7 +693,10 @@ class IXR_Client
|
||||
// Storage place for an error message
|
||||
var $error = false;
|
||||
|
||||
function IXR_Client($server, $path = false, $port = 80, $timeout = 15)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $server, $path = false, $port = 80, $timeout = 15 )
|
||||
{
|
||||
if (!$path) {
|
||||
// Assume we have been given a URL instead
|
||||
@@ -679,6 +722,13 @@ class IXR_Client
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Client( $server, $path = false, $port = 80, $timeout = 15 ) {
|
||||
self::__construct( $server, $path, $port, $timeout );
|
||||
}
|
||||
|
||||
function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
@@ -798,12 +848,22 @@ class IXR_Error
|
||||
var $code;
|
||||
var $message;
|
||||
|
||||
function IXR_Error($code, $message)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $code, $message )
|
||||
{
|
||||
$this->code = $code;
|
||||
$this->message = htmlspecialchars($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Error( $code, $message ) {
|
||||
self::__construct( $code, $message );
|
||||
}
|
||||
|
||||
function getXml()
|
||||
{
|
||||
$xml = <<<EOD
|
||||
@@ -844,7 +904,10 @@ class IXR_Date {
|
||||
var $second;
|
||||
var $timezone;
|
||||
|
||||
function IXR_Date($time)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $time )
|
||||
{
|
||||
// $time can be a PHP timestamp or an ISO one
|
||||
if (is_numeric($time)) {
|
||||
@@ -854,6 +917,13 @@ class IXR_Date {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Date( $time ) {
|
||||
self::__construct( $time );
|
||||
}
|
||||
|
||||
function parseTimestamp($timestamp)
|
||||
{
|
||||
$this->year = date('Y', $timestamp);
|
||||
@@ -902,11 +972,21 @@ class IXR_Base64
|
||||
{
|
||||
var $data;
|
||||
|
||||
function IXR_Base64($data)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $data )
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_Base64( $data ) {
|
||||
self::__construct( $data );
|
||||
}
|
||||
|
||||
function getXml()
|
||||
{
|
||||
return '<base64>'.base64_encode($this->data).'</base64>';
|
||||
@@ -924,7 +1004,10 @@ class IXR_IntrospectionServer extends IXR_Server
|
||||
var $signatures;
|
||||
var $help;
|
||||
|
||||
function IXR_IntrospectionServer()
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->setCallbacks();
|
||||
$this->setCapabilities();
|
||||
@@ -958,6 +1041,13 @@ class IXR_IntrospectionServer extends IXR_Server
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_IntrospectionServer() {
|
||||
self::__construct();
|
||||
}
|
||||
|
||||
function addCallback($method, $callback, $args, $help)
|
||||
{
|
||||
$this->callbacks[$method] = $callback;
|
||||
@@ -1086,12 +1176,22 @@ class IXR_ClientMulticall extends IXR_Client
|
||||
{
|
||||
var $calls = array();
|
||||
|
||||
function IXR_ClientMulticall($server, $path = false, $port = 80)
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $server, $path = false, $port = 80 )
|
||||
{
|
||||
parent::IXR_Client($server, $path, $port);
|
||||
$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP4 constructor.
|
||||
*/
|
||||
public function IXR_ClientMulticall( $server, $path = false, $port = 80 ) {
|
||||
self::__construct( $server, $path, $port );
|
||||
}
|
||||
|
||||
function addCall()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
Reference in New Issue
Block a user