diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-02-06 15:02:12 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-02-06 15:02:12 +0100 |
commit | e1a46de9385a0b37dfe41abb8bedbe392b1b429b (patch) | |
tree | d58d0d0e0919a832accfdde685052537f58c57c8 | |
parent | b53445422afcc9b55f03161f56e91193e1287d1a (diff) | |
parent | 0d49cf4ed25e406f00abefca0e2e3e8fd919bf94 (diff) | |
download | php-git-e1a46de9385a0b37dfe41abb8bedbe392b1b429b.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
-rw-r--r-- | ext/com_dotnet/com_persist.c | 2 | ||||
-rw-r--r-- | ext/com_dotnet/tests/bug66322.phpt | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 521f67f121..656215dd1a 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -394,7 +394,7 @@ CPH_METHOD(SaveToFile) RETURN_FALSE; } - olefilename = php_com_string_to_olestring(filename, strlen(fullpath), helper->codepage); + olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage); efree(fullpath); } res = IPersistFile_Save(helper->ipf, olefilename, remember); diff --git a/ext/com_dotnet/tests/bug66322.phpt b/ext/com_dotnet/tests/bug66322.phpt new file mode 100644 index 0000000000..de37e4fa75 --- /dev/null +++ b/ext/com_dotnet/tests/bug66322.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #66322 (COMPersistHelper::SaveToFile can save to wrong location) +--SKIPIF-- +<?php +if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available'); +try { + new COM('Word.Application'); +} catch (com_exception $ex) { + die('skip MS Word not available'); +} +if (getenv("SKIP_SLOW_TESTS")) die('skip slow test'); +?> +--FILE-- +<?php +$w = new COM('Word.Application'); +$doc = $w->Documents->Add(); +$ph = new COMPersistHelper($doc); +$filename = __DIR__ . '\\..\\' . basename(__DIR__) . '\\66322.docx'; +$ph->SaveToFile($filename); +var_dump(file_exists($filename)); +$w->Quit(); +?> +--EXPECT-- +bool(true) |