mozart
mozart copied to clipboard
Brain-WP/Cortex incompatibility: PHP Fatal error: Uncaught Error: Call to undefined function Brain\did_action()
After running "vendor/bin/mozart" compose I'm getting the following error:
PHP Fatal error: Uncaught Error: Call to undefined function Brain\did_action() in /Users/my_user_name/htdocs/wordpress/wp-content/themes/my-tmene-name/vendor/brain/cortex/src/Cortex.php:55
My package.json
{
// ...
"require": {
"composer/installers": "~1.0",
"timber/timber": "^1.5",
"abraham/twitteroauth": "^0.7.4",
"defuse/php-encryption": "^2.1",
"guzzlehttp/guzzle": "^6.3",
"brain/cortex": "~1.0.0@dev",
"symfony/var-dumper": "^4.2.0",
"monolog/monolog": "^1.24.0",
"google/cloud-firestore": "^1.0.0"
},
"autoload": {
"psr-4": {
"Sw\\": "lib/Sw/",
"Vendor\\": "build/"
},
"files": [
// some files
]
},
"require-dev": {
"coenjacobs/mozart": "^0.3.0"
},
"extra": {
"mozart": {
"dep_namespace": "Vendor\\",
"dep_directory": "/build/",
"classmap_directory": "/classes/dependencies/",
"classmap_prefix": "SW_",
"packages": [
"timber/timber"
]
}
},
"scripts": {
"post-install-cmd": [
"\"vendor/bin/mozart\" compose",
"composer dump-autoload"
],
"post-update-cmd": [
"\"vendor/bin/mozart\" compose",
"composer dump-autoload"
]
}
}
Based on just this error, the error is within the package brain/cortex that you're requiring. It seems that you are trying to call a function within a namespace, while in reality you probably need the global did_action() function. Please share the lines of code that the error is referring to, but I'm afraid that's the case and therefore not a Mozart issue.
@coenjacobs
I'm not calling the did_action() function, the library calls this function internally: see Cortex/Cortex.php#L55
Hi,
I'm currently fighting with rubix/ml and Mozart. I think I've run into the same issue, therefore I created a composer project from scratch to demonstrate the issue in isolation.
The function is imported at https://github.com/ChristophWurst/rubix-ml-mozart/blob/1344bfba014c8f2c9b7d4edca5c7cc1fddcf989b/lib/Vendor/Rubix/ML/Datasets/Dataset.php#L17. As you can see here, there the original function got namespaced for the import.
The definition, however, has the original namespace: https://github.com/ChristophWurst/rubix-ml-mozart/blob/1344bfba014c8f2c9b7d4edca5c7cc1fddcf989b/lib/Vendor/Rubix/ML/functions.php#L44.
Hope this makes it easier to debug :v: