-
Posts
11,150 -
Joined
-
Last visited
-
Days Won
368
Everything posted by adrian
-
Something else to be aware of - getting errors when using this with Ryan's TOTP module. https://github.com/ryancramerdesign/TfaTotp/issues/3
-
Thanks @monollonom for the new version. One thing I'd like to see is removal of the language dropdown unless "Languages Support - Page Names" is installed. In my case I am using ML, but I don't have language specific URLs, so that dropdown is just confusing. What do you think? Thanks.
-
Template file contains: $quantity = 'testing'; $data = include_once '/Users/ajones/Sites/ecoreportcard/test.php'; $this->session->set($quantity . '_data', $data); and test.php contains: return array( ///////Units Of Temperature/////// "dimension" => 'dfg', 'base' => 'Kelvin', 'units' => array( "Kelvin" => array("shortLabel" => "K", "conversion" => 1, "plural" => "Kelvin"), //Kelvin - base unit for temperature "Celsius" => array("shortLabel" => "degC", "conversion" => function ($val, $tofrom) { return $tofrom ? $val - 273.15 : $val + 273.15; }, "plural" => "Celsius"), "Fahrenheit" => array("shortLabel" => "degF", "conversion" => function ($val, $tofrom) { return $tofrom ? ($val * 9 / 5 - 459.67) : (($val + 459.67) * 5 / 9); }, "plural" => "Fahrenheit"), ) ); and the result when viewing a page with that template is: Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0 I think it really is a simple matter of what the error says. You aren't allowed to serialize closures (and there are two of them in test.php) and saving to $_SESSION serializes the data. There are lots of topics discussing it: https://www.google.com/search?q=php+session+"Serialization+of+'Closure'+is+not+allowed"
-
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
@ryan - I think the biggest issue I am seeing is the actual autosave - that's what is causing the 500 error when making the AJAX call. If I the type in buildAjaxRequest() to GET, then I don't get the error any more. It's still not autosaving, but that's not surprising given that ProcessPageEdit is expect GET, but maybe it gives you a clue as to why I might be getting the error. This is what debug is returning: [ "submit_autosave=1", "id=7689", "body=%3Cp%3Ehjhdh+dhjdk+dhjdkg+dfghdf%26nbsp%3B%3C%2Fp%3E%0D%0A", "TOKEN643048379X1637275316=pObPhEnWs6iGOEdu.4kZzL2ATScfNNl0" ] { "type": "POST", "url": "./?id=7689&modified=1637275019&fields=body", "data": "submit_autosave=1&id=7689&body=%3Cp%3Ehjhdh+dhjdk+dhjdkg+dfghdf%26nbsp%3B%3C%2Fp%3E%0D%0A&TOKEN643048379X1637275316=pObPhEnWs6iGOEdu.4kZzL2ATScfNNl0", "dataType": "json" } Autosave error: ajax error: error (body) -
It's due to setting that $data to a session. PHP serializes data saved in sessions, so that's the reason for the error. Here are a couple of suggestions: https://stackoverflow.com/questions/39885355/php-serialization-of-a-closure-is-not-allowed This isn't an issue with the Console panel - I get exactly the same error in a template file.
-
So that is the entire contents of the file at $path? I just tested like this: where test.php contains: return array( ///////Units Of Temperature/////// "dimension" => 'dfg', 'base' => 'Kelvin', 'units' => array( "Kelvin" => array("shortLabel" => "K", "conversion" => 1, "plural" => "Kelvin"), //Kelvin - base unit for temperature "Celsius" => array("shortLabel" => "degC", "conversion" => function ($val, $tofrom) { return $tofrom ? $val - 273.15 : $val + 273.15; }, "plural" => "Celsius"), "Fahrenheit" => array("shortLabel" => "degF", "conversion" => function ($val, $tofrom) { return $tofrom ? ($val * 9 / 5 - 459.67) : (($val + 459.67) * 5 / 9); }, "plural" => "Fahrenheit"), ) ); All I did was change the value of dimension because I don't have that class set up. What am I missing?
-
Hi @MarkE - could you show how the anonymous function in the included file is set up. Is it like: function() { echo 'test'; }; or echo function() { return 'test'; };
-
Nice catch @bernhard - should be fixed in the latest version. FYI in case you don't already know - if you are on the module settings page, the RequestInfo panel will show all the module settings. Also, you can just do: d($module); when on a module settings page because $module is set to the current module, same as $field and $template when on the settings for any field or template.
-
Can't get DebugBar to appear in pw-3.0.184-master
adrian replied to hellomoto's topic in Tracy Debugger
Can you narrow it down to the one problematic module? -
Hi @gebeer - thanks for taking the time to debug. I actually only ever see that if I have an emoji character in the console. Regular characters don't cause that for me, but maybe that is environment based. I've added Courier New for you, but I would have though that the "monospace" option at the end would have taken care of things in any environment. I have also updated ACE to the latest version. Let me know if you have any more troubles with it.
-
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
Yes - probably a strange thing to do, but the popup window was behind my main window so I didn't notice it. It doesn't update at all - that error happens as soon as I stop typing in on of the fields - so as soon as it tries to trigger an update in the preview window. My server is a VPS box so it shouldn't be any host specific limitations - or at least not any that I can't change. I have played around a little with some of the timeout settings, but no luck so far. No php errors that I can find either. I'll try to take a deeper look later. -
Try 1 or 2 GB, but do it in AdminActions.module so it's not affecting your site in general. In reality I think that the backup method from the PW core (that AA uses) needs to be converted to use system tools like mysqldump so it is performant and won't hit these memory limits. I believe I have mentioned this to Ryan somewhere. ProcessDuplicator has the option for this, but I'd rather see it implemented in the PW core.
-
Interesting you are seeing that so often - it's quite rare for me. I just tested a FB hook but the output looks OK to me. Could you perhaps share something that triggers that stacktrace as a string?
-
What you're coming across is actually this: https://github.com/processwire/processwire-issues/issues/829 I've been trying to fix it for a while now: https://github.com/processwire/processwire-issues/issues/829 https://github.com/adrianbj/TracyDebugger/issues/35 https://github.com/adrianbj/TracyDebugger/issues/36 https://github.com/adrianbj/TracyDebugger/issues/58 But unfortunately it still doesn't work properly in some scenarios. Could you describe your situation and maybe we can get Ryan involved again to see if he has any ideas or changes he could make to the PW core to prevent this.
-
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
@ryan - Ok, I tracked that error down. Uninstalling the module is what triggered that. It turns out that during the uninstall, if I dump $change from inside this foreach: foreach($changes as $key => $change) { I get: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'page_autosave_changes' doesn't exist But back to the more important issue of why the module doesn't actually work for me. Firstly, the module does work on my local dev environment, but on a live servers, it doesn't. I still keep getting: "ajax error: error" If I inspect the Network tab, I see a 500 error for: /page/edit/?id=8074&modified=1636913850&fields=body but there don't seem to be any PHP errors, so I went looking in the apache logs and I am seeing these: [Sun Nov 14 09:54:27.525633 2021] [proxy_fcgi:error] [pid 24560:tid 139854520305408] (70007)The timeout specified has expired: [client 154.5.162.190:51384] AH01075: Error dispatching request to : (polling), referer: /?live_preview=1 [Sun Nov 14 09:54:34.477785 2021] [proxy_fcgi:error] [pid 24560:tid 139854579054336] [client 154.5.162.190:51384] malformed header from script 'index.php': Bad header: {"error":false,"message":"Ajax, referer: /page/edit/?id=8074 [Sun Nov 14 09:54:34.477904 2021] [proxy_fcgi:error] [pid 24560:tid 139854579054336] [client 154.5.162.190:51384] AH01070: Error parsing script headers, referer: /page/edit/?id=8074 [Sun Nov 14 09:54:34.477913 2021] [proxy_fcgi:error] [pid 24560:tid 139854579054336] (22)Invalid argument: [client 154.5.162.190:51384] AH01075: Error dispatching request to : , referer: /page/edit/?id=8074 The Network tab shows Response Headers: content-length: 0 I did a a little investigating to see if there are any known issues with SSE and these errors, but nothing useful so far. -
Can't get DebugBar to appear in pw-3.0.184-master
adrian replied to hellomoto's topic in Tracy Debugger
@hellomoto - not really sure where to start to be honest. 1) Is it specific to one site, or all your sites running 3.0.184? 2) Was it working on the same site before you upgraded to that PW core version? If so, what version was the site running before? -
How to debug as guest on a trusted non-localhost (remote server)
adrian replied to Ivan Gretsky's topic in Tracy Debugger
-
How to debug as guest on a trusted non-localhost (remote server)
adrian replied to Ivan Gretsky's topic in Tracy Debugger
All of Tracy's config settings are available to be modified in the config.php file. Just right click on a setting's input field and "Inspect". Remove the "Inputfield_" prefix from the id and use that. Yeah, probably a good idea. It's kinda ugly, but what about: The bar would be colored like this whenever that forceIsLocal option is set to true. Alternately, we could go with a border, eg: -
How to debug as guest on a trusted non-localhost (remote server)
adrian replied to Ivan Gretsky's topic in Tracy Debugger
Hi @Ivan Gretsky - I am sorry about the delay on this and it's actually pretty stupid really because @teppo already came up with what seems to be a great solution: https://github.com/adrianbj/TracyDebugger/issues/56 I have implemented this in the latest version, so all you need to do is add this to your config.php file: $config->tracy = [ 'guestForceDevelopmentLocal' => true, 'forceIsLocal' => true, ]; Keep in mind that the "guestForceDevelopmentLocal" isn't necessary if you already have that checked in the module settings. @Robin S - does this approach also work for your needs (that you PM'd me about ages ago)? Obviously we need to be really cautious with this new option to make sure it isn't used on a live site that is accessible to the world! -
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
@Jonathan Lahijani - speedy work on the video :) I've been thinking of doing a very similar thing with RM and Uikit to create a lot more flexibility that what I have been currently offering. I do think that with a minimal amount of training some clients will be able to do great things, but for other clients I think I would stick with more strictly defined block types. I think it comes down to a combination of what works best for the site's layout requirements and the skills of the client. Great to hear that you are planning on releasing what you've built here, because I know you've put a lot of thought into this and I am sure there's a fair bit of effort in getting everything configured so nicely! -
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
I am getting an ajax error: error and it seems to be coming from this exception: TypeError: Cannot access offset of type string on string in /site/modules/PageAutosave/PageAutosaveLivePreview.php:180 -
Unfortunately, I was a long way off and abandoned my attempts, so don't have anything to share at the moment. I'll need to take another look at some point.
-
Padloper 2: Alpha/Early Beta Testers Wanted
adrian replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
Yes please @kongondo - I have a need for a store right now, so definitely keen to put this through its paces. -
Agreed - I found that interface quite effective as well.
-
I think I am scarred for life from my time battling that module. Thank you for taking this on - it will be a very welcome addition. A few initial thoughts: rlavin/php-rrule is very useful - I ended up using it to parse some info from the output of that module If you make use of momentjs, please ensure you use the version with timezone support - the lack of this was a huge part of the issues I was having and the module relied on an old version which made upgrading and switching to the timezone version quite difficult Please follow the rrule spec properly - the way it was implement did not follow the standard (I don't recall the exact problem, but a read through my comments should help you find it) so it resulted in errors when using php-rrule and other means of parsing it. Really focus on getting the API methods for querying events by date working properly and performantly - it was a nightmare in the other module. PS - I know I am coming across harshly regarding the old module. I don't want to sound unappreciative of the work that was put into it because recurring dates really are a difficult thing to do well and I have produced my own fair share of poor stuff and I am not saying I could have done any better. Best of luck with it and let me know if you have any other questions.