Directory

phpBB • Blog • phpBB

Blog

Posts Tagged ‘phpBB’

Attention developers: GitHub Codespaces enabled in phpBB!

Posted by battye in Development with the tags , , , on February 4th, 2023

If you’re a PHP developer, you’ll know that setting up a new development environment can be annoying and time consuming! You have to find a code editor, you have to install a web server like Apache, a database and PHP. Even if you’re using some virtualisation software like Vagrant or containerisation software like Docker to simplify the process, it still takes up time that you’d prefer to spend coding.

Enter: GitHub Codespaces.

The tech world is moving towards the cloud at a rapid pace and software development is no exception. A web-based project like phpBB is a good fit for cloud development and while a local development environment is wonderful, the ability to quickly code and test changes on any device with a browser is nice to have in the arsenal.

Codespaces includes a web-based code editor (VS Code) as well as a virtual machine which can be used to run software. Effective immediately, the phpBB project on GitHub contains a pre-configured Codespace with a LAMP stack and XDebug, allowing developers to modify and debug a vanilla board which is already automatically installed.

This tutorial explains how to:

  • Create a GitHub Codespace with an automatically created fresh installation of phpBB
  • Use a Codespace to make a code change to phpBB
  • Use XDebug to debug phpBB code in real time

Step 1

See if there is a ticket in the phpBB issue tracker describing the problem you would like to fix or the feature you would like to add. If there is not an existing ticket, you can create a new ticket, logging in using your phpBB.com login details.

In this case, we’ll look at a simple bug that was raised at https://tracker.phpbb.com/projects/PHPBB3/issues/PHPBB3-17025 – the number 0 appears as the default topic ID on the MCP move posts page, but there is no valid use case for this because it is an invalid ID. We will use this bug (resolved here) to demonstrate how GitHub Codespaces works and how it can be used for phpBB development.

The reporter provided some valuable information which acts as a good starting point, namely that the bug is on line 76 of prosilver/template/mcp_topic.html. We will come back to this in Step 3.

Step 2

Create a new branch on your own fork of phpBB. If you have never done this before, the procedure is outlined at https://area51.phpbb.com/docs/dev/3.3.x/development/git.html

Then on GitHub.com, create a new Codespace for this branch. It will already be preconfigured from the code in the phpbb/phpbb repository.

screenshot_create_codespace

This will create a brand new installation of phpBB with XDebug installed to assist developers.

Step 3

From the online VS Code website, which looks almost identical to the desktop version of VS Code, click on the files icon and navigate to mcp_topic.html – or use the shortcut Ctrl+P to search for the file.

screenshot_file_search

By looking at line 76 of that file, we can see that the “value” attribute listed in the ticket is set to a variable called TO_TOPIC_ID.

Using the Ctrl+Shift+F (global search) feature, if we search for that TO_TOPIC_ID variable we can see that it only gets used in one other place.

screenshot_global_search

Double click mcp_topic.php to open the other place where that variable is used – line 386 of the file.

The template variable is set to take the exact value of $to_topic_id.

Step 4

Using the power of XDebug, we can debug the issue in real time. Using the Ctrl+F (local search) feature, we can see where $to_topic_id is declared and how it is used.

On line 52 it takes input from the URL – and defaults to 0 if the parameter isn’t supplied in the URL. On line 357, it is forcibly set to 0 if a certain condition is met.

Line 376 is the best place to see XDebug in action though. Left click once just to the side of the line number so that a red breakpoint appears. A breakpoint is used to identify where execution should temporarily halt during debugging.

screenshot_breakpoint

Step 5

Now that a breakpoint has been set (you can set as many breakpoints as you wish), debugging can be turned on by clicking the “Run and Debug” button and then the green play button beside “Debug phpBB”.

screenshot_debug_on

Step 6

At this point, debug mode is active. Under the Ports tab at the bottom of screen, click the “Open in Browser” button and the fresh phpBB installation will open.

screenshot_open_site

Log in to the board with the credentials admin/adminadmin and, for the purposes of this example, add some posts and topics so that posts can be moved in the MCP to replicate the original bug.

Step 7

When the move posts page of the MCP is loaded, the XDebug breakpoint will automatically be hit – meaning the execution of the page is paused at that point to give developers the chance to analyse the code before it has finished running.

The browser tab will show a small red circle to indicate a breakpoint has been hit. Within VS Code, the line will be highlighted as well.

To identify the value of the variables at the point the execution has paused, either hover over a variable (like in the case of $to_topic_id on the right of screen) or look at the variable list on the left of screen.

screenshot_hit_breakpoint

Step 8

From this information, we learn that $to_topic_id is set to 0 as a default and it has been done intentionally. So to fix the bug of 0 appearing by default in the template, we don’t want to refactor the entire file and potentially introduce a new problem.

The sensible approach is to just change the way the value is passed to the template because, as we discovered from the global search in Step 3, the template variable does not get used anywhere else.

Using the ternary operator we can make a simple change so that the template variable declaration reads as:

‘TO_TOPIC_ID’ => $to_topic_id ?: ”,

This means that if $to_topic_id evaluates to true (the integer 0 does not evaluate to true, but if a valid topic ID is passed through the URL as explained in Step 4 it does evaluate to true), then $to_topic_id will be passed as the default value to the input field – otherwise, an empty string will.

Step 9

By returning to the tab with the phpBB board open, we can confirm that the fix is working as intended.

screenshot_bug_fixed

Step 10

Satisfied that the fix is correct, we can now commit and push the change to the local branch. This is easily done in VS Code, simply click the “Source Control” tab and stage the change to mcp_topic.php (the file we edited) by right clicking it and clicking “Stage Changes”.

Type a commit message in the box (using the format described at https://area51.phpbb.com/docs/dev/3.3.x/development/git.html), and then select “Commit and Push” from the dropdown option.

screenshot_commit_push

The list of files in the install directory can be safely ignored – they are deleted when setting up the Codespace to allow phpBB to run normally.

Step 11

Finally, create a pull request on GitHub.com from your local branch to either the phpbb/phpbb 3.3.x branch or the master branch. phpBB’s GitHub Actions will run unit tests, ensuring no features were broken accidentally as a result of the change, and then the development team will review the code.

And with that, it becomes clear that GitHub Codespaces is a really handy tool to be aware of and which can be used to easily and powerfully make code changes for phpBB.

Vote For phpBB’s Next Codename

Posted by MattF in Development with the tags , , , , , on October 16th, 2016

At phpBB we love codenames as much as we love Bertie.

Previously we have travelled to Mars and Saturn to find the most prominent features to name our versions. Now it’s time to come up with another codename for the version of phpBB.

In line with having an open mind for new features, looks, and changes in phpBB’s next major version we’re also opening up the decision on the codename to the community.

The phpBB Team has already pre-selected four possibilities from a rather long list.

Now it’s time for you, the community, to have the final say:
[Vote] Codename of next phpBB version

The vote will end in two weeks on October 30th, 2016.

Happy voting!


 beer_bertie

OSCON 2010

Posted by Sam in Events with the tags , , , , , on July 28th, 2010

The O’Reilly Open Source Convention has been held annually since 1999, allowing students, entrepreneurs, enthusiasts, and professionals to attend informative sessions and tutorials as well as visit the expo hall and mingle with others holding a common technical interest. This year, for the first time ever, phpBB was among the exhibitors in the Expo Hall.

Left to Right: Yuriy, Nathan, Cullen, Sam

What we expected

Despite phpBB3’s fantastic security record, we expected to meet some attendees who were only familiar with phpBB2. Anticipating questions dealing with security, we came prepared with laminated placards displaying pie charts and details of all issues reported for the phpBB3 line – the flagship phpBB version for the past 3 years.

What we didn’t expect

Very few people asked about phpBB’s security and walked past the placards to ask us questions about features, bridges, future plans, etc. Many of the other Open Source project exhibitors visited our booth and expressed their warm feelings toward the project and positive experiences using the phpBB software. Rather than having to defend ourselves, we were instead answering interesting questions and tipping our hats to compliments.

New Beginnings

Of all the different questions we were asked, the most common was surprising, to say the least. Over the course of the two days, we heard “Does phpBB integrate with Drupal?” so often that we began keeping count. This sparked some internal discussion, and we visited the Drupal booth, which was conveniently located just around the corner from us. There is already a community developed Drupal module for integration with phpBB, but multiple reports suggested that it was unstable and poorly written. Its scores within the Drupal database suggest that it is largely unusable in a live environment, which was a huge shock to us. After the first night, we returned to our hotel room and began planning a new phpBB-maintained Drupal plugin. Work on this has already begun and more information will be available soon.

Some very popular open source projects were present at OSCON, and a number of them approached us about presenting at their upcoming events. We are, of course, very excited about these plans and will keep you updated on our upcoming speaking/presentation engagements either via this blog or on the board.

After the Expo

On Thursday evening, we attended an informal “Birds of a Feather” session. Organizer Douglas Bell (Webmacster87), Cullen Walsh (ckwalsh) and Lorelle VanFossen all spoke about running online communities. We later joined them for dinner at a local restaurant.

phpBB.com server

The following day we joined the OSUOSL Open Bus Tour for a view of the Oregon State University campus and Open Source Lab. OSUOSL rented a wifi and power equipped bus for the 90 minute journey and we had a blast with the other attendees. You can see us with Lance from OSUOSL and the 2 phpBB.com servers (underneath the Berties) to the left.

We are very grateful to have such friends in the Open Source world.

What we took from this

We are glad to have met so many wonderful people at OSCON and look forward to maintaining the new bridges that have been formed. Speaking directly to phpBB users was a unique experience and we walk away with a better perspective of what the community expects from us. We will continue to improve over the next year and will be ready to address your updated concerns at next year’s event.

Please discuss this blog post in the phpBB OSCON 2010 topic in the Discussion Forum.

Please discuss this blog post in the phpBB OSCON 2010 topic in the Discussion Forum.

Deploying phpBB on Windows Azure

Posted by Kellanved in Development with the tags , , , , on July 26th, 2010

Windows Azure is the Mircrosoft cloud computing solution. One thing that might come as a surprise is that is specifically intended to run php applications (well, it runs .net too, even java). Long story short, we got introduced to the azure platform during the JumpIn! Camp. The project to get phpBB running on the Azure platform started right there – now it’s showing results.
Read the rest of this entry »

At TekX Chicago

Posted by A_Jelly_Doughnut in Events with the tags , , , on May 29th, 2010

(That’s Tek-Ten, by the way)

A week ago, I was recovering from a weeklong trip to Chicago for php|tek. Here’s a few of the things I heard about:

  • Derick Rethans on the DateTime functions added to PHP 5.2. The power of the DateTime class is pretty awesome. The class’s essential beauty is in the fact that it stores a time and a time zone. It can also do accurate math against times and solves the 2038 problem. phpBB will be moving this way for Ascraeus.
  • Git is here to stay. Talks from Travis Swicegood, Lorna Jane Mitchell, and Matthew Schmidt all talked about version control systems in some way or another, and a great number of the conference attendees are trying to move their projects to Git. Matthew gave the keynote on Thursday, and included phpBB in his listing of “open source projects driving the move to Git”. Thanks Matt!
  • HipHop for PHP, a technology created by Facebook, and open-sourced for anyone to use, essentially compiles PHP into C++ for performance. Scott MacVicar, now at Facebook, formerly of vBulletin had a conversation about the future of bulletin boards – the name of the game is doing it better, not about doing more. I’m looking forward to the day that someone compiles phpBB using HipHop and reports their performance gains.
  • JIRA is successfully used in other open-source projects. I spoke with Matthew Weier O’Phinney, project lead of Zend Framework, who says that they’ve been very happy with JIRA. I was surprised that I was able to talk with him on an intelligent level about it, because Zend Framework has used it for years, and phpBB has used it for just a couple of months. Unfortunately at Tek, very few of the “front-end” open source projects were represented. For example, I don’t know of anyone in attendance who had submitted code to Drupal, WordPress, Joomla, MyBB, or Magento. There were, however, numerous framework developers running about.
  • Some Things Never Change. As I went around during social periods telling people “Hi, I’m Josh, I work on phpBB”, I got several responses:
    1. Oh, that software that gets hacked more often than ? (This is the “take another look” argument. I politely informed these people that phpBB3’s security record is greatly improved compared to phpBB2.)
    2. Its nice to see open-source projects represented at Tek.
    3. I spent hours trying to integrate that with WordPress and failed. What’s the deal with that?
    4. How’s the transistion from 2 to 3 going?
    5. How do you bear to work with that code?

I came away from these conversations with the opinion that phpBB is well known in the community, but not necessarily well-liked. A lot of this is because it can be difficult for these experienced developers to integrate with their products. Some wanted single-sign-on, others found that the layout was hard to customize to match an existing site, and still others wanted to add custom features but weren’t sure where to start.
I told people in person that we want to work on that, and we will, with some improvements slated for Ascraeus.

A large portion of the learning these conferences is not the talks, but the socialization that happens around them. A lot of the un-conference portion of the conference revolved around frameworks. It seems that everyone hates at least one of them, but many of them are looking forward to Symfony 2 and Zend Framework 2, both expected by the end of the year.

This was my first major PHP conference, and it was a good experience. With any luck, I’ll be there again in 2011.

Moving on – the future of phpBB development

Posted by naderman in Development with the tags , , , , , , , , , , on February 18th, 2010

About a month ago I was promoted to phpBB’s lead developer position. When I was given that role I was asked to present to the management team what my plans for phpBB are. But since they concern all of you, the phpBB community, I believe they belong here as well.

We are currently in the process of releasing phpBB 3.0.7, a smaller bug fix release of Olympus. After that development will split into multiple branches. Meik has already explained our new versioning system in a previous announcement. What this means is that after 3.0.7 is released we will start working on two branches: Ascraeus – the future phpBB 3.1, and Rhea – the future phpBB4. At the same time we will continue maintanance releases of Olympus.

Over the last few weeks we have made a few important decisions, that we believe can positively impact phpBB development. These include changes to development infrastructure as well as our development model. I will briefly outline these changes here, more details will be posted on the blog or as an announcement soon. Read the rest of this entry »

Developer Meeting

Posted by naderman in Development, Events with the tags , , , , , on July 26th, 2009

The phpBB Development and Management Teams met in Cologne, Germany last week for 4 days of exciting brainstorming and coding.

We discussed future phpBB releases and worked on phpBB 3.0.6. Our plans for 3.0.6 have previously been discussed on this blog, but we decided to add even more. One feature we decided upon and implemented during the meeting was PM reports. This feature allows users to report private messages to moderators just like posts. A reported private message will then appear in a new MCP module so moderators can read the message and act upon it. This is particularly useful for users who want to report spam PMs. From this feature emerged another: emptying a user’s outbox. This option, in the Manage Users section of the ACP, allows the deletion of all unread PMs sent by a spammer.

Yet another idea we had during the meeting, which has already been announced, is the Best CAPTCHA Plugin Competition. I would like to urge all MOD developers to participate in this competition since a large variety of CAPTCHAs is the most effective measure against spammers. With the new CAPTCHA API, creating a CAPTCHA plugin is really simple. The example Q&A CAPTCHA Plugin, which will ship with phpBB 3.0.6, was also created during the meeting.

Details of the decisions made regarding the future of phpBB will be published in separate blog posts over the next several weeks, so make sure to check back for news! Of course, the meeting was also a great opportunity for us to get to know each other better. Most of us had already met at Londonvasion last year, but it was great to catch up with everyone again! We visited the Chocolate Museum and climbed the tower of the Cologne Cathedral. All in all, we had lots of fun too. During the meeting, we were happy to invite bantu to join the Development Team.

View from the Kölner Dom
View from the cathedral
At work
Team at work
Chocolate Fountain
Chocolate fountain

Group Photo

Andreas (bantu), Dominik (dhn), front: Jim (TerraFrost), back: Nils (naderman), Meik (Acyd Burn), Marek (APTX), Chris (ToonArmy), Henry (kellanved), Carolina, Yuriy (Marshalrusty), Igor (evil<3)

Junior Developers

Posted by naderman in Development with the tags , , , , , on June 17th, 2009

phpBB is continuing its process of opening up the development process. After an internal trial phase we have now opened up the Junior Developer Team to regular members of our community. An increasing amount of people involved in phpBB development should both speed up the development and improve quality.

Read the rest of this entry »

phpBB 3.0.6 plans

Posted by Acyd Burn in Development, Modifications, Styles with the tags , , , on June 10th, 2009

Here we are. phpBB 3.0.5 got released and work on phpBB 3.0.6 began. Previously, we concentrated on fixing bugs and only introduced tiny new features. This time, phpBB 3.0.6 will be a “feature” release, packed with numerous new, cool, stunning, breath-taking… err, just new features. 😉 We will now tell you which new features are planned for 3.0.6 and what style authors and modders need to take care of.

Read the rest of this entry »

Talkin bout Area51

Posted by battye in Development with the tags , , , , on February 25th, 2009

No! I’m not talking about military bases or U.S. conspiracy theories, but rather phpBB’s very own Area51 – http://area51.phpbb.com

Area51 is phpBB’s official testing ground, and as stated on the site it is the home of “bleeding edge developmental code”. The site was established in 2001 – the brainchild of psoTFX, the former leader of the development team, in order to have a local installation of phpBB that they could test in a real life situation. With the main phpBB.com forum obviously out of the question, Area51.phpbb.com can be used so that the developers can see how the latest code is holding up with many concurrent users online, without fear of users becoming annoyed if certain features aren’t working (which I will touch on in a minute).

Area51 boasts the unique feat of hardly changing at all and always changing at the same time.

Read the rest of this entry »