Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 3 years ago

#4016 closed defect (bug) (fixed)

PHP Parse error: syntax error, unexpected T_STRING

Reported by: j.conti Owned by:
Milestone: 1.5.5 Priority: normal
Severity: minor Version: 1.5.3
Component: Core Keywords:
Cc:

Description

There is a problem with BuddyPress 1.5.4

All my BuddyPress has started to create an error_log with this error:

[16-Feb-2012 21:21:21 UTC] PHP Parse error: syntax error, unexpected T_STRING in /home/xxxxxxx/public_html/wp-content/plugins/buddypress/bp-members/bp-members-signup.php(116) : runtime-created function on line 1
[16-Feb-2012 21:21:21 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/xxxxxxx/public_html/wp-includes/plugin.php on line 405

My server has PHP 5.3.10

Change History (11)

#1 @j.conti
8 years ago

More info.

I cannot reproduce the error.

Is a random error. I made a lot of combinations and the error was not on error_log again.

Few hours later, the error appeared again with a new user registration...

Is a very strange error.

#2 @johnjamesjacoby
8 years ago

  • Milestone changed from Awaiting Review to 1.5.5

Some function is missing. Any idea if the same error happens on trunk?

#3 @boonebgorges
8 years ago

  • Keywords reporter-feedback added

I can't reproduce it. I'm guessing that an error is being registered in $bp->signup->errors that isn't structured properly as key-value, so that either $fieldname or $error_message is ending up undefined, and the create_function() command therefore failing because of mauled syntax. If that's right, we can fix this by checking to make sure that $fieldname and $error_message are non-empty before attempting to create the function. But that seems a bit random, if we can't recreate the error to begin with.

j.conti, are you running any plugins or any other modifications to the registration process?

#4 @j.conti
8 years ago

Hi,

We find the issue. The issue is with quotes. If the error message has quotes, it screen the error.

We fixed adding addslashes() to the error message http://plugins.trac.wordpress.org/browser/wangguard/trunk/wangguard-admin.php#L476

#5 @j.conti
8 years ago

  • Keywords reporter-feedback removed

#6 @boonebgorges
8 years ago

  • Severity changed from normal to minor

Good find. The issue is specific to the syntax of create_function() and the way that we're concatenating the content of the function. The good news is that it'll only affect instances where plugins are registering their own messages in $bp->signup->errors, which is probably very few.

I'm going to fix this by adding our own addslashes()/stripslashes(), but it'll break what you've done in WangGuard - the content will be double-slashed. So you'll have to remove your own addslashes(). Hope that's OK! Thanks for your help tracking this down.

#7 @boonebgorges
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5860]) Use addslashes() and stripslashes() when hooking signup error messages to display hooks.
This helps us to avoid syntax errors related to create_function() when the error message contains quotes.
Fixes #4016. Props j.conti

#8 @boonebgorges
8 years ago

(In [5861]) Use addslashes() and stripslashes() when hooking signup error messages to display hooks.
This helps us to avoid syntax errors related to create_function() when the error message contains quotes.
Fixes #4016. Props j.conti

#9 @j.conti
8 years ago

Ok,

Only show that error to bots, this is why at first we did not find the issue.

In a couple of days we release WangGuard 1.4.

Right now I do not know if release WangGuard with or without the fix ...

Do you know when you release BuddyPress 1.5.5?

#10 @boonebgorges
8 years ago

Do you know when you release BuddyPress 1.5.5?

No, I don't know, unfortunately.

If I were you, I would release without the addslashes(). Since the problem only arises for bots, hopefully it won't be a big deal if the error pops up between the release of WangGuard 1.4 and BP 1.5.5 (would probably only be the matter of a week or two).

#11 @DJPaul
3 years ago

  • Component changed from Tools - Warnings/Notices to Core
Note: See TracTickets for help on using tickets.