[SOLVED] Fatal Error: posting.php on line 554

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
chodviolin
Registered User
Posts: 1
Joined: Tue Jul 26, 2005 5:43 pm

[SOLVED] Fatal Error: posting.php on line 554

Post by chodviolin »

Originally posted at http://www.benchodroff.com/blog/index.p ... n_line_554
Keep getting this error in phpBB 2.0.17 with PHP 5.1.0_beta-r2

Fatal error: Only variables can be passed by reference in posting.php on line 554

Here is how I fixed it:
Edit includes/functions_search.php
Starting on line 112:

Code: Select all

       $search_raw_words = array();
        $tempA= clean_words('post', $post_text, $stopword_array, $synonym_array);
        $search_raw_words['text'] = split_words($tempA);
        $tempB= clean_words('post', $post_title, $stopword_array, $synonym_array);
        $search_raw_words['title'] = split_words($tempB);

        @set_time_limit(0);
And in posting.php, starting on line 552

Code: Select all

                      $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
                                $temp1=str_replace("\'", "''", $username);
                                $temp2= str_replace("\'", "''", $subject);
                                $temp3=str_replace("\'", "''", $message);
                                $temp4= str_replace("\'", "''", $poll_title);
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, $temp1, $temp2, $temp3, $temp4, $poll_options, $poll_length);
This error is because of PHP 5.1.0_beta-r2 does not allow function return values to be passed be reference. Actually, PHP was never supposed to allow this...but it kind of slipped through the cracks(?).

All I did was create temporary variables to hold the return values before passing them into a function that passes them by reference.

--Benjamin Chodroff
robinek
Registered User
Posts: 6
Joined: Fri Jun 10, 2005 2:25 pm
Contact:

Post by robinek »

Thx, you da man. It really works and helps me a lot.
lukelast
Registered User
Posts: 6
Joined: Sun Feb 27, 2005 1:19 am

Post by lukelast »

There's also another patch needed to use Search.

In search.php line 260.

Code: Select all

$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words($temp1=clean_words('search', $temp2=stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);	
Notice how I added "$temp1=" and "$temp2=".

It would be nice if the PHP 5.1 problems were fixed in the next PHPBB2 patch.
User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29295
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Post by Marshalrusty »

PHP5 is not supported and more than these edits would have to be made. It will be supported in the next major release.
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs
lukelast
Registered User
Posts: 6
Joined: Sun Feb 27, 2005 1:19 am

Post by lukelast »

Well then I can't wait for PHPBB2.2/3.0 to be finished. It really has some nice new features.
Harrowed
Registered User
Posts: 1
Joined: Sun Sep 04, 2005 10:35 am
Location: Adelaide, Australia.
Contact:

Post by Harrowed »

Didn't like lukelast's solution.. The following is much nicer ^_^

search.php :: line 260

Code: Select all

$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);
became ::

Code: Select all

if (!strstr($multibyte_charset, $lang['ENCODING']))
{
	$temp1 = stripslashes($search_keywords);
	$temp2 = clean_words('search', $temp1, $stopword_array, $synonym_array); $split_search = split_words($temp2, 'search');
}
else
	$split_search = split(' ', $search_keywords);
Traeonna
Registered User
Posts: 2
Joined: Sun Apr 17, 2005 2:53 am

Re: [SOLVED] Fatal Error: posting.php on line 554

Post by Traeonna »

For those who didn't understand what was going on above...here it is spelled out. I used the second fix (search.php) because the first (includes/functions_search.php) gave me an error. Thanks to everyone who figured out the fixes and posted them!!!

OPEN posting.php
FIND

Code: Select all

				$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;

				submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);

REPLACE WITH

Code: Select all

$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; 
                                $temp1=str_replace("\'", "''", $username); 
                                $temp2= str_replace("\'", "''", $subject); 
                                $temp3=str_replace("\'", "''", $message); 
                                $temp4= str_replace("\'", "''", $poll_title); 
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, $temp1, $temp2, $temp3, $temp4, $poll_options, $poll_length);
OPEN search.php
FIND

Code: Select all

			$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);	
REPLACE WITH

Code: Select all

if (!strstr($multibyte_charset, $lang['ENCODING'])) 
{ 
   $temp1 = stripslashes($search_keywords); 
   $temp2 = clean_words('search', $temp1, $stopword_array, $synonym_array); $split_search = split_words($temp2, 'search'); 
} 
else 
   $split_search = split(' ', $search_keywords);
roksopp
Registered User
Posts: 4
Joined: Thu Sep 22, 2005 7:52 am

Re: [SOLVED] Fatal Error: posting.php on line 554

Post by roksopp »

chodviolin wrote: Originally posted at http://www.benchodroff.com/blog/index.p ... n_line_554
Keep getting this error in phpBB 2.0.17 with PHP 5.1.0_beta-r2

Fatal error: Only variables can be passed by reference in posting.php on line 554

Here is how I fixed it:
Edit includes/functions_search.php
Starting on line 112:

Code: Select all

 

And in posting.php, starting on line 552
[code]
                     

--Benjamin Chodroff
[/quote] 


It doesn't seem to work on my side after I used the way above.
Instead, I have the error as follows:


Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Program Files\Apache Group\Apache2\htdocs\phpBB2\posting.php on line 2

Parse error: parse error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\phpBB2\posting.php on line 2

Is anyone can be nice to tell me how to deal with it.
Thanks to anwer my question, and any advice is appreciated.
roksopp
Registered User
Posts: 4
Joined: Thu Sep 22, 2005 7:52 am

Post by roksopp »

by the way.
The envionment of my computer is : win server2003 + apache2 + php5+phpbb2.0.17.

Thanks in advance
MajfA^
Registered User
Posts: 2
Joined: Fri Sep 23, 2005 2:12 pm

Post by MajfA^ »

i did

Code: Select all

OPEN posting.php 
FIND 
Code: 

            $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; 

            submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length); 

 

REPLACE WITH 
Code: 
$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; 
                                $temp1=str_replace("\'", "''", $username); 
                                $temp2= str_replace("\'", "''", $subject); 
                                $temp3=str_replace("\'", "''", $message); 
                                $temp4= str_replace("\'", "''", $poll_title); 
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, $temp1, $temp2, $temp3, $temp4, $poll_options, $poll_length); 


OPEN search.php 
FIND 
Code: 

         $split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);    
 

REPLACE WITH 
Code: 
if (!strstr($multibyte_charset, $lang['ENCODING'])) 
{ 
   $temp1 = stripslashes($search_keywords); 
   $temp2 = clean_words('search', $temp1, $stopword_array, $synonym_array); $split_search = split_words($temp2, 'search'); 
} 
else 
   $split_search = split(' ', $search_keywords); 
 
and i have

Code: Select all

Parse error: parse error, unexpected ';' in /mnt/storage/users/m/a/j/majfa/phpBB2/posting.php on line 552
sempai
Registered User
Posts: 58
Joined: Tue May 20, 2003 3:15 am
Contact:

Post by sempai »

I'm also having the same problem MajfA^ had mentioned, kinda surprised when our hosts changed the PHP version. Need some help, my members wanted to post on my forum. :cry:
Dual! Parallel Trouble Adventure Fan Site
http://dualfans.host.sk
User avatar
Lumpy Burgertushie
Registered User
Posts: 68120
Joined: Mon May 02, 2005 3:11 am
Contact:

Post by Lumpy Burgertushie »

and that is all why php5 is not supported. whether it works or not depends on too many variables. some server setups will work, some will work for a while and then quit, some will work partly, some won't work at all.

therefore, you are on your own if you use php5.

luck,
robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
MajfA^
Registered User
Posts: 2
Joined: Fri Sep 23, 2005 2:12 pm

Post by MajfA^ »

I understand... my forum use php5 and i have phpBB 2.0.17 on server www.host.sk How and where can i downgrade to php4?(sorry for question it's my first forum)
sempai
Registered User
Posts: 58
Joined: Tue May 20, 2003 3:15 am
Contact:

Post by sempai »

MajfA^, our hosts are the same too. :cry: and there's nothing we can do about it until PhpBB team released the next version very soon.

To the support team, help us of what we can do. :cry:
Dual! Parallel Trouble Adventure Fan Site
http://dualfans.host.sk
JadeFist
Registered User
Posts: 25
Joined: Fri Apr 05, 2002 12:25 am
Location: AR, USA
Contact:

Post by JadeFist »

My webhost did the migration regardless of any known issues with forum scripts. I did follow the steps found here:

http://www.phpbb.com/phpBB/viewtopic.php?p=1762738

and they worked for me so far.
All The Best,
Admin JadeFist
FTTGuild.com
Legends Of Old
Locked

Return to “2.0.x Support Forum”