In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Viewing Issue Simple Details Jump to Notes ] Wiki ]  Related Changesets ] View Advanced ] Issue History ] Print ]
ID Category Type Reproducibility Date Submitted Last Update
0000236 [In-Portal CMS] Optimization task always 2009-08-22 06:09 2010-01-11 22:05
Reporter alex View Status public Project Name In-Portal CMS
Assigned To alex Developer
Priority normal Resolution fixed Fixed in Version 5.0.2
Status closed Product Version 5.0.0 Target Version 5.0.2
Time EstimateNo estimate
Summary 0000236: Don't use preg_replace for removing trailing words in strings
Description Currently in some places we are using mentioned later code to strip trailing word from string:

$pos_sql = preg_replace('/(.*) OR $/', '\\1', $pos_sql)

This is not very efficient and should be replaced with code like this:

$pos_sql = substr($pos_sql, -2); // "-2" is "(-1) * strlen('OR')"
Additional Information
Tags No tags attached.
Reference
Change Log Message
Estimate Points 0
Attached Files patch file icon review preg_replace usage.patch [^] (8,746 bytes) 2009-10-04 11:43 [Show Content]
patch file icon review preg_replace usage (in-link).patch [^] (1,007 bytes) 2009-10-06 02:26 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to 0000273closed (5.0.3)alex Get rid of ereg* functions usage, because they are slow and are deprecated since PHP 5.3 

-  Notes
User avatar (0000530)
alex (manager)
2009-09-23 13:15

Plan:
1. 69 files, that contain preg_replace to analyze
2. when appropriate replace with trim or substr.
User avatar (0000838)
Dmitry (manager)
2009-10-08 12:13

Please describe main places where and how to test this.
User avatar (0000840)
alex (manager)
2009-10-08 14:08

Places are listed in patch, how to test is dependent on place where given file is used. Should I describe each changed line related to it's usage place in admin/front-end?
User avatar (0000855)
Dmitry (manager)
2009-10-08 18:20

Well, yes - I think it's the only way to properly know which parts of the system were effected.

For example, changes in "units/helpers/multilanguage_helper.php" and other places considered very critical and need thorough testing...

Please be so kind and list all places that can be effected by this page so we can test the patch correctly.
User avatar (0000868)
alex (manager)
2009-10-10 08:05

Here they are, but I've really expected that it's obvious by method name and class, that it does. For each method I've described what method does and what of it's work is affected by attached patch.

