-
- 275 Posts
When using Formit 2.1.1 I see the following popping up in my php_error.log:
[25-Sep-2012 23:24:23 UTC] PHP Strict standards: Only variables should be passed by reference in /Applications/MAMP/htdocs/core/components/formit/model/formit/fidictionary.class.php on line 128
This then generates a PHP stack trace:
[25-Sep-2012 23:49:07 UTC] PHP Stack trace:
[25-Sep-2012 23:49:07 UTC] PHP 1. {main}() /Applications/MAMP/htdocs/index.php:0
[25-Sep-2012 23:49:07 UTC] PHP 2. modX->handleRequest() /Applications/MAMP/htdocs/index.php:72
[25-Sep-2012 23:49:07 UTC] PHP 3. modRequest->handleRequest() /Applications/MAMP/htdocs/core/model/modx/modx.class.php:1291
[25-Sep-2012 23:49:07 UTC] PHP 4. modRequest->prepareResponse() /Applications/MAMP/htdocs/core/model/modx/modrequest.class.php:128
[25-Sep-2012 23:49:07 UTC] PHP 5. modResponse->outputContent() /Applications/MAMP/htdocs/core/model/modx/modrequest.class.php:144
[25-Sep-2012 23:49:07 UTC] PHP 6. modParser->processElementTags() /Applications/MAMP/htdocs/core/model/modx/modresponse.class.php:83
[25-Sep-2012 23:49:07 UTC] PHP 7. modParser->processTag() /Applications/MAMP/htdocs/core/model/modx/modparser.class.php:221
[25-Sep-2012 23:49:07 UTC] PHP 8. modScript->process() /Applications/MAMP/htdocs/core/model/modx/modparser.class.php:484
[25-Sep-2012 23:49:07 UTC] PHP 9. elements_modsnippet_11() /Applications/MAMP/htdocs/core/model/modx/modscript.class.php:66
[25-Sep-2012 23:49:07 UTC] PHP 10. fiRequest->handle() /Applications/MAMP/htdocs/core/cache/includes/elements/modsnippet/11.include.cache.php:40
[25-Sep-2012 23:49:07 UTC] PHP 11. fiRequest->postProcess() /Applications/MAMP/htdocs/core/components/formit/model/formit/firequest.class.php:204
[25-Sep-2012 23:49:07 UTC] PHP 12. fiDictionary->store() /Applications/MAMP/htdocs/core/components/formit/model/formit/firequest.class.php:283
The associated FormIt call is pretty basic and has &store=`1` and a redirect.
Any ideas on what is causing this?
EDIT: When switching from PHP5.4.4 to PHP 5.2.17 the warning and stack trace disappear.
[ed. note: skndn60 last edited this post 11 years, 6 months ago.]
MODx Revolution / MAMP / OS X
https://bugs.php.net/bug.php?id=48937
Apparently a number of string-handling functions will throw this error if what they are supposed to be working on isn't a proper variable. The explanation is rather complex, but the bottom line is that the warning is pointing out code that never really worked properly before, and can lead to memory corruption.
The functions do work, if not properly, and you can turn off the E_STRICT error reporting.
In PHP 5 a new error level E_STRICT is available. Prior to PHP 5.4.0 E_STRICT was not included within E_ALL, so you would have to explicitly enable this kind of error level in PHP < 5.4.0. Enabling E_STRICT during development has some benefits. STRICT messages provide suggestions that can help ensure the best interoperability and forward compatibility of your code. These messages may include things such as calling non-static methods statically, defining properties in a compatible class definition while defined in a used trait, and prior to PHP 5.3 some deprecated features would issue E_STRICT errors such as assigning objects by reference upon instantiation.
It is always recommended to log errors to a logfile rather than display them on a production server.
http://php.net/manual/en/errorfunc.configuration.php
-
- 275 Posts
@Susan Otwell: Thanks for that. Should I file a bug report????
MODx Revolution / MAMP / OS X
-
- 24,544 Posts
I think the fix would be to change line 128 of core/components/formit/model/formit/fidictionary.class.php from
$this->modx->cacheManager->set($cacheKey,$this->toArray(),$storeTime);
to this:
$arr = $this->toArray();
$this->modx->cacheManager->set($cacheKey, $arr, $storeTime);
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
-
- 275 Posts
@BobRay: awesome! Thanks!!
MODx Revolution / MAMP / OS X
-
- 24,544 Posts
My pleasure.
BTW, you could add this as a third line to free up the memory since the array is no longer needed:
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html