Outbuffering for integration with Joomla and errors

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
Elementl
Registered User
Posts: 2
Joined: Thu Aug 28, 2008 9:41 pm

Re: Outbuffering for integration with Joomla and errors

Post by Elementl »

I would really like to see this code change go through, or at least have a plugin we could install. This way you wont have to worry about others with this code, obviously this isnt a majority that needs this fix. Marius if you implemented that fix would it work correctly with the output buffer? If so I don't think they would mind if you created a plugin to modify these files to allow the output buffer to work.

However it would be nice to see it just in PHPBB if it does not hurt anything.
mariusvr
Registered User
Posts: 27
Joined: Mon Aug 25, 2008 10:10 am

Re: Outbuffering for integration with Joomla and errors

Post by mariusvr »

actually there is no need to add a default to the switch statement, all that is needed to add a "return" statement in the phpBB3 home directory files:

Code: Select all

if (something)
{
    trigger_error(...);
    //add a return statement for a clean exit
    return;
}
code that must not be executed if something is true
Cheers, Marius
User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Outbuffering for integration with Joomla and errors

Post by Acyd Burn »

The return; is working for you on all points "it is needed"? (Haven't investigated yet where it would be needed)

Image
mariusvr
Registered User
Posts: 27
Joined: Mon Aug 25, 2008 10:10 am

Re: Outbuffering for integration with Joomla and errors

Post by mariusvr »

In the posting.php file there are 20 occurrences of trigger_error(), which need a return statement after it to allow for a clean exit (as the trigger_error statement would normally call exit as part of the exit hook) . We are now identifying the other types of calls that normally result in phpBB3 exiting, such as the statements that render output.

It is needed because I need to have the exit statement commented out at the bottom of the includes/functions.php file (this crashes Joomla when integrating with phpBB3). When I remove the exit statement, PHP returns to the file in the phpBB3 that was called by the user and will continue to execute code while it was supposed to have died already. Adding a return, will allow for the commenting out if the exit statement, while still stopping the phpBB3 at the correct point.

We are using the posting.php as a proof of principle at the moment and I believe that it should work just fine. When a new phpBB3 version is released however, would it require us to make these modifications all over again?

Thanks, Marius
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: Outbuffering for integration with Joomla and errors

Post by naderman »

I think your simply using the wrong approach to integration. Anyway, if it's not too much of a change I guess we can consider doing it. But I would have thought that there are many more such places.
mariusvr
Registered User
Posts: 27
Joined: Mon Aug 25, 2008 10:10 am

Re: Outbuffering for integration with Joomla and errors

Post by mariusvr »

The proof of principle works and I have attached the modified posting.php to this post. As you can see with some minor changes phpBB3 can have a clean exit. (you will also need to comment out the exit statement in /includes/function.php exit hook).

With regards to alternative methods, output buffer methods don't work, Joomla is too complex to resume the rendering of Joomla in a phpBB3 exit hook and cURL implementation is problematic. Have you got any other suggestions if you think this is a wrong approach?

Does phpBB have a restriction on distributing modified source files? Ideally these simple changes can be included in the official phpBB3 release and save us many hours of modification with each new phpBB3 release.

Cheers, Marius
Attachments
posting.php.txt
(55.22 KiB) Downloaded 662 times
User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Outbuffering for integration with Joomla and errors

Post by Acyd Burn »

mariusvr wrote:The proof of principle works and I have attached the modified posting.php to this post. As you can see with some minor changes phpBB3 can have a clean exit. (you will also need to comment out the exit statement in /includes/function.php exit hook).
I do not think we will comment it out there... since you can hook the function and return a value. We still want the vanilla product to exit; instead of return; ;) exit; is as clean as return;
Does phpBB have a restriction on distributing modified source files? Ideally these simple changes can be included in the official phpBB3 release and save us many hours of modification with each new phpBB3 release.
The updater in phpBB3 is capable of detecting modifications and capable of not touching them. ;) The updater is generally a diff engine applying the changes as if users would use the patch application.

But you are right... having the changes in the core would be preferred.

Image
ssnobben
Registered User
Posts: 7
Joined: Tue Oct 10, 2006 9:24 pm

Re: Outbuffering for integration with Joomla and errors

Post by ssnobben »

Just come by and say its great that you support Marius for this! :P :P

Best rgds!
mariusvr
Registered User
Posts: 27
Joined: Mon Aug 25, 2008 10:10 am

Re: Outbuffering for integration with Joomla and errors

Post by mariusvr »

Great news: adding the return statments has allowed for a clean phpBB3 exit and for the visual integration into Joomla. Here is the result in action:

http://www.jfusion.org/phpbb3

The modded file only work if you haven't modded any files in the phpBB3 home directory before though. Would it be possible to have a regex type replacement in a phpBB3 mod:

Code: Select all

	
			$regex[]	= '#trigger_error\((.*?)\);#';
			$replace[]	= ''#trigger_error\($1\);return;#';
This way we can just do a search any replace on the exisiting phpBB3 code. I'm not familiar with the phpBB3 mod engine, so I would appreciate some insight if this would be possible.

Thanks, Marius
radopod
Registered User
Posts: 4
Joined: Fri Aug 29, 2008 7:15 am

Re: Outbuffering for integration with Joomla and errors

Post by radopod »

Hi there phpBB Devs
I would really like to know what you guys feel about the edits proposed by Marius? We have temporarily removed the modification from our forums as it was hampering our Support capabilities(We were testing on our Support Forums! :lol: ) but we can assure you that it will work as Marius posted in the last post! The changes that we have proposed are way too big for a person to apply using a phpBB Mod. Also it could jeopardise the user's forum. But the request for this Frameless integration is huge(Our forums are testament of this claim)! Will give phpBB a great way to expand. Joomla is the biggest CMS in the world while phpBB is the biggest forum software. This is the last roadblock as far as a complete integration is concerned. Would be great to see something positive from you guys sometime soon(We already have implemented this for SMF with ease).
Post Reply