bobbingwide / oik-shortcodes

Shortcode, block and API server
https://www.oik-plugins.com/oik-plugins/oik-shortcode-server/
GNU General Public License v2.0
1 stars 0 forks source link

Uncaught Error: Cannot access self:: when no class scope is active #23

Open bobbingwide opened 8 years ago

bobbingwide commented 8 years ago

When attempting to detect the default value of a parameter to a class method we need to be able to cater for parameters declared with default values such as self::MY_CLASS_CONSTANT

The problem occurs in ReflectionParameter->getDefaultValue() in \oik-shortcodes\shortcodes\oik-api-importer.php.

Temporary workaround

Change the code to use the literal value of the constant

bobbingwide commented 8 years ago

This problem occurs in methods where self::CONSTANT is the default parameter. Changing the "::" to "__" prevents a Fatal, we just get a Notice about undefined constant. Since we don't yet handle class constants this isn't too much of an issue.

bobbingwide commented 4 years ago

Revisit this to see if we can stop changing '::' to '__' in the light of the results produced when fixing #65.
In the latest documentation https://wordpress-seo.wp-a2z.org/oik_api/middlewarelog/ the constant is displayed as YoastSEO_Vendor\Psr\Log\LogLevel__INFO