Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes C14N, PDO.PgSQL, chr() #1066

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/dummy/dummy.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageReference Include="Peachpie.AspNetCore.Web" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.AspNetCore.Mvc" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.PDO" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.PDO.PgSQL" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.PDO.MySQL" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.PDO.SqlSrv" Version="$(PeachpieVersion)" PrivateAssets="Build" />
<PackageReference Include="Peachpie.Library.PDO.Sqlite" Version="$(PeachpieVersion)" PrivateAssets="Build" />
Expand Down
2 changes: 1 addition & 1 deletion build/update-cache.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $defaultArgs = "/p:VersionPrefix=$version,VersionSuffix=$suffix"

## Delete old nuget packages
Write-Host -f green "Deleting '$version-$suffix' packages from '$packagesSource' ..."
@("Peachpie.Runtime", "Peachpie.Library", "Peachpie.Library.Scripting", "Peachpie.Library.MySql", "Peachpie.Library.MsSql", "Peachpie.Library.Graphics", "Peachpie.Library.Network", "Peachpie.Library.PDO", "Peachpie.Library.XmlDom", "Peachpie.App", "Peachpie.CodeAnalysis", "Peachpie.AspNetCore.Web", "Peachpie.RequestHandler", "Peachpie.AspNetCore.Mvc", "Peachpie.NET.Sdk", "Peachpie.Library.PDO.MySql", "Peachpie.Library.PDO.Sqlite", "Peachpie.Library.SqlSrv") | % {
@("Peachpie.Runtime", "Peachpie.Library", "Peachpie.Library.Scripting", "Peachpie.Library.MySql", "Peachpie.Library.MsSql", "Peachpie.Library.Graphics", "Peachpie.Library.Network", "Peachpie.Library.PDO", "Peachpie.Library.XmlDom", "Peachpie.App", "Peachpie.CodeAnalysis", "Peachpie.AspNetCore.Web", "Peachpie.RequestHandler", "Peachpie.AspNetCore.Mvc", "Peachpie.NET.Sdk", "Peachpie.Library.PDO.PgSQL", "Peachpie.Library.PDO.MySql", "Peachpie.Library.PDO.Sqlite", "Peachpie.Library.SqlSrv") | % {
$installedFolder = "$packagesSource/$_/$version-$suffix"
if (Test-Path $installedFolder) {
Remove-Item -Recurse -Force $installedFolder
Expand Down
18 changes: 14 additions & 4 deletions src/Peachpie.Library.XmlDom/DOMNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;
using Pchp.Core;
Expand Down Expand Up @@ -631,11 +633,19 @@ public PhpString C14N(
PhpArray xpath = null,
PhpArray ns_prefixes = null)
{
var transform = new System.Security.Cryptography.Xml.XmlDsigC14NTransform();
transform.LoadInput(XmlNode.GetXmlDocument());
var stream = (System.IO.MemoryStream)transform.GetOutput(typeof(System.IO.Stream));
XmlNodeReader reader = new XmlNodeReader(XmlNode);
Stream inputStream = new MemoryStream();
XmlWriter writer = new XmlTextWriter(inputStream, Encoding.UTF8);

return new PhpString(stream.ToArray());
writer.WriteNode(reader, false);
writer.Flush();

inputStream.Position = 0;
XmlDsigC14NTransform transform = new XmlDsigC14NTransform();
transform.LoadInput(inputStream);

System.IO.MemoryStream outputStream = (System.IO.MemoryStream)transform.GetOutput(typeof(System.IO.Stream));
return new PhpString(outputStream.ToArray());
}

/// <summary>
Expand Down
9 changes: 7 additions & 2 deletions src/Peachpie.Runtime/Operators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2411,8 +2411,13 @@ public static PhpValue Eval(Context ctx, PhpArray locals, object @this, RuntimeT
},
code);

//
return script.Evaluate(ctx, locals, @this, self);
try {
return script.Evaluate(ctx, locals, @this, self);

} catch (Pchp.Core.PhpFatalErrorException e) {
PhpException.Throw(PhpError.Warning, e.Message);
return false;
}
}

#endregion
Expand Down