Closed gordon-matt closed 6 years ago
There are no estimations yet.
Do you have a set of functions+constants you would suggest to implement first? Any list of opensource frameworks that require this?
Thanks for the response. I was in contact with Robert Husak via email in March this year. I have pasted the email and response for you below, so you have a full understanding of why I need the cURL library implemented:
Initial Email:
Hi there,
I’m not certain if you’re the right guy to be emailing about this. If not, please help me forward it to whomever this concerns.
I've been using Phalanger for a while now for integrating a PHP file manager (Responsive File Manager) in MVC5. I wrote an article about it on CodeProject: Using Responsive File Manager in ASP.NET MVC
I am moving to .NET Core now and it seems PeachPie is the way to go. However, I can't seem to figure out how to get both PHP and C# working together the way I want, in the same assembly. Mostly because changing the “compilerName” in the project.json means only compiling either C# or PHP, but not both. Perhaps it is required to be a separate assembly? I’m not sure how I would integrate the file manager in that case. It worked beautifully in Phalanger and I hope it will be possible in PeachPie as well.
Would you be so kind as to write a blog post on how to achieve this with PeachPie? My full source code (very small, simple example) can be found as a download at the aforementioned article.
Thanks in advance.
Matt
Response:
Hi Matt,
Thank you for the article, I'm glad to see that Phalanger has fulfilled its purpose there. Peachpie, as its successor, is surely the way to go for the future. However, it is still not completed as of now, we need some time to make it generally usable. You can check our roadmap to see the currently implemented and planned features.
The blog post is a great idea - it would be a real life example of using PHP from .NET Core MVC. We'll write it as soon as we are able to make the file manager work under Peachpie. For example, the used cURL library hasn't been implemented yet and I also encountered some assembly loading problems when trying to include it into a .NET Core MVC application. Unfortunately, I can't say when these obstacles will be overcome. Currently, we're putting our effort mainly into running WordPress on .NET Core.
You are correct - when combining PHP and C#, they can't be in the same assembly, because two different compilers are used. Nevertheless, PHP file handling in a .NET Core website can be smoothly implemented by referencing the PHP assembly and adding app.UsePhp(); to the Startup.Configure() method. Take a look at the blog post about running Wordpress on .NET Core to see the exact usage.
This static approach (compiling PHP into .NET assembly and referencing it) is the only one currently supported in Peachpie. We encourage it, because it makes the code more secure (an attacker can't upload a PHP file to the website and execute it) and the compiler can better optimize the resulting CIL (e.g. thanks to its sophisticated type analysis). The dynamic approach such as the one that Phalanger takes in your code (the PHP files are in fact assets in the C# project and Phalanger compiles them during runtime) will be supported too, but probably further in the future because of its complexity.
I'm sending a copy of this response to my colleagues in case they have anything to add or correct any of my statements. If you have any other questions, please ask me either again via e-mail or meet us on Gitter. Thanks for the idea of the blog post, I'll let you know once it's written.
Cheers,
Robert
I have a custom CMS, which has been built up over the last few years. I have now almost fully moved to .NET Core and I plan to make it fully open source. The only 2 things I am waiting for are as follows:
Hope this helps explain.
Nice! I can see just few usages of cURL
within the responsive file manager: https://github.com/trippo/ResponsiveFilemanager/search?utf8=%E2%9C%93&q=curl&type=
Those can be implemented soon, I'll keep you informed in this thread.
Additionally the library will require some image
functions (which are now built on top of ImageSharp library instead of System.Drawing)
@gordon-matt also I'm subsequently merging your old PR .. thank for that
Fantastic. Really looking forward to this, thanks!
Hey Jakub,
I'd like to vote this this feature as well. I'm trying to get elFinder working in .net and it uses curl. Here are the functions calls I see:
https://github.com/Studio-42/elFinder/search?utf8=%E2%9C%93&q=curl&type=
Thanks!
@fsmirne Perhaps you might be interested in my existing project: elFinder.NetCore
@gordon-matt: It looks very cool. I checked it out. What I ideally wanted to do is to use the php backend untouched or with minimal changes i.e. removing the imagemagick dependency and then creating some layers on top of it in C#. I have coded an AzureStorage connector in c# that I'm using for my project and I'd love to make it use the php backend if possible. It's a very interesting project for sure.
@fsmirne: I see. Well, let's hope the guys behind PeachPie are able to implement the cURL library soon. I have high hopes for this project - I see the possibility of integrating all kinds of PHP stuff in .NET Core, not least of which are PHP file managers.
@jakubmisek: Any update on this? An estimate on when you can start looking at this would be great, but I know you guys are very busy, so don't feel pressured.
@gordon-matt this is definitely one of the top priority since most of PHP frameworks rely on it. It is just a little bit scary since it means to implement libcurl from scratch in C#. (which is much easier than in C)
@gordon-matt Once cURL is supported, let's collaborate and try to get ELFinder and responsive file manager working. I don't have a lot of experience with RFM, but I've used ELFinder quite a bit and even wrote a .NET version of the backend for my own consumption.
@fsmirne: Sure, no problem. For now, regarding the .NET version of elFinder, feel free to review mine and if you have any improvements you'd like to make, just fork it and create a pull request.
@jakubmisek: Thanks for the update. Implementing cURL does look like it's going to be a very big job, but I am glad to hear that it is a top priority. Could I just ask if you have any rough estimate for how long until we see that is done? 3 months? 6 months? More? Less?
cURL with HTTP(s) would not be that long (few days maybe). But I see elFinder uses sockets which are not implemented as well.
Thanks for the response. I am a lot more interested in Responsive File Manager, because we can already use elFinder with a connector (backend), of which I already created one for .NET Core (even if it's not 100% functional yet). We can't do that with RFM. I'm really excited to hear cURL will be ready so soon. Will you still be making a blog post about this? I think showing this use case for PeachPie would be very good - It's not only useful to me and my customers, but I think it can attract more people to this project as well.
so there is an initial implementation of cURL in supporting HTTP/HTTPS protocols https://github.com/peachpiecompiler/peachpie/tree/master/src/Peachpie.Library.Network
You have to add package reference to Peachpie.Library.Network
version 0.9.0-*
within your php project.
The package is not published yet on NuGet.org, it is only in the peachpie feed https://www.myget.org/F/peachpie/api/v3/index.json
Excellent! However, I'm going to need a little help, as I am confused on how to start. I tried looking at your sample apps, but kept getting errors on opening the .sln files. I opened an issue here: Peachpie Samples Issue 3
@jakubmisek I got all the cURL errors to go away. I do see that there's way more functions the ELFinder is using. i.e. getimagesize, get_headers, mb_detect_encoding, etc. I see that you have started some work on Peachpie.Library.Graphics, but that doesn't seem complete, so even adding that dependency, I wasn't able to move further...
@gordon-matt I get everything working by following the steps @ https://www.peachpie.io/getstarted Do that and then just add all the ELFinder php files to the project and compile. I'm using Visual Studio 2017 if that matters.
Maybe I should give up on trying to get ELFinder working for now and try to get https://github.com/gordon-matt/elFinder.NetCore improved. It's a pity because ELFinder comes with all sorts of connectors and I feel like we will be reinventing the wheel by going that route...
In any case, thanks all for your hard work!
Thanks guys. I followed the Get Started steps and then copied all the relevant files over and at first, I couldn't get the JS and CSS files working (always 404) - then I figured out I needed to change the content root path, which I did as follows:
var root = Path.GetDirectoryName(Directory.GetCurrentDirectory()) + "/Website";
var host = new WebHostBuilder()
.UseKestrel()
.UseWebRoot(root)
.UseContentRoot(root)
.UseUrls("http://*:5004/")
.UseStartup<Startup>()
.Build();
So that's working fine - I can see the file manager up and running. However, when I try to upload a file I get an error and when I try to navigate to a folder I created, I also get an error there too. I have uploaded the project I am working on to here: peachpie-responsive-file-manager.
Just build it, run it and browse to: http://localhost:5004/filemanager/dialog.php
.
Would appreciate any help you could give with the above issues and also, I would need to know how to run this in an MVC app instead of as a separate process with its own port. I did see the following: https://github.com/peachpiecompiler/peachpie/wiki/Getting-Started#e-aspnet-website. I guess I will need to give that a try, right? Thanks!
UPDATE: I also just realized that I haven't yet added a reference to Peachpie.Library.Network
. When I tried to do so, I got this error: The operation failed as details for project Website could not be loaded.
@fsmirne good, definitely add Peachpie.Library.Graphics
as well and create new issue for Graphics features please.
Just had the chance to look at this again. Following up on my previous comments, I have now installed Peachpie.Library.Network
and one of the problems that I was having (error when uploading file) has had some progress, but not yet solved. The error that was happening was something like, "Could not find a part of the path...". I changed the config.php file to use an absolute path instead of a relative path for the uploads folder (not ideal, but it will do for now) and I don't get that error anymore, but instead a new error happens, which is: "The GD Library is not installed.", which is a message from the file manager itself and not Peachpie.. I went ahead and installed Peachpie.Library.Graphics
, assuming that is what I need and now I can't build the project due to a new error, which is: "error NU1101: Unable to find package ImageSharp.Drawing. No packages exist with this id...". I looked at your Nuget feed and I can see a 'Loop.SixLabors.ImageSharp.Drawing'. It's not exactly the same package ID, so guessing it won't work.
One more thing I forgot to mention is another error which comes up sometimes and that is the following: System.NotImplementedException: 'Pchp.Core.PhpString'.
@gordon-matt do you have stack trace of the NotImplementedException
exception?
@jakubmisek Yes, sure. Here you go:
at Pchp.Core.Dynamic.ConvertExpression.BindToLong(Expression expr)
at Pchp.Core.Dynamic.ConvertExpression.Bind(Expression arg, Type target, Expression ctx)
at Pchp.Core.Dynamic.BinderHelpers.BindToCall(Expression instance, MethodBase method, Expression ctx, ArgumentsBinder args, PhpTypeInfo lateStaticType)
at Pchp.Core.Dynamic.OverloadBinder.BindOverloadCall(Type treturn, Expression target, MethodBase[]& methods, Expression ctx, ArgumentsBinder args, PhpTypeInfo lateStaticType)
at Pchp.Core.Dynamic.OverloadBinder.BindOverloadCall(Type treturn, Expression target, MethodBase[] methods, Expression ctx, Expression[] args, PhpTypeInfo lateStaticType)
at Pchp.Core.Dynamic.CallBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args)
at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)
at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at <Root>filemanager.dialog_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\dialog.php:line 743
at <Root>filemanager.dialog_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Peachpie.Web.RequestContextCore.ProcessScript(ScriptInfo script)
at Peachpie.Web.PhpHandlerMiddleware.<>c__DisplayClass6_0.<Invoke>b__0()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
Also, would you please help me out with the other issues when you have some free time? Thanks in advance.
@gordon-matt you need references to both Peachpie.Library.Graphics
and Peachpie.Library.Network
, and successfully run dotnet restore
.
In order to get Graphics
being restored I guess you have to add NuGet feed https://www.myget.org/F/imagesharp/api/v3/index.json
into your Nuget.config (see our sample one)
Thanks @jakubmisek , but as already stated, I did successfully reference and restore Peachpie.Library.Network
and as for Peachpie.Library.Graphics
, I ran dotnet restore
on that as well, but it threw the error regarding ImageSharp.Drawing that won't go away. Perhaps you could clone my repo and take a look? It's all there.. peachpie-responsive-file-manager. Just run it and browse to http://localhost:5004/filemanager/dialog.php.
NOTE: You will need to change 2 paths in this file: \Website\filemanager\config\config.php. As stated above, relative paths aren't working for some reason, so change the following 2 parameters to absolute paths: current_path and thumbs_base_path. In my case:
'current_path' => 'D:\\Source\\GitHub\\peachpie-responsive-file-manager\\Website\\Media\\Uploads\\',
'thumbs_base_path' => 'D:\\Source\\GitHub\\peachpie-responsive-file-manager\\Website\\Media\\Thumbs\\',
@gordon-matt error NU1101
is a nuget restore error, you have to add NuGet feed https://www.myget.org/F/imagesharp/api/v3/index.json
prior building the repo.
@jakubmisek Thanks. Unfortunately it's still not working. Not sure if I have the correct configuration, but my Website.msbuildproj has the following references:
<ItemGroup>
<DotNetCliToolReference Include="Peachpie.Compiler.Tools" Version="0.9.0-*" />
<PackageReference Include="Peachpie.NET.Sdk" Version="0.9.0-*" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.Graphics" Version="0.9.0-*" />
<PackageReference Include="Peachpie.Library.Network" Version="0.9.0-*" />
<PackageReference Include="ImageSharp" Version="1.0.0-alpha9-*" />
<PackageReference Include="ImageSharp.Drawing" Version="1.0.0-alpha9-*" />
</ItemGroup>
Now running dotnet restore
gives me the following error:
The command "dotnet compile-php @obj\Debug\netstandard2.0\compile-php-args.rsp" exited with code -532462766
and there's another code in the error list, which is: MSB3073
@gordon-matt you do not need <PackageReference Include="ImageSharp***
, but you have to add NuGet feed https://www.myget.org/F/imagesharp/api/v3/index.json into Nuget.Config
before building
@jakubmisek Well, originally I did that exactly.. I didn't add the package reference.. and only added the NuGet feed, same as the Peachpie feed. Got that error... then that's when I tried adding the reference and no difference. edit: in general if you get errors during the build, you don't have to bother with running the binaries
@gordon-matt just noting; it is just a NuGet thing not much related to cURL. We use following NuGet.config
file which works fine for our samples https://github.com/iolevel/peachpie-samples/blob/master/NuGet.Config
FYI - To make sure, I just did the following:
<PackageReference Include="ImageSharp***
entriesbin
and obj
folders from both Server and Website projects.dotnet restore
againSame error message.
And here's my NuGet.Config for your info:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="DevExtreme Local" value="D:\Source\_Nuget\DevExtreme" />
<add key="MyGet - OData" value="https://www.myget.org/F/webapinetcore/" />
<add key="MyGet - Peachpie" value="https://www.myget.org/F/peachpie/api/v3/index.json" />
<add key="MyGet - ImageSharp" value="https://www.myget.org/F/imagesharp/api/v3/index.json" />
</packageSources>
</configuration>
NOTE: While writing the above message I noticed you posted your NuGet.config, so I changed mine to the following:
<configuration>
<packageSources>
<add key="myget.org dotnet-coreclr" value="https://www.myget.org/F/dotnet-coreclr/api/v3/index.json" />
<add key="myget.org dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="myget.org dotnet-corefxtestdata" value="https://www.myget.org/F/dotnet-corefxtestdata/api/v3/index.json" />
<add key="myget.org dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="myget.org devsense" value="https://www.myget.org/F/devsense/api/v3/index.json" />
<add key="myget.org peachpie" value="https://www.myget.org/F/peachpie/api/v3/index.json" />
<add key="ImageSharp Nightly" value="https://www.myget.org/F/imagesharp/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="DevExtreme Local" value="D:\Source\_Nuget\DevExtreme" />
<add key="myget.org webapinetcore" value="https://www.myget.org/F/webapinetcore/" />
</packageSources>
</configuration>
Repeated same steps above of deleting bin
and obj
folders and running dotnet restore
again. No difference.
I understand this is not cURL related. Should I open a new issue?
I also just tried one more time by copying over the entire contents of your NuGet.config and ONLY that (no extra content).. same issue yet again.. and also it makes no difference if I use global NuGet.config in %appdata%\NuGet\NuGet.Config
or a local one for that solution.
If you got stuck on NU1101 error during restore/build, then it is really all about nuget restore and your Nuget.Config
file. Note you don't have to delete obj
or bin
.
Oh I see there's some misunderstanding. Sorry if I wasn't very clear, but in this comment I was trying to say the NU1101 error was gone, but a different error showed up instead (also during build) which is MSB3073. Again, sorry if I wasn't very clear on this.
@gordon-matt I see! excuse my ignorance :)) MSB3073 is a compiler crash and you should see a stack trace somewhere in the output.
Thanks, @jakubmisek. I should have thought about looking at the Output window! Anyway, my StackTrace is as follows:
Error occurred while restoring NuGet packages: The operation failed as details for project Website could not be loaded.
1>------ Build started: Project: Website, Configuration: Debug Any CPU ------
1>PeachPie PHP Compiler version 0.9.0-CI00842
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(574,6): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(432,12): warning PHP3006: Call to undefined function: 'transliterator_transliterate'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(483,3): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(715,3): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(502,3): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(876,5): warning PHP3006: Call to undefined function: 'imageconvolution'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(889,5): warning PHP3006: Call to undefined function: 'imageconvolution'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\utils.php(391,21): warning PHP3008: Class 'DirectoryIterator' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1133,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1155,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1156,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1157,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1158,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1170,13): warning PHP3006: Call to undefined function: 'imagecolorstotal'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1173,14): warning PHP3006: Call to undefined function: 'imagecolorsforindex'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1177,5): warning PHP3006: Call to undefined function: 'imagecolorset'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1206,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1207,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1208,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1220,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1221,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1222,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1223,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1273,3): warning PHP3006: Call to undefined function: 'imageTrueColorToPalette'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1274,16): warning PHP3006: Call to undefined function: 'imageColorsTotal'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1530,3): warning PHP3006: Call to undefined function: 'imagecolortransparent'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1538,3): warning PHP3006: Call to undefined function: 'imagefill'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1541,3): warning PHP3006: Call to undefined function: 'imagefilledellipse'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1057,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1076,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1077,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1078,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1109,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\ajax_calls.php(135,17): warning PHP3008: Class 'ZipArchive' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1661,4): warning PHP3006: Call to undefined function: 'imagepolygon'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1110,4): warning PHP3006: Call to undefined function: 'imagefilter'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1671,4): warning PHP3006: Call to undefined function: 'imagefilledarc'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1672,4): warning PHP3006: Call to undefined function: 'imagefilledarc'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1673,4): warning PHP3006: Call to undefined function: 'imagefilledarc'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1674,4): warning PHP3006: Call to undefined function: 'imagefilledarc'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(2448,11): warning PHP3006: Call to undefined function: 'imageTTFBbox'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\ajax_calls.php(174,15): warning PHP3008: Class 'PharData' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\ajax_calls.php(181,18): warning PHP3008: Class 'PharData' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3025,4): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3165,4): warning PHP3006: Call to undefined function: 'imageinterlace'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3266,7): warning PHP3006: Call to undefined function: 'imagecolorexact'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3383,7): warning PHP3006: Call to undefined function: 'imagefill'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3698,21): warning PHP3008: Class 'PhpPsdReader' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(3475,11): warning PHP3006: Call to undefined function: 'ImageColorsForIndex'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician_custom.php(704,4): warning PHP3012: Unreachable code detected
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\Response.php(315,4): warning PHP3006: Call to undefined function: 'fastcgi_finish_request'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician_custom.php(1455,21): warning PHP3008: Class 'PhpPsdReader' not found
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\uploader\jupload.php(606,8): warning PHP3007: Undefined variable: $classparams
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1278,36): warning PHP3006: Call to undefined function: 'imageColorsForIndex'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1283,4): warning PHP3006: Call to undefined function: 'imageColorSet'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician.php(1459,4): warning PHP3006: Call to undefined function: 'ImageFill'
1>D:\Source\GitHub\peachpie-responsive-file-manager\Website\filemanager\include\php_image_magician_custom.php(1258,11): warning PHP3006: Call to undefined function: 'ImageColorsForIndex'
1>
1>Unhandled Exception: System.InvalidOperationException: Unexpected value 'PhpValue' of type 'Pchp.CodeAnalysis.Symbols.PENamedTypeSymbol+PENamedTypeSymbolNonGeneric'
1> at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitCastToFalse(TypeSymbol stack, Boolean deepcopy)
1> at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitMethodAccess(TypeSymbol stack, MethodSymbol method, BoundAccess access)
1> at Pchp.CodeAnalysis.Semantics.BoundRoutineCall.EmitDirectCall(CodeGenerator cg, ILOpCode opcode, MethodSymbol method, BoundTypeRef staticType)
1> at Pchp.CodeAnalysis.Semantics.BoundRoutineCall.Emit(CodeGenerator cg)
1> at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitSpecialize(BoundExpression expr)
1> at Pchp.CodeAnalysis.Semantics.BoundAssignEx.Emit(CodeGenerator cg)
1> at Pchp.CodeAnalysis.Semantics.BoundExpressionStatement.Emit(CodeGenerator cg)
1> at System.Collections.Generic.List`1.ForEach(Action`1 action)
1> at Pchp.CodeAnalysis.Semantics.Graph.BoundBlock.Emit(CodeGenerator cg)
1> at Pchp.CodeAnalysis.Semantics.Graph.StartBlock.Emit(CodeGenerator cg)
1> at Pchp.CodeAnalysis.CodeGen.CodeGenerator.GenerateScope(BoundBlock block, ScopeType type, Int32 to)
1> at Pchp.CodeAnalysis.Symbols.SourceRoutineSymbol.Generate(CodeGenerator cg)
1> at Pchp.CodeAnalysis.CodeGen.MethodGenerator.GenerateMethodBody(PEModuleBuilder moduleBuilder, MethodSymbol routine, Action`1 builder, VariableSlotAllocator variableSlotAllocatorOpt, DiagnosticBag diagnostics, Boolean emittingPdb)
1> at Pchp.CodeAnalysis.SourceCompiler.EmitMethodBody(SourceRoutineSymbol routine)
1> at Pchp.CodeAnalysis.EnumeratorExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 func)
1> at Pchp.CodeAnalysis.SourceCompiler.EmitMethodBodies()
1> at Pchp.CodeAnalysis.SourceCompiler.CompileSources(PhpCompilation compilation, PEModuleBuilder moduleBuilder, Boolean emittingPdb, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, CancellationToken cancellationToken)
1> at Pchp.CodeAnalysis.PhpCompilation.CompileImpl(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)
1> at Microsoft.CodeAnalysis.Compilation.Compile(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)
1> at Microsoft.CodeAnalysis.Compilation.Emit(EmitStreamProvider peStreamProvider, EmitStreamProvider pdbStreamProvider, EmitStreamProvider xmlDocumentationStreamProvider, EmitStreamProvider win32ResourcesStreamProvider, IEnumerable`1 manifestResources, EmitOptions options, IMethodSymbol debugEntryPoint, CompilationTestData testData, Func`1 getHostDiagnostics, CancellationToken cancellationToken)
1> at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)
1> at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken)
1> at Peachpie.NETCore.Compiler.Tools.Program.Main(String[] args)
1>C:\Users\Matt\.nuget\packages\peachpie.net.sdk\0.9.0-ci00842\build\Peachpie.NET.Core.Sdk.targets(154,5): error MSB3073: The command "dotnet compile-php @obj\Debug\netstandard2.0\compile-php-args.rsp" exited with code -532462766.
1>Done building project "Website.msbuildproj" -- FAILED.
2>------ Build started: Project: Server, Configuration: Debug Any CPU ------
2>CSC : error CS0006: Metadata file 'D:\Source\GitHub\peachpie-responsive-file-manager\Website\bin\Debug\netstandard2.0\ResponsiveFileManager.dll' could not be found
2>Done building project "Server.csproj" -- FAILED.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
So I guess some things are still not implemented yet...?
@gordon-matt Thanks! This error is caused by an inproperly used [return: CastToFalse]
attribute. It cannot be used for methods with return type of PhpValue
Fixed in https://github.com/peachpiecompiler/peachpie/commit/f5dccdb0ae734de68adedff8154042228fd50356
Giving the new curl library a whirl using wordpress I've ran into an error:
System.ObjectDisposedException
HResult=0x80131622
Message=Cannot access a disposed object.
Source=System.Net.Requests
StackTrace:
at System.Net.HttpWebResponse.CheckDisposed()
at System.Net.HttpWebResponse.get_ResponseUri()
at Peachpie.Library.Network.CURLFunctions.curl_getinfo(CURLResource ch, Int32 opt)
at Requests_Transport_cURL.process_response(PhpValue response, PhpValue options) in C:\peachpie\website\wp-includes\Requests\Transport\cURL.php:line 424
at Requests_Transport_cURL.request(PhpValue url, PhpValue headers, PhpValue data, PhpValue options) in C:\peachpie\website\wp-includes\Requests\Transport\cURL.php:line 177
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at Requests.request(Context <ctx>, PhpValue url, PhpValue headers, PhpValue data, PhpValue type, PhpValue options) in C:\peachpie\website\wp-includes\class-requests.php:line 379
at WP_Http.request(PhpValue url, PhpValue args) in C:\peachpie\website\wp-includes\class-http.php:line 370
at WP_Http.post(PhpValue url, PhpValue args) in C:\peachpie\website\wp-includes\class-http.php:line 590
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at <Root>wp-includes.http_php.wp_remote_post(Context <ctx>, PhpValue url, PhpValue args) in C:\peachpie\website\wp-includes\http.php:line 188
at RevSliderLoadBalancer.refresh_server_list(PhpValue force) in C:\peachpie\website\wp-content\plugins\revslider\includes\framework\loadbalancer.class.php:line 64
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at <Root>wp-content/plugins/revslider.revslider_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\wp-content\plugins\revslider\revslider.php:line 91
at <Root>wp-content/plugins/revslider.revslider_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Pchp.Core.Context.Include(String cd, String path, PhpArray locals, Object this, RuntimeTypeHandle self, Boolean once, Boolean throwOnError)
at <Root>.wp-settings_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\wp-settings.php:line 305
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Pchp.Core.Context.Include(String cd, String path, PhpArray locals, Object this, RuntimeTypeHandle self, Boolean once, Boolean throwOnError)
at <Root>.wp-config_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\wp-config.php:line 181
at <Root>.wp-config_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Pchp.Core.Context.Include(String cd, String path, PhpArray locals, Object this, RuntimeTypeHandle self, Boolean once, Boolean throwOnError)
at <Root>.wp-load_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\wp-load.php:line 37
at <Root>.wp-load_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Pchp.Core.Context.Include(String cd, String path, PhpArray locals, Object this, RuntimeTypeHandle self, Boolean once, Boolean throwOnError)
at <Root>.wp-blog-header_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\wp-blog-header.php:line 13
at <Root>.wp-blog-header_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Pchp.Core.Context.Include(String cd, String path, PhpArray locals, Object this, RuntimeTypeHandle self, Boolean once, Boolean throwOnError)
at <Root>.index_php.<Main>(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>) in C:\peachpie\website\index.php:line 17
at <Root>.index_php.<Main>`0(Context <ctx>, PhpArray <locals>, Object this, RuntimeTypeHandle <self>)
at Pchp.Core.Context.ScriptInfo.Evaluate(Context ctx, PhpArray locals, Object this, RuntimeTypeHandle self)
at Peachpie.Web.RequestContextCore.ProcessScript(ScriptInfo script)
at Peachpie.Web.PhpHandlerMiddleware.<>c__DisplayClass6_0.<Invoke>b__0()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
UPDATE: For me, this is all working fine. You can close if if you want or leave it open if @Valks' case is yet to be solved.
Also, if you or Robert are still interested in writing a blog article on Responsive File Manager as an interesting use case for PeachPie (as per what Robert said in the original email), feel free to go ahead.. it's working quite well apart from 1 small issue of the thumbnails not showing on first load.. but I will look into that more in future - it might be an issue with the file manager itself and not PeachPie.
@gordon-matt that's great to hear. It's a really cool use case that definitely deserves a blog post, but I'm not certain we'll have enough time in the coming weeks (Cc @roberthusak just in case).
We'll keep this issue open, because there are still many cURL functions we have yet to implement.
I still have another curl issue with a plugin accessing a remote service. I'll get an error log together in the next day or two highlighting the missing function(s).
Otherwise I'm also almost at the point where I'll be thinking of migrating a site or two live :)
@Valks that's very exciting. Looking forward to seeing them once live. @roberthusak is working on a set of functions for the first wave of cURL
, but we might be able to prioritize some.
Well looking into it there isn't much to go on. It doesn't fail as such. The only information I have is:
cURL error 7: The remote server returned an error: (400) Bad Request. ((unknown URL) [500])
"Is php on my server properly configured to be able to contact https://premium.wpmudev.org/api/dashboard/v2/ with a POST HTTP request via fsockopen or CURL?"
Is it maybe POST support isn't implemented?
@Valks POST
is supported. Protocols http
and https
.
@Valks 7
= CURLE_COULDNT_CONNECT
. It seams it just cannot connect or the server returned a server error (500
). The text The remote server returned an error: (400) Bad Request. ((unknown URL) [500])
is actually passed from underlaying .NET connection, so it is everything we can tell about the connection error.
Closing as resolved. If there would be anything else, please open new issue.
Hi there,
Just wondering on whether you have an estimate for implementation of cURL yet.