by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
John Carruthers
@DevJohnC_twitter
Oh I got it figured out, for some reason Microsoft's Ubuntu image doesn't have timezone data
Christopher Pereira
@kripper
cool!
Does Zend's PHP give the same list on Linux and Windows?
https://github.com/php/php-src/ is a good reference too
it's Peachpie's bible
John Carruthers
@DevJohnC_twitter
I have no idea what PHP returns on either platform; I'm not eager to attempt it, I have no PHP env these days \o/
I just noticed that PeachPie's src pairs it's own TZ definitions to those provided by the TimeZoneInfo API and went hunting; I found github issues about Microsoft's images missing timezone data
Christopher Pereira
@kripper
@jakubmisek Do I need to change the config to create a Peachpie nuget with debug symbols to be able to debug Peachpie from my app?
or just disable "Just My Code"?
btw, I'm using VSCode
Christopher Pereira
@kripper
Debugger works awesome. I just added:
"enableStepFiltering": false,
"requireExactSource": false
MutableStringBlob.ToString() is corrupting the latin encoded string
Christopher Pereira
@kripper
found this line: public override string ToString() => ToString(Encoding.UTF8);
Christopher Pereira
@kripper
This code is converting chr(225) and chr(226) to 65533 (the utf-8 replacement character)
"most caracter encodings do not map every possible byte
values to a displayable caracter. Have a look at the ASCII encoding table
for example and you'll see that many byte values do not map to any caracter
at all or map to non-displayable caracters such as \0, TAB or BEEP. So you
need to use a caracter encoding that can map every possible byte value to a
displayable caracter. Fortuanately, there is one and it's called Base 64.
Have a look at Convert.ToBase64String()."
Christopher Pereira
@kripper
DebugString() is fixing the binary bytes to something like "\xe1" (not throwing them away)
Christopher Pereira
@kripper
What would be the correct solution? Add a flag to IntStringKey to support binary keys? or use some other encoding that supports binary chars?
John Carruthers
@DevJohnC_twitter
/wp-admin/admin-ajax.php seems to have some odd behavior, I have C# code that accesses some declared statics in a WP hook that throws very strange exceptions (NREs and other such things) only on AJAX requests
I fixed that by using instances creating in scope with new instead of statics, but now my wpdb extension classes is getting invalid SQL strings (truncated) in the same scenario
John Carruthers
@DevJohnC_twitter
I'm super really unsure what to make of that, at all :/
John Carruthers
@DevJohnC_twitter
some sort of memory corruption in AJAX requests?
Jakub Míšek
@jakubmisek
@DevJohnC_twitter I'm not sure what you're doing :) maybe if you post the exception with stack trace, or steps to reproduce, we can try it
John Carruthers
@DevJohnC_twitter
@jakubmisek the truncated SQL string is what I'll really look for, the other error I think is just thread unsafe code; the truncated SQL is a weird thing, I changed my code around to instantiate my class from db.php and it either fixed the issue or WordPress stopped executing the problematic SQL statement
@jakubmisek if it shows up again in testing I'll collect enough info for a bug report :P
Jakub Míšek
@jakubmisek
thanks @DevJohnC_twitter , if you'd have any steps we can try, it would be great :)
Neil Mascarenhas
@mascarenhasneil
Hello,
I am an armature .net developer/student. I make small scale websites to fund my education. One of my clients' requirements was to have a website for himself in .net core, he has no knowledge of .net or HTML so I decided to make it in WordPress as it requires no to very little knowledge of web development.
Earlier this month I came across peachpie and was stunt just by imagining the limitless possibilities. I have forked peachpie and WpDotNet from Github and was able to run WordPress on it. But as I went on adding the plugins I got into errors.
I needed help with documentation and how to go about migrating WordPress to this environment and PHP error solutions. Where will I find help?
Another thing I would like to know which one is better for WordPress and what is the difference between PeachPie and WpNotNet.
Moreover, when can we expect Peachpie 1.0 to be out? Can't wait to try it out!
John Carruthers
@DevJohnC_twitter
peachpie is a compiler and runtime for .NET core that will compile and execute PHP code on the .NET core platform
WpDotNet is a very early stage SDK for developing WordPress sites using PeachPie
Benjamin Fistein
@bfistein
@DevJohnC_twitter early stage hurts :D it's not super untrue, but it's not as alpha as it used to be :)
@mascarenhasneil adding plugins can't be done in the conventional way, because they have to be compiled along with the core of WordPress. If you use our WordPress on .NET, however, all the plugins that appear in the dashboard can be installed right from the dashboard, as they are actually already compiled and installed in the background. You won't be able to find all plugins in the catalog though, only the ones we added.
Benjamin Fistein
@bfistein
Frankly, for a simple website, I'm not totally sure why you'd use WpDotNet (which as John said is simply WordPress running on .NET via PeachPie). It seems like a little bit of an overkill, but we're super happy you're trying it out :) it just may be a little unnecessarily complicated if all you need is a website for a small client.
John Carruthers
@DevJohnC_twitter
@bfistein sorry friend :( I did use WpDotNet as a reference for what I'm doing with WP in PeachPie though :thumbsup:
John Carruthers
@DevJohnC_twitter
just gonna throw this out there incase anybody knows about it: our blogging service, after running for a few days, started throwing "undefined function" exceptions for WordPress core functions, despite running for a few days just fine
the service got restarted, I'm waiting for it to happen again to get a more complete view of things, but if anybody has seen this before/knows of a fix please let me know
John Carruthers
@DevJohnC_twitter
somebody suggested yesterday that maybe the undefined function exceptions are from Wordpress attempting a background update, so I set all the constants that should prevent that from occuring
Benjamin Fistein
@bfistein
any results so far?
John Carruthers
@DevJohnC_twitter
so far I think I've learned 4 things:
  1. don't use any async code, you'll exhaust your threadpool eventually, there's no 100% safe way to wait on async in a sync context
  2. define all the constants that stop wordpress from trying to background update
  3. when using Microsoft's docker images as a base be sure to install timezone data
  4. if you instantiate an instance of a class exposed as a [PhpType] from C# and pass it back to PHP it's use is unstable
Jakub Míšek
@jakubmisek
@DevJohnC_twitter
  1. should not be true, but it is more related to .NET itself and how you use your async methods. If done correctly the result is exactly the opposite - you'd need fewer threads.
  2. do you have a list of those constants? we will add them to wpdotnet by default
  3. timezone data are missing just on Linux images, right? Although we should be able to add them even on Linux, please file an issue on https://github.com/peachpiecompiler/peachpie/issues that timezone_identifiers_list (or something else?) does not return your expected timezones.
  4. instantiating PHP class from within C# should work fine, do you have an example of this unstable behavior? It is important to pass current Context object to its constructor which might be confusing.
John Carruthers
@DevJohnC_twitter
  1. is definitely true, it's not a peachpie issue, it's a .net issue, even MS don't have a method that works 100% of the time
  2. the constants are documented here: https://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7/
  3. it's not really a peachpie issue, is it?
  4. I didn't have access to Context in the scope of what I was doing, the requirement seems a bit odd
Jakub Míšek
@jakubmisek
3 . should be defined in OS; however PHP itself has database of all timezones so PeachPie should be able to provide them as well ...
4 . Context is an odd thing; however internally PHP is bound to a request, and a lot of functionality depends on it. So objects need to know the Context which is like the request owning the object. If not provided, a default Context for current Async-Local is used. This behavior can be customized tho
Paul Anderson
@eggsarebad_twitter
PeachPied.WordPress - Does anyone else get this error: "Package '{name of them}' has multiple package types, which is not supported."? I get this error when I try adding a newly built & packed theme. The SDK "1.0.0-beta992" below matches my installed "PeachPied.WordPress.AspNetCore" nuget. Any thoughts?<Project Sdk="PeachPied.WordPress.Build.Plugin/1.0.0-beta992"> <PropertyGroup> <WpContentTarget>themes</WpContentTarget> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> </Project>
Jakub Míšek
@jakubmisek
@eggsarebad_twitter thanks for the message - honestly it is a bug, but it should have been fixed since 1.0.0-beta992. What are the exact steps to reproduce this?
Paul Anderson
@eggsarebad_twitter

@jakubmisek It started working after a machine reboot. Thanks!
`dotnet new mvc -au None
dotnet add package PeachPied.WordPress.AspNetCore -v 1.0.0-beta992

$theme = "nisarg"
$themeVersion = "1.2.9"
$url = "https://downloads.wordpress.org/theme/$theme.$themeVersion.zip"
$zip = "$PSScriptRoot\$theme.$themeVersion.zip"
$target = "$PSScriptRoot\Themes"
$msbuildpath = "$PSScriptRoot\Themes\$theme"
$localNugetDir = "C:\Projects\local\nugets"

(New-Object System.Net.WebClient).DownloadFile($url, $zip)
Expand-Archive -Path $zip -DestinationPath $target

$xml = '<Project Sdk="PeachPied.WordPress.Build.Plugin/1.0.0-beta992"><PropertyGroup><WpContentTarget>themes</WpContentTarget><TargetFramework>netcoreapp3.1</TargetFramework></PropertyGroup></Project>'
New-Item -Path $msbuildpath -Name "nisarg.msbuildproj" -ItemType "file" -Value $xml
cd $msbuildpath
dotnet build
dotnet pack
cd ..
cd ..

Move-Item -Path "$msbuildpath\bin\debug\$theme.$themeVersion.nupkg" -Destination "$localNugetDir\$theme.$themeVersion.nupkg"`

Paul Anderson
@eggsarebad_twitter
@jakubmisek Sorry, one more question. Do you know if PeachPied.WordPress Admin supports extra page template files? E.g.<?php /* Template Name: Example Template */ ?>? Extra variations of a page template. They don't seem to appear in the WP admin / Edit Page / Page Attributes Section. Any thoughts?
Jakub Míšek
@jakubmisek
@eggsarebad_twitter I'll have to try that script. There are a few things that can be simplified; like instead of moving the .nupkg file, you can specify <PackageOutputPath>local/nuget/path</PackageOutputPath> or you don't have to call dotnet build, just dotnet pack is sufficient
@eggsarebad_twitter PeachPie, by design, does not allow additional script files to be added once the project is compiled and deployed. So extra pages, added or modified after the program is running, are currently not allowed. It is however a planned feature.
@eggsarebad_twitter note some of the themes and plugins (about 2000+ of them) are already available on NuGet feed https://feed.peachpie.io/wpdotnet/v3/index.json (more at https://docs.peachpie.io/scenarios/wordpress/add-plugin-theme/)
Paul Anderson
@eggsarebad_twitter

@jakubmisek, Sorry, I should have clarified my question :) I fully understand that no changes to the theme/templates can be made after it’s been compiled. Everything has to be compiled. I 100% agree/understand.

I defined 5 custom templates pages (variation of the original page.php) within my theme before the theme was compiled. These pages all have the standard WordPress comment header <?php / Template Name: Example Template / ?>. Each with a different template name. However, these pages aren’t appearing in the WP admin / Edit Page / Page Attributes Section after the theme has been compiled, referenced, and activated. Everything else about the theme appears to work including the original page.php.

I’ve inspected the compiled nuget using JetBrains dotPeek, and I see all the pages listed in the compiled assembly including the extra template pages I defined. Is this a known issue or bug, or is there another process for defining extra page templates within a theme for PeachPied.WordPress? Thanks