[buddypress-trac] [BuddyPress Trac] #7590: Sometimes getting Notice: Uninitialized string offset: -1 while inserting activity
buddypress-trac
noreply at wordpress.org
Wed Nov 29 15:23:00 UTC 2017
#7590: Sometimes getting Notice: Uninitialized string offset: -1 while inserting
activity
-------------------------------------------------------+------------------
Reporter: bhargavbhandari90 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Activity | Version:
Severity: normal | Resolution:
Keywords: needs-testing has-patch reporter-feedback |
-------------------------------------------------------+------------------
Comment (by DJPaul):
I would dearly like to understand where the logic in this is breaking, but
it's beaten me so far. The issue is that `$preceding_tag['start']`
sometimes equals zero, and `$truncate[-1]` is unset.
A similar patch I have done is
https://gist.github.com/0d4ecd6d8d7b7c1f981ee9834c2352a6
The smallest reproducible example that triggers this behaviour (I am
testing via `wp shell`) is:
{{{
<b><a>1234567890123456789012345678901234567890123456</a></b><b><a>1234567890123456789012345678901234567890123456</a></b><b><a>1234567890123456789012345678901234567890123456</a></b><b><a>1234567890123456789012345678901234567890123456</a></b><b><a>1234567890123456789012345678901234567890123456</a></b>
}}}
The length of the strings isn't random, and the HTML tags are required
(though they can be any actual tag). I suspect it's something to do with
the multibyte string replacement code/regex, but I can't prove it.
If no-one figures this out properly by early January -- and by that, a
description with a unit test -- I'll put one of these patches in for 3.0,
but obviously a test makes it more likely we don't break it in the same
way in the future.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7590#comment:11>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list