kDBItem::GetKeyClause - used to create where clause for loading database item
kEmailSendingHelper::SetMultipleEncodedEmailHeader - sets given multiple emails to given header, like To, Cc, Bcc (not in use)
kEmailSendingHelper::AddRecipient - used to add one more recipient to given header, like To, Cc, Bcc (during email composing)
AdminEventsHandler::insert_data - used during backup file creation to remove trailing commas
kCatDBItemExportHelper::storeCache - stores temporary import data during catalog data import (what was imported as what)
kCatDBItemExportHelper::getCustomSQL - used for creating export sql for catalog data export
kCatDBItemExportHelper::getExportSQL - used for creating export sql for catalog data export
kCatDBItemExportHelper::processCurrentItem - used for detecting unique items (insert new or update existing) during catalog data import
kCatDBItemExportHelper::getMaxCategoryLevel - used for category path forming during catalog data export
CategoryHelper::replacePageIds - used for replacing @@ID@@ with page url (preg was used, where it wasn't required)
LanguageImportHelper::performExport - exporting phrases/email events only from chosen modules (on export screen)
kMultiLanguageHelper::deleteField - deletes fields in custom data tables, when actual custom field is deleted
SpamHelper::GetKeyClause - used to create where clause for detecting spam creation attempts (e.g. vote multiple times a day for the same item and so on)
PermissionsTagProcessor::PrintPermissions - used for inheritance icon/checkbox detection
StatisticsEventHandler::SetCustomQuery - module filter for statistics display (not in use)
LinkEventHandler::OnMerge - grouping clause forming for duplicate link merging
User avatar (0000913)
Dmitry (manager)
2009-10-18 02:14

Tested ok.
User avatar (0000931)
alex (manager)
2009-10-20 04:04

Fix committed to 5.0.x branch. Commit Message:

Fixes 0000236: Don't use preg_replace for removing trailing words in strings
User avatar (0001373)
Dmitry (manager)
2010-01-11 22:05

Closing completed tasks.

- Related Changesets
In-Portal CMS: 5.0.x r12706
Timestamp: 2009-10-20 04:04:13
Author: alex
Details ] Diff ]
Fixes 0000236: Don't use preg_replace for removing trailing words in strings
mod - /in-portal/branches/5.0.x/core/kernel/db/dbitem.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/kernel/utility/email_send.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/admin/admin_events_handler.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/helpers/category_helper.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/helpers/language_import_helper.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/helpers/multilanguage_helper.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/helpers/spam_helper.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/permissions/permissions_tag_processor.php Diff ] File ]
mod - /in-portal/branches/5.0.x/core/units/statistics/statistics_event_handler.php Diff ] File ]
Modules :: In-Link: 5.0.x r12705
Timestamp: 2009-10-20 03:56:43
Author: alex
Details ] Diff ]
Bug 0000236: Don't use preg_replace for removing trailing words in strings
mod - /in-link/branches/5.0.x/in-link/units/links/links_event_handler.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-01-11 22:05 Dmitry Note Added: 0001373
2010-01-11 22:05 Dmitry Status resolved => closed
2009-10-20 04:04 alex Changeset attached 5.0.x r12706
2009-10-20 04:04 alex Note Added: 0000931
2009-10-20 04:04 alex Status reviewed and tested => resolved
2009-10-20 04:04 alex Fixed in Version => 5.0.2
2009-10-20 04:04 alex Resolution open => fixed
2009-10-20 03:56 alex Changeset attached 5.0.x r12705
2009-10-18 02:14 Dmitry Note Added: 0000913
2009-10-18 02:14 Dmitry Assigned To Dmitry => alex
2009-10-18 02:14 Dmitry Status needs testing => reviewed and tested
2009-10-10 08:05 alex Note Added: 0000868
2009-10-10 08:05 alex Assigned To alex => Dmitry
2009-10-10 08:05 alex Status needs feedback => needs testing
2009-10-08 18:20 Dmitry Note Added: 0000855
2009-10-08 18:20 Dmitry Status active => needs feedback
2009-10-08 18:19 Dmitry Status needs feedback => active
2009-10-08 18:19 Dmitry Assigned To Dmitry => alex
2009-10-08 14:08 alex Note Added: 0000840
2009-10-08 14:08 alex Assigned To alex => Dmitry
2009-10-08 12:13 Dmitry Note Added: 0000838
2009-10-08 12:13 Dmitry Assigned To !COMMUNITY => alex
2009-10-08 12:13 Dmitry Status needs testing => needs feedback
2009-10-06 14:24 alex Type bug report => task
2009-10-06 02:26 alex File Added: review preg_replace usage (in-link).patch
2009-10-04 11:43 alex Time Estimate Removed 2 =>
2009-10-04 11:43 alex Assigned To alex => !COMMUNITY
2009-10-04 11:43 alex Status active => needs testing
2009-10-04 11:43 alex File Added: review preg_replace usage.patch
2009-10-03 07:52 administrator Status reviewed and tested => active
2009-09-30 06:59 alex Assigned To andrew => alex
2009-09-30 06:58 alex Status active => reviewed and tested
2009-09-30 06:58 alex Assigned To => andrew
2009-09-23 13:15 alex Time Estimate Added 2
2009-09-23 13:15 alex Note Added: 0000530
2009-09-20 15:11 alex Target Version 5.1.0 => 5.0.2
2009-09-14 15:39 alex Relationship added related to 0000273
2009-08-24 00:15 Dmitry Target Version => 5.1.0
2009-08-22 06:09 alex New Issue



Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker