Notice when Creating Constraints
klaxian opened this issue · 3 comments
When attempting to create table constraints, PHP notices are displayed like the following. Since these notices are benign, constraint creation can still proceed. However, the UI is cluttered with a wall of error text. This notice has been seen in other areas as well.
Notice: Only variables should be passed by reference in /var/www/phppgadmin-hf/src/controllers/ConstraintsController.php on line 436
Call Stack:
0.0000 365904 1. {main}() /var/www/phppgadmin-hf/index.php:0
0.0027 831248 2. Slim\App->run() /var/www/phppgadmin-hf/index.php:193
0.0028 847712 3. Slim\App->process() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/App.php:296
0.0030 853208 4. Slim\App->callMiddlewareStack() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/App.php:388
0.0030 853208 5. Slim\App->Slim\{closure}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/MiddlewareAwareTrait.php:117
0.0030 853208 6. call_user_func:{/var/www/phppgadmin-hf/vendor/slim/slim/Slim/MiddlewareAwareTrait.php:70}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/MiddlewareAwareTrait.php:70
0.0030 853208 7. Slim\DeferredCallable->__invoke() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/MiddlewareAwareTrait.php:70
0.0031 861784 8. call_user_func_array:{/var/www/phppgadmin-hf/vendor/slim/slim/Slim/DeferredCallable.php:43}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/DeferredCallable.php:43
0.0031 862208 9. Slim\Container->{closure:/var/www/phppgadmin-hf/src/lib.inc.php:363-425}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/DeferredCallable.php:43
0.0043 1011984 10. Slim\App->__invoke() /var/www/phppgadmin-hf/src/lib.inc.php:421
0.0043 1011984 11. Slim\Route->run() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/App.php:495
0.0043 1012040 12. Slim\Route->callMiddlewareStack() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/Route.php:313
0.0043 1012040 13. Slim\Route->__invoke() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/MiddlewareAwareTrait.php:117
0.0044 1012728 14. Slim\Handlers\Strategies\RequestResponse->__invoke() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/Route.php:335
0.0044 1013696 15. call_user_func:{/var/www/phppgadmin-hf/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php:41}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php:41
0.0044 1013696 16. Slim\Container->{closure:/var/www/phppgadmin-hf/index.php:118-145}() /var/www/phppgadmin-hf/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php:41
0.0045 1089960 17. PHPPgAdmin\Controller\ConstraintsController->render() /var/www/phppgadmin-hf/index.php:144
0.0050 1103824 18. PHPPgAdmin\Controller\ConstraintsController->addForeignKey() /var/www/phppgadmin-hf/src/controllers/ConstraintsController.php:45
Yup, I've noticed myself and repaired it on dev branch. I'll release it in a new tag. The thing is that the controller was passing new \PHPPgAdmin\XHtml\XHtmlOption(...)
as argument to the method. I solved it by first assigning the instance of XHtmlOption to a variable and then passing it to the method.
PHP objects are always passed by reference. I think you might want to change the method signature instead of assigning the object to a variable before passing it. Remove the &
from the method arguments. If the offending method is in the Slim library, you could report the issue upstream? PHP 7+ has become more picky about these kinds of things. As always, thanks for the help!
Nah it's not slim
It's just a cumbersome class (a few ones actually) to build comboboxes from adodb recordsets. I'm pretty sure all of that can be replaced with simple associative arrays and parsed using twig but, man, those xhtml element classes are everywhere.
PD: you're absolutely right about objects being passed by ref. Half of the stack overflow questions regarding php objects are from ppl that have yet to discover clone
.