*

lucky7

  • ***
  • 31 posts
Dear all,

I had a bug on add new items with the Attributes Osclass Plugin. Here are the error message:

PHP Fatal error: Uncaught Error: Undefined constant "type" in /web/mysite.com/oc-content/plugins/attributes/functions.php:903\nStack trace:\n#0 /web/mysite.com/oc-includes/osclass/classes/Plugins.php(41): atr_posted()\n #1 /web/mysite.com/oc-includes/osclass/helpers/hPlugins.php(34): Plugins::runHook()\n#2 /web/mysite.com/oc-includes/osclass/ItemActions.php(333): osc_ run_hook()\n#3 /web/mysite.com/oc-includes/osclass/controller/item.php(159): ItemActions->add()\n#4 /web/mysite.com/index.php(270): CWebItem->doM odel()\n#5 {main}\n thrown in /web/mysite.com/oc-content/plugins/attributes/functions.php on line 903, referer: https://www.mysite.com/item/new


The error originates exactly at line 903 in functions.php. There is a bareword type (treated as a constant) where the variable $type should be. In PHP 8 this triggers a Fatal error: “Undefined constant 'type'”.

Location

Current (incorrect, line 903):

$value = ((type == 'CHECKBOX' && $d == 'on') ? 1 : $d);


Fixed (correct):

$value = (($type == 'CHECKBOX' && $d == 'on') ? 1 : $d);


With this change, the function works again — in older PHP versions this often only raised a notice (“assumed 'type'”), but PHP 8 correctly treats it as a fatal error.

Kind regards

*

MB Themes

Re: [Bug] + [Fix] Attributes Osclass Plugin - Error 500 on add new item
« Reply #1 on: September 23, 2025, 08:31:24 PM »
Thanks, nice catch, plugin will be updated!
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots