Skip to content

Conversation

@utrodus
Copy link
Contributor

@utrodus utrodus commented Apr 18, 2025

Hi Hafiq Iqmal 👋🏻

This pull request fixes Fatal error when filtering by state Sabah: Class "HttpException" not found, where the state Sabah was missing from the list of supported regions in the MalaysiaHoliday class.

🛠️ Changes made:

  • Added 'Sabah' to the self::$region_array in MalaysiaHoliday.php.

🐛 Root Cause:

The checkRegional() method validates the requested region against the self::$region_array. Since 'Sabah' was not listed, any request involving 'Sabah' resulted in a RegionException, causing the script to fail when attempting to fetch holidays for that region.

✅ Testing:

I verified the fix by running the following code:

$holiday = new MalaysiaHoliday();
$data = $holiday->fromState('Sabah', 2025)->get();

This now successfully returns holiday data for Sabah in 2025 without throwing an exception.

Closes #12

Sabah was not included in the static $region_array, which caused RegionException when calling fromState('Sabah'). This update adds 'Sabah' to the list of supported states so that its public holiday data can be retrieved properly.  Tested with: $holiday = new MalaysiaHoliday(); $data = $holiday->fromState('Sabah', 2025)->get();  Confirmed that data is retrieved successfully from: https://www.officeholidays.com/countries/malaysia/sabah/2025
@utrodus
Copy link
Contributor Author

utrodus commented Apr 19, 2025

I noticed that the GitHub Actions build is currently failing on my pull request due to the following error:

Error: Missing download info for actions/cache@v2

Here’s the failed build:
🔗 GitHub Actions Job

This seems to be related to an outdated version of the actions/cache GitHub Action. The v2 version might have been deprecated or moved. You can find the updated version here on the GitHub Marketplace:
📦 [actions/cache on GitHub Marketplace](https://github.com/marketplace/actions/cache)

You might want to update the version to actions/cache@v3 in the workflow file to resolve this issue.

Let me know if you'd like me to help create a quick PR to fix it 🙌🏻

@afiqiqmal afiqiqmal merged commit db5dcc6 into afiqiqmal:master Apr 20, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error when filtering by state Sabah: Class "HttpException" not found

2 participants