Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Deprecated Functions in PHP5.3


Reply


3 Posts   1754 Views

Avatar
teejay

Community Member, 63 Posts

23 March 2012 at 1:45pm

Hello,
I am just wondering why there are still so may deprecated function used in the latest 2.4 version. We have written a little scanner which looks up some keywords (could be comments as well so its not hundred percent correct but it gives a good overview) to find deprecated function calls. The result is really not so bad as for lots of the functions there is a replacement even in php 5.2. eg split -> explode, ereg -> preg_match (slight change necessary). So here is the list

php 5.3 deprecatinator
+++++++++++++looking for call_user_method++++++++++
+++++++++++++looking for call_user_method_array++++++++++
+++++++++++++looking for define_syslog_variables++++++++++

+++++++++++++looking for ereg++++++++++
./sapphire/forms/CreditCardField.php
./sapphire/email/Email.php
./sapphire/email/Mailer.php
./sapphire/core/HTTP.php
./sapphire/core/i18nTextCollector.php
./sapphire/core/i18n.php
./sapphire/core/SSViewer.php
./sapphire/core/model/fieldtypes/Date.php
./sapphire/core/model/fieldtypes/Varchar.php
./sapphire/core/model/fieldtypes/Datetime.php
./sapphire/integration/Geoip.php
./silverstripe-blog/thirdparty/xmlrpc/xmlrpc.php

+++++++++++++looking for ereg_replace++++++++++
./sapphire/dev/SapphireTestReporter.php
./sapphire/forms/CheckboxSetField.php
./sapphire/forms/FormField.php
./sapphire/forms/FieldGroup.php
./sapphire/forms/OptionsetField.php
./sapphire/email/Mailer.php
./sapphire/search/AdvancedSearchForm.php
./sapphire/security/PermissionCheckboxSetField.php
./sapphire/widgets/Widget.php
./sapphire/core/control/ContentNegotiator.php
./sapphire/core/control/Director.php
./sapphire/core/ManifestBuilder.php
./sapphire/core/i18nTextCollector.php
./sapphire/core/Convert.php
./sapphire/core/SSViewer.php
./sapphire/core/model/Image.php
./sapphire/core/model/SiteTree.php
./sapphire/core/model/Database.php
./sapphire/integration/XML.php
./sapphire/filesystem/Folder.php
./sapphire/filesystem/Upload.php
./sapphire/filesystem/File.php
./cms/code/SideReport.php
./cms/code/CMSSiteTreeFilter.php
./cms/code/LeftAndMain.php
./cms/code/sitefeatures/PageCommentInterface.php
./cms/code/staticpublisher/FilesystemPublisher.php
./cms/code/AssetAdmin.php

+++++++++++++looking for eregi++++++++++

+++++++++++++looking for eregi_replace++++++++++
./sapphire/core/control/ContentNegotiator.php
./sapphire/core/Convert.php
./sapphire/core/model/Database.php

+++++++++++++looking for set_magic_quotes_runtime++++++++++
./sapphire/thirdparty/Zend/Cache/Backend/File.php

+++++++++++++looking for session_register++++++++++
+++++++++++++looking for session_unregister++++++++++
+++++++++++++looking for session_is_registered++++++++++
+++++++++++++looking for set_socket_blocking++++++++++

+++++++++++++looking for split++++++++++
./recaptcha/code/RecaptchaField.php
./sapphire/forms/DatetimeField.php
./sapphire/forms/CreditCardField.php
./sapphire/forms/PhoneNumberField.php
./sapphire/tasks/MigrateTranslatableTask.php
./sapphire/thirdparty/simplepie/idn/idna_convert.class.php
./sapphire/thirdparty/tinymce/plugins/spellchecker/rpc.php
./sapphire/thirdparty/json/JSON.php
./sapphire/thirdparty/Zend/Cache/Frontend/Page.php
./sapphire/thirdparty/Zend/Locale/Format.php
./sapphire/thirdparty/Zend/Locale/Math.php
./sapphire/thirdparty/simpletest/http.php
./sapphire/thirdparty/simpletest/url.php
./sapphire/parsers/HTML/HTMLBBCodeParser.php
./sapphire/core/i18nTextCollector.php
./sapphire/core/SSViewer.php
./sapphire/core/model/fieldtypes/HTMLText.php
./sapphire/core/model/Translatable.php
./sapphire/filesystem/File.php
./sapphire/tests/fieldtypes/TextTest.php
./cms/code/CMSBatchActionHandler.php
./cms/code/LeftAndMain.php
./cms/code/AssetAdmin.php
./cms/code/Diff.php
./cms/code/CMSMain.php
./cms/code/ModelAdmin.php
./silverstripe-blog/code/widgets/TagCloudWidget.php
./silverstripe-blog/code/BlogEntry.php
./silverstripe-blog/thirdparty/xmlrpc/xmlrpcs.php
./silverstripe-blog/thirdparty/xmlrpc/xmlrpc.php

+++++++++++++looking for spliti++++++++++
+++++++++++++looking for sql_regcase++++++++++
+++++++++++++looking for mysql_db_query++++++++++
+++++++++++++looking for mysql_escape_string++++++++++

I know they will spit out only notices but come one we are reaching already php 5.4 and silverstripe didn't even sort out php 5.3.

Avatar
Sean

Forum Moderator, 922 Posts

29 May 2012 at 12:02pm

Edited: 29/05/2012 12:09pm

SS 2.4 uses ereg and such deprecated functions. When it came out, PHP 5.3 was only in it's first few versions and 5.2 was still a common PHP version, so deprecated functions weren't replaced.

SS 3.0 has been patched to work the highest level of error reporting turned on. E_ALL and E_STRICT which includes also E_DEPRECATED.
If someone uses a deprecated function in SS 3.0, an E_DEPRECATED error is reported.

Thanks,
Sean

Avatar
Andre

Community Member, 126 Posts

17 June 2014 at 9:07pm

Hi,

I know it's kind of an old Thread, but isn't there a way, to path these funtions with the next security update?

SS2.4 is allready old and new Projects should be started with 3.1.x anyway, but I'm pretty sure, there are lots of ss2.4 projects outthere the should be able to run some more years.