IBM Support

Developer Portal throws PHP Fatal error due to issue with defining $title

Troubleshooting


Problem

Users might see an error like the following in the portal-www pod:

"
PHP message: PHP Fatal error: Type of Drupal\ibm_apim\Updater\ApicModule::$title must not be defined (as in class Drupal\Core\Updater\Updater) in /web/platforms/devportal-9.x-10.0.1.11-20230207-1645/modules/ibm_apim/src/Updater/ApicModule.php on line 22

Drupal 9.5 updated to add title to the Update file (https://github.com/drupal/drupal/blob/9.5.x/core/lib/Drupal/Core/Updater/Updater.php#L35) and PHP doesn't allow users to redefine in API Connect 10.0.1.

 The file /web/platforms/<platform>/modules/ibm_apim/src/Updater/ApicModule.php declares the title like the following:

 /**

  * @var string|null

  */

 public ?string $title = NULL;

This code causes issues as the update file cannot update the title due to the limitations with PHP.

Symptom

Affected users might see errors like this when they try actions on the Developer Portal. One example where this issue can be observed is when a user tries to upload a custom Theme.

Resolving The Problem

The permanent solution for this issue is being tracked by APAR LI82958.
You can work around the issue with the following steps to remove the title being defined in the Platform code:
1: Exec into one of the portal-www pod admin containers
Command: 
kubectl exec -ti <portal-www-pod-name> -c admin bash

2. Edit the file /web/platforms/<platform>/modules/ibm_apim/src/Updater/ApicModule.php
Command:
vi /web/platforms/devportal-9.x-10.0.1.11-20230207-1645/modules/ibm_apim/src/Updater/ApicModule.php

Remove the title declaration:
  public ?string $title = NULL;


3. Edit the file /web/platforms/<platform>/modules/ibm_apim/src/Updater/ApicTheme.php
Command:
vi /web/platforms/devportal-9.x-10.0.1.11-20230207-1645/modules/ibm_apim/src/Updater/ApicTheme.php

Remove the title declaration:
  public ?string $title = NULL;

4.Clear the site cache

a. List the sites to identify the site alias:
Command: 
list_sites

Example output:
bash-4.4$ list_sites
044639da-ef45-4683-a1a1-5bc08fd3cf41.b3b18d00-ce29-4cf9-9a18-16249f8a29e4 => portal.example.ibmlab.test/test/sandbox (INSTALLED)


b. Clear the site cache
Command: 
drush @<site-alias> cr

Applied to our example output
drush @portal.example.ibmlab.test/test/sandbox cr
 

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSMNED","label":"IBM API Connect"},"ARM Category":[{"code":"a8m0z000000cvaRAAQ","label":"API Connect-\u003EDeveloper Portal (MM)-\u003ECustom Modules"}],"ARM Case Number":"TS012866011","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.1"}]

Document Information

Modified date:
03 May 2023

UID

ibm16988037