[aur-dev] [PATCH] Rename constructors to __construct
In PHP 7, constructor methods that have the same name as the class they are defined in are deprecated. Use __construct instead. http://php.net/manual/en/migration70.deprecated.php --- web/lib/gettext.php | 2 +- web/lib/streams.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/lib/gettext.php b/web/lib/gettext.php index 4ccd75d..098f0e5 100644 --- a/web/lib/gettext.php +++ b/web/lib/gettext.php @@ -98,7 +98,7 @@ class gettext_reader { * @param object Reader the StreamReader object * @param boolean enable_cache Enable or disable caching of strings (default on) */ - function gettext_reader($Reader, $enable_cache = true) { + function __construct($Reader, $enable_cache = true) { // If there isn't a StreamReader, turn on short circuit mode. if (! $Reader || isset($Reader->error) ) { $this->short_circuit = true; diff --git a/web/lib/streams.php b/web/lib/streams.php index 3cdc158..00cf6cc 100644 --- a/web/lib/streams.php +++ b/web/lib/streams.php @@ -49,7 +49,7 @@ class StringReader { var $_pos; var $_str; - function StringReader($str='') { + function __construct($str='') { $this->_str = $str; $this->_pos = 0; } @@ -86,7 +86,7 @@ class FileReader { var $_fd; var $_length; - function FileReader($filename) { + function __construct($filename) { if (file_exists($filename)) { $this->_length=filesize($filename); @@ -143,7 +143,7 @@ class FileReader { // Preloads entire file in memory first, then creates a StringReader // over it (it assumes knowledge of StringReader internals) class CachedFileReader extends StringReader { - function CachedFileReader($filename) { + function __construct($filename) { if (file_exists($filename)) { $length=filesize($filename); -- 2.7.0
* Marcel Korpel <marcel.korpel@gmail.com> (Sun, 17 Jan 2016 23:14:58 +0100):
In PHP 7, constructor methods that have the same name as the class they are defined in are deprecated. Use __construct instead. http://php.net/manual/en/migration70.deprecated.php
As to the why: I got deprecated warnings, which I couldn't turn off (not using ~E_DEPRECATED). I hope this is the correct (new) syntax and not something else, as I'm not at all fluent in PHP-OO. And sorry, forgot to sign-off. Regards, Marcel
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 That is absolutely right. Regards, STefan On 18.01.2016 00:07, Marcel Korpel wrote:
As to the why: I got deprecated warnings, which I couldn't turn off (not using ~E_DEPRECATED). I hope this is the correct (new) syntax and not something else, as I'm not at all fluent in PHP-OO.
- -- erdfisch Stefan Auditor, Frank Holldorff & Fabian Lorenzen GbR Internet: http://erdfisch.de E-Mail : stefan.auditor@erdfisch.de Telefon : +49 6221 751 560 0 Fax : +49 6221 751 560 99 Hans-Bunte-Str. 6 69123 Heidelberg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWnJo8AAoJEMzTOAbIqhTJBHcIAISgSh6VwgxDGsDMricxPNo2 ht6nuZ0H3y8qZns72YK1uu0cDwdnEAhsyQcbd2sk6qIaAvBQU98bv767gQG/5PRw kLMXYXOfmzEpFu+1ms841w9EGzoXS8D/0ruxvjhC9XO7ElbAP8OOvr1LwAXxDWGh AI3CLijm4fOFV4uHd1rv+grJ1S6V3q+Wu3DAy+7kYubIp2vnzsnmfbNIhZgDAwf/ vOriSctPllhf6IPRY6N99S2fpCf0JDqPhTc47DScvT1v200BcE8i8MXouw1bMsnA CKJtreDE81/dAzjnBk+kqXHfN9jUt4hd80Ncv1wJ1huNwYVd53mSpFHivkXn/hw= =tmzs -----END PGP SIGNATURE-----
On Sun, 17 Jan 2016 at 23:14:58, Marcel Korpel wrote:
In PHP 7, constructor methods that have the same name as the class they are defined in are deprecated. Use __construct instead. http://php.net/manual/en/migration70.deprecated.php --- web/lib/gettext.php | 2 +- web/lib/streams.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/web/lib/gettext.php b/web/lib/gettext.php index 4ccd75d..098f0e5 100644 --- a/web/lib/gettext.php +++ b/web/lib/gettext.php [...] diff --git a/web/lib/streams.php b/web/lib/streams.php index 3cdc158..00cf6cc 100644 --- a/web/lib/streams.php +++ b/web/lib/streams.php [...]
Note that these files originate from php-gettext. The bug is already reported upstream [1], so waiting for an upstream fix and upgrading those files afterwards will resolve the issue. Until then, I am fine with this temporary fix. Thanks! :) [1] https://bugs.launchpad.net/php-gettext/+bug/1522900
participants (3)
-
Lukas Fleischer
-
Marcel Korpel
-
Stefan Auditor