plugin_api.inc.php on line 1625

Found a bug? Tell us!!
schimanke
Regular
Posts: 161
Joined: Mon Jan 07, 2008 4:38 pm
Location: Hameln, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by schimanke »

When searching for "dickson" for example. Happening with FF 24 too.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

No, sorry! It's all returning well with
http://www.schimanke.com/?serendipity[a ... m]=dickson
Die Suche nach "dickson" ergab 8 Treffer:

I have javascript off...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
schimanke
Regular
Posts: 161
Joined: Mon Jan 07, 2008 4:38 pm
Location: Hameln, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by schimanke »

Me too. Pretty weired. Seems to happen sometimes and not at other times.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

Hm, I don't think it's this, ...
but in source code header part, you have a doubled jquery and print.css part

Code: Select all

    <script type="text/javascript" src="/templates/jquery.js"></script>
    <script type="text/javascript">
    jQuery.noConflict();
    </script>
<link rel="SHORTCUT ICON" href="http://www.schimanke.com/favicon.ico" />
<!-- TradeDoubler site verification 1477536 --> <link rel="stylesheet" type="text/css" href="http://www.schimanke.com/plugin/print.css" media="print" />
<!-- Original Design by Andreas Viklund [http://andreasviklund.com] -->
<!-- Converted to Serendipity by Carl Galloway [http://www.carlgalloway.com] -->

<link rel="stylesheet" type="text/css" href="/templates/andreas08/starbucks.css" />


<!--[if IE]>
<style>#searchform input {margin-top:0px;}</style>
<![endif]-->
    <script type="text/javascript" src="/templates/jquery.js"></script>
    <script type="text/javascript">
    jQuery.noConflict();
    </script>
<link rel="SHORTCUT ICON" href="http://www.schimanke.com/favicon.ico" />
<!-- TradeDoubler site verification 1477536 --> <link rel="stylesheet" type="text/css" href="http://www.schimanke.com/plugin/print.css" media="print" />
some bad mixed <font & p> parts at entries start and page bottom
and also some bad inserted <body bgcolor="#d4d4d4"> in the sidebars serendipity_html_nugget_plugin parts.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

@Garvin and anybody being able to think this through:

Remember we had this issue in this thread when searching:

Code: Select all

llegal string offset 'properties' in /path/to/directory/serendipity/include/plugin_api.inc.php on line 1625
which points to function getFieldReference on line 1625

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && is_array($eventData[0]['properties'])) {
This function gets a reference to an $entry / $eventData array pointer, interacting with Cache-Options.

NOW: I found 2 different occurrences of this "llegal string offset 'properties'" error.

First two, with line 1625 when proceeding searches, only happening sometimes (cache mismatch?):
And second two, with line 1634 in other events, probably a more "stable" error:
(*)

These are different issues, I think.
I tried to deeply inspect what could be the reasons... but these References are really hard to read, when you can not produce the error by yourself. So I can just guess:

The second two "could" be solved by changing the getFieldReference function code for
https://github.com/s9y/Serendipity/blob ... .php#L1634, from

Code: Select all

// It may happen that there is no extended entry to concatenate to. In that case,
// create a dummy extended entry.
if (!isset($eventData[0]['properties']['ep_cache_' . $fieldname])) {
    $eventData[0]['properties']['ep_cache_' . $fieldname] = '';
}

$key = &$eventData[0]['properties']['ep_cache_' . $fieldname];
to

Code: Select all

// It may happen that there is no extended entry to concatenate to. In that case,
// create a dummy extended entry.
if (!isset($eventData[0]['properties']['ep_cache_' . $fieldname])) {
    $eventData[0]['properties']['ep_cache_' . $fieldname] = '';
    $key = $eventData[0]['properties']['ep_cache_' . $fieldname];
} else {
    $key = &$eventData[0]['properties']['ep_cache_' . $fieldname];
}
and the first two

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && is_array($eventData[0]['properties'])) {
"maybe" by adding an isset() ?

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && isset($eventData[0]['properties']) && is_array($eventData[0]['properties'])) {
Though I still would like to solve the real issue, since an "Illegal offset type error" occurs when you attempt to access an array index using an object or an array as the index key, which could be in entryproperties or in the calling plugins..., but I can't really say without any tests.

What do you think?

(*) Btw, is there a difference in behaviour when writing $var =& $this->foo or $var = &$this->foo ? (I ask this, since some other plugins call getFieldReference with the latter, like serendipity_event_entrysplit for example.)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
robert
Regular
Posts: 1062
Joined: Mon May 09, 2005 9:17 pm
Location: Vienna, Austria
Contact:

Re: plugin_api.inc.php on line 1625

Post by robert »

I have this too

Code: Select all

Error redirect:
== SERENDIPITY ERROR ==

Please correct:

Illegal string offset 'properties' in /home/.sites/19/site2/web/blog/include/plugin_api.inc.php on line 1625
when I try to open http://robertlender.info/blog/archives/757-Hilfe
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

Robert. In the moment I tried to reach your site I got a
"The server encountered an internal error or
misconfiguration and was unable to complete your request. Your administrator may not have enabled CGI access for this directory"
Btw, is that a sun server?

After a while everything is ok with that page. As I tried to say above, you encountered one of the first blocks issues with line 1625, which is some sort of bad temporary cache mismatch error, only to happen sometimes. You could try to get rid of it by adding that isset() mentioned above. It would have been nice to know which plugin called, but since this is a temporary error we can not really reproduce it to get some more debug info.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
robert
Regular
Posts: 1062
Joined: Mon May 09, 2005 9:17 pm
Location: Vienna, Austria
Contact:

Re: plugin_api.inc.php on line 1625

Post by robert »

I can ask my provider about the server.

I will try the isset code and do hope the best.

As I could figure it out, the line 1625 error happen since i update from PHP 5.3 to 5.4.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by garvinhicking »

Hi!

$var = &$bla and $var =& $bla is syntactically the same.

I think we should change:

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && is_array($eventData[0]['properties'])) {
to:

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && is_array($eventData[0]) && is_array($eventData[0]['properties'])) {
Regards
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

Garvin, does that really solve that issue with line 1634 too?
For me it looked like the dummy set ep_cache ... couldn't be read as referenced, afterwards in line 1634. https://github.com/s9y/Serendipity/blob ... .php#L1634
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
robert
Regular
Posts: 1062
Joined: Mon May 09, 2005 9:17 pm
Location: Vienna, Austria
Contact:

Re: plugin_api.inc.php on line 1625

Post by robert »

Hi,

the solution from Garvin in 1625 helped with my problem. Thx :)

Regards
Robert
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by lfrantzen »

Hi,

just read a message sent to me by Timbalu via my blog contact form regarding this issue.

Just to be sure I get it right, the error I get is:

Code: Select all

Fatal error: Uncaught exception 'ErrorException' with message 'Serendipity error: Illegal string offset 'properties'' in /homepages/10/d243342463/htdocs/serendipity/include/compat.inc.php:118 Stack trace: #0 /homepages/10/d243342463/htdocs/serendipity/include/plugin_api.inc.php(1634): errorToExceptionHandler(2, 'Illegal string ...', '/homepages/10/d...', 1634, Array) #1 /homepages/10/d243342463/htdocs/serendipity/plugins/serendipity_event_flattr/serendipity_event_flattr.php(411): serendipity_event->getFieldReference('add_footer', Array) #2 /homepages/10/d243342463/htdocs/serendipity/include/plugin_api.inc.php(1073): serendipity_event_flattr->event_hook('frontend_displa...', Object(serendipity_property_bag), Array, Array) #3 /homepages/10/d243342463/htdocs/serendipity/include/functions_comments.inc.php(391): serendipity_plugin_api::hook_event('frontend_displa...', Array, Array) #4 /homepages/10/d243342463/htdocs/serendipity/include/functions_smarty.inc.php(799): serendipity_printComments(Array, 'linear', 0, NULL, 'TRACKBAC in /homepages/10/d243342463/htdocs/serendipity/include/compat.inc.php on line 118
So I change line 1634 then, right, not 1625?

Cheers,
Lars
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by lfrantzen »

Anyhow, I changed line 1634 in my case according to Timbalus suggestion:

Code: Select all

if (is_array($eventData) && isset($eventData[0]) && is_array($eventData[0]) && is_array($eventData[0]['properties'])) {
and now the error seems to be gone :-)

Cheers,
Lars
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: plugin_api.inc.php on line 1625

Post by Timbalu »

No that is line 1625. Line 1634 is linked in one of my previous posts!
But that fix for 1625 seems to work in your case too and I am happy. Cheers!

Don't forget to upgrade your RC3, though!

Edit: Opps - sure the current line 1625 is the same as yours in 1634 in RC3, sorry. Now I know why I had this bad sunday investigating an error in a wrong line...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: plugin_api.inc.php on line 1625

Post by lfrantzen »

Alright, thanks for notifying me of this bug!! I will upgrade, next.

Cheers,
Lars
Post Reply