Jonathan Posted August 30, 2018 Report Posted August 30, 2018 Found a few cases where if error reporting and debugging are enabled the pages simply break and you're just sitting with an error. I've found two instances of this: Suspending/unsuspending services Modules > Universal Module > Add Product The error is different on each and only happens when error reporting is set to -1, and debugging is set to true. Happens on PHP 7.1 and 7.2. MariaDB 10.2 and 10.3. Nginx and Litespeed for whatever it's worth. This is consistently recreatable on a blank 4.3.2 install as well as 4.3.0. For suspending/unsuspending: Something went wrong. tempnam(): file created in the system's temporary directory on line 179 in /home/blesta/public_html/vendors/h2o/h2o/loaders.php Printing Stack Trace: #0 [internal function]: UnknownException::setErrorHandler(8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #1 /home/blesta/public_html/vendors/monolog/monolog/src/Monolog/ErrorHandler.php(164): call_user_func(Array, 8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #2 [internal function]: Monolog\ErrorHandler->handleError(8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #3 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(179): tempnam('5268432515b8838...', '') #4 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(166): H2o_File_Cache->__construct(Array) #5 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(38): h2o_cache(Array) #6 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(33): H2o_File_Loader->setOptions(Array) #7 /home/blesta/public_html/vendors/h2o/h2o.php(75): H2o_File_Loader->__construct(Array, Array) #8 /home/blesta/public_html/app/models/emails.php(906): H2o->__construct() #9 /home/blesta/public_html/app/models/emails.php(569): Emails->buildEmail('service_unsuspe...', '1', 'en_us', Array) #10 /home/blesta/public_html/app/models/services.php(2598): Emails->send('service_unsuspe...', '1', 'en_us', 'jonathan@effect...', Array, NULL, NULL, NULL, Array) #11 /home/blesta/public_html/app/models/services.php(3300): Services->sendSuspensionNoticeEmail('unsuspend', Object(stdClass), Object(stdClass)) #12 /home/blesta/public_html/app/controllers/admin_clients.php(4850): Services->unsuspend('1', Array) #13 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/Dispatcher.php(143): AdminClients->editService() #14 /home/blesta/public_html/index.php(21): Dispatcher::dispatch('/index.php/admi...') #15 {main} For Add Product: Something went wrong. count(): Parameter must be an array or an object that implements Countable on line 45 in /home/blesta/public_html/components/modules/universal_module/views/default/add_row.pdt Printing Stack Trace: #0 [internal function]: UnknownException::setErrorHandler(2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #1 /home/blesta/public_html/vendors/monolog/monolog/src/Monolog/ErrorHandler.php(164): call_user_func(Array, 2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #2 /home/blesta/public_html/components/modules/universal_module/views/default/add_row.pdt(45): Monolog\ErrorHandler->handleError(2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #3 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/View.php(163): include('/home/blesta/pu...') #4 /home/blesta/public_html/components/modules/universal_module/universal_module.php(592): View->fetch() #5 /home/blesta/public_html/app/controllers/admin_company_modules.php(365): UniversalModule->manageAddRow(Array) #6 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/Dispatcher.php(143): AdminCompanyModules->addRow() #7 /home/blesta/public_html/index.php(21): Dispatcher::dispatch('/index.php/admi...') #8 {main} Quote
Paul Posted August 30, 2018 Report Posted August 30, 2018 I'm not surprised that debugging enabled can break things. I don't know the reason, and maybe Tyson can shed light on it, but I've seen debugging break things before which is why when we ask people to enable error reporting and debugging, we ask them to disable debugging as soon as they are done testing. I hope debugging is not enabled in your production environment? Quote
Jonathan Posted August 30, 2018 Author Report Posted August 30, 2018 4 minutes ago, Paul said: I hope debugging is not enabled in your production environment? Of course not, but I run my dev env. with debugging on and when this happens it's quite confusing as to thinking my code is broken, and of course preventing me from debugging errors of mine that are hit after this point. Paul 1 Quote
Tyson Posted August 30, 2018 Report Posted August 30, 2018 4 hours ago, Jonathan said: Found a few cases where if error reporting and debugging are enabled the pages simply break and you're just sitting with an error. I've found two instances of this: Suspending/unsuspending services Modules > Universal Module > Add Product The error is different on each and only happens when error reporting is set to -1, and debugging is set to true. Happens on PHP 7.1 and 7.2. MariaDB 10.2 and 10.3. Nginx and Litespeed for whatever it's worth. This is consistently recreatable on a blank 4.3.2 install as well as 4.3.0. For suspending/unsuspending: Something went wrong. tempnam(): file created in the system's temporary directory on line 179 in /home/blesta/public_html/vendors/h2o/h2o/loaders.php Printing Stack Trace: #0 [internal function]: UnknownException::setErrorHandler(8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #1 /home/blesta/public_html/vendors/monolog/monolog/src/Monolog/ErrorHandler.php(164): call_user_func(Array, 8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #2 [internal function]: Monolog\ErrorHandler->handleError(8, 'tempnam(): file...', '/home/blesta/pu...', 179, Array) #3 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(179): tempnam('5268432515b8838...', '') #4 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(166): H2o_File_Cache->__construct(Array) #5 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(38): h2o_cache(Array) #6 /home/blesta/public_html/vendors/h2o/h2o/loaders.php(33): H2o_File_Loader->setOptions(Array) #7 /home/blesta/public_html/vendors/h2o/h2o.php(75): H2o_File_Loader->__construct(Array, Array) #8 /home/blesta/public_html/app/models/emails.php(906): H2o->__construct() #9 /home/blesta/public_html/app/models/emails.php(569): Emails->buildEmail('service_unsuspe...', '1', 'en_us', Array) #10 /home/blesta/public_html/app/models/services.php(2598): Emails->send('service_unsuspe...', '1', 'en_us', 'jonathan@effect...', Array, NULL, NULL, NULL, Array) #11 /home/blesta/public_html/app/models/services.php(3300): Services->sendSuspensionNoticeEmail('unsuspend', Object(stdClass), Object(stdClass)) #12 /home/blesta/public_html/app/controllers/admin_clients.php(4850): Services->unsuspend('1', Array) #13 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/Dispatcher.php(143): AdminClients->editService() #14 /home/blesta/public_html/index.php(21): Dispatcher::dispatch('/index.php/admi...') #15 {main} php 7.1 added an error notice when calling tempnam in which it falls back to using the system's temporary directory. That will be displayed if error reporting is enabled. 4 hours ago, Jonathan said: For Add Product: Something went wrong. count(): Parameter must be an array or an object that implements Countable on line 45 in /home/blesta/public_html/components/modules/universal_module/views/default/add_row.pdt Printing Stack Trace: #0 [internal function]: UnknownException::setErrorHandler(2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #1 /home/blesta/public_html/vendors/monolog/monolog/src/Monolog/ErrorHandler.php(164): call_user_func(Array, 2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #2 /home/blesta/public_html/components/modules/universal_module/views/default/add_row.pdt(45): Monolog\ErrorHandler->handleError(2, 'count(): Parame...', '/home/blesta/pu...', 45, Array) #3 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/View.php(163): include('/home/blesta/pu...') #4 /home/blesta/public_html/components/modules/universal_module/universal_module.php(592): View->fetch() #5 /home/blesta/public_html/app/controllers/admin_company_modules.php(365): UniversalModule->manageAddRow(Array) #6 /home/blesta/public_html/vendors/minphp/bridge/src/Lib/Dispatcher.php(143): AdminCompanyModules->addRow() #7 /home/blesta/public_html/index.php(21): Dispatcher::dispatch('/index.php/admi...') #8 {main} This is a new requirement added in php 7.2. A simple fix can be added to that module template to resolve that issue, which should be in the next version. activa and Blesta Addons 2 Quote
Jonathan Posted August 30, 2018 Author Report Posted August 30, 2018 16 minutes ago, Tyson said: php 7.1 added an error notice when calling tempnam in which it falls back to using the system's temporary directory. That will be displayed if error reporting is enabled. Do you know where it would be trying to write to that's failing causing the fallback and the notice? This occurs on stock Blesta with all permissions proper and required modules present so it seems like something needs to be adjusted in the code. Quote
Tyson Posted August 30, 2018 Report Posted August 30, 2018 The h2o library is attempting to write it to a random directory. The user it's running as likely doesn't have write permission, and so it falls back to the system's temp directory. It's possible a cache directory could be specified when loading the h2o library, which may work around it. This isn't the first php 7 issue with this library though. It's dated and I'd like to replace it. Quote
Jonathan Posted August 30, 2018 Author Report Posted August 30, 2018 9 minutes ago, Tyson said: The h2o library is attempting to write it to a random directory. The user it's running as likely doesn't have write permission, and so it falls back to the system's temp directory. It's possible a cache directory could be specified when loading the h2o library, which may work around it. This isn't the first php 7 issue with this library though. It's dated and I'd like to replace it. Permissions should not be an issue unless it's trying to write to something based on / perhaps instead of it's current working directory. If you do replace it, try to stick with something based on Jinja2 like h2o is. Jinja2 native in Python is by far the best template engine/library I've ever used hands down. Quote
Jonathan Posted August 30, 2018 Author Report Posted August 30, 2018 Twig looks awesome: https://github.com/twigphp/Twig Quote
Blesta Addons Posted August 31, 2018 Report Posted August 31, 2018 14 hours ago, Jonathan said: Twig looks awesome: https://github.com/twigphp/Twig This will lead to a massive change in Blesta, unless they will make a back-award capability . already exist a post about it, and a use has posted a prof of concept how to integrate it in blesta . Quote
Jonathan Posted August 31, 2018 Author Report Posted August 31, 2018 1 minute ago, Blesta Addons said: This will lead to a massive change in Blesta, unless they will make a back-award capability . already exist a post about it, and a use has posted a prof of concept how to integrate it in blesta . No it wouldn't, since it uses similar syntax that's what really matters. Blesta on the back-end would have some work to do but when changing libraries that will always be the case. If it can be done with little to no impact to end users and how their templates are built then it can be done without customers noticing since templates wouldn't have to be updated. activa 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.