6.0.0-beta1
7/6/25

[#8079] Avoid notice in _removeBr from Text_Filter/Filter/highlightquotes.php
Summary Avoid notice in _removeBr from Text_Filter/Filter/highlightquotes.php
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester jens (at) peino (dot) de
Created 03/13/2009 (5959 days ago)
Due
Updated 03/13/2009 (5959 days ago)
Assigned 03/13/2009 (5959 days ago)
Resolved 03/13/2009 (5959 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
03/13/2009 07:11:34 PM Michael Slusarz Comment #6
State ⇒ Resolved
Reply to this comment
Instead of:
foreach (array_keys($lines) as $i) {
You could use:
foreach ($lines as $i => $line) {
    if (!preg_match("/^\s*<br\s*\/>\s*$/i", $line)) {
        ...

To eliminate the extra array_keys() call.
No, you can't do that.  Since foreach() works on a copy of the 
original array, the unset() calls would not destroy the data contained 
in the initial array.  Thus the need to iterate through the array keys 
and use them to access the original variable.
03/13/2009 07:04:34 PM jens (at) peino (dot) de Comment #5 Reply to this comment
How about my patch, which removes for() loops entirely?
Looks also fine to me.



Instead of:

foreach (array_keys($lines) as $i) {

You could use:

foreach ($lines as $i => $line) {

    if (!preg_match("/^\s*<br\s*\/>\s*$/i", $line)) {

        ...



To eliminate the extra array_keys() call.

But at the end its the same.

Your new approach is _technically seen_ maybe a little more expensive, 
but it does indeed remove the "unnice" for() loop.



I am fine either.



- Jens


03/13/2009 06:47:19 PM Michael Slusarz Comment #4
State ⇒ Feedback
Reply to this comment
How about my patch, which removes for() loops entirely?
03/13/2009 03:27:29 PM Jan Schneider Deleted Original Message
 
03/13/2009 03:27:16 PM Jan Schneider Assigned to Michael Slusarz
State ⇒ Assigned
 
03/13/2009 03:15:10 PM jens (at) peino (dot) de Comment #2
New Attachment: Text_Filter_Filter_highlightquotes[1].patch Download
Reply to this comment
HMPF, typo in my patch. Added fixed one.
03/13/2009 03:13:43 PM jens (at) peino (dot) de Comment #1
State ⇒ Unconfirmed
New Attachment: Text_Filter_Filter_highlightquotes.patch
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Avoid notice in _removeBr from Text_Filter/Filter/highlightquotes.php
Type ⇒ Bug
Priority ⇒ 1. Low
Reply to this comment
In some circumstances $lines does only contain <br /> and thus a 
notice is thrown from the second loop.

Saved Queries