From: gospodin dot p dot zh at gmail dot com Operating system: Windows PHP version: 5.4.7 Package: COM related Bug Type: Bug Bug description:PHP extension for COM connection
Description: ------------ char* Connect1c77(char* dir, char* username, char* password, bool no_splash_screen){ //Ð´Ð»Ñ Ð½Ð°Ñала иниÑиализиÑÑем COM HRESULT hr = CoInitialize(NULL); if(FAILED(hr)) { return"Ðевозможно иниÑиализиÑоваÑÑ COM!"; return FALSE; } CLSID cls77; hr = CLSIDFromProgID(L"V77M.Application", &cls77); if(FAILED(hr)) { return"ÐеÑеÑÑÑановиÑе 1С ÐÑедпÑиÑÑие!"; CoUninitialize(); return FALSE; } IDispatch *pv77; hr = CoCreateInstance(cls77, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void**)&pv77); if(FAILED(hr) || !pv77) { return"Ðевозможно иниÑиализиÑоваÑÑ Ð¸Ð½ÑеÑÑÐµÐ¹Ñ 1С ÐÑедпÑиÑÑиÑ"; CoUninitialize(); return FALSE; } VARIANT vRet; DISPID dispIDRmTrade, dispIDInitialize; DISPPARAMS args = {0, 0, 0, 0}; VARIANT vars[3]; // ÐаÑамеÑÑÑ Ð´Ð»Ñ Ð²Ñзова Initialize BSTR rmTrade = L"RMTrade"; hr = pv77->GetIDsOfNames(IID_NULL, &rmTrade, 1, 0, &dispIDRmTrade); if (FAILED(hr)) { return"Ðевозможно полÑÑиÑÑ ID Ð¾Ñ RMTrade"; if (pv77) pv77->Release(); CoUninitialize(); return FALSE; } hr = pv77->Invoke(dispIDRmTrade, IID_NULL, 0, DISPATCH_PROPERTYGET, &args, &vars[2], NULL, NULL); if (FAILED(hr)) { return"Ðевозможно полÑÑиÑÑ Ð¸Ð½ÑеÑÑÐµÐ¹Ñ Ð¾Ñ RMTrade"; if (pv77) pv77->Release(); CoUninitialize(); return FALSE; } //нÑжно полÑÑиÑÑ ID Ð´Ð»Ñ Initialize(..); BSTR init = L"Initialize"; hr = pv77->GetIDsOfNames(IID_NULL, &init, 1, 0, &dispIDInitialize); if (FAILED(hr)) { return"Ðе ÑдалоÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ ID Ð¾Ñ Initialize"; if (pv77) pv77->Release(); CoUninitialize(); return FALSE; } args.cArgs = 3; args.rgvarg = vars; std::wstring path = L"/DC:\\Users\\Public\\Documents\\old\\Steklo\\ /Nya /P185224"; vars[0] = _variant_t(no_splash_screen ? L"NO_SPLASH_SHOW" : L""); vars[1] = _variant_t(path.c_str());; hr = pv77->Invoke(dispIDInitialize, IID_NULL, 0, DISPATCH_PROPERTYGET, &args, &vRet, NULL, NULL); if(FAILED(hr) || (vRet.vt == VT_BOOL && vRet.bstrVal == 0x00)) { return"Ðевозможно запÑÑÑиÑÑ 1С ÐÑедпÑиÑÑие"; } return "ok"; } Actual result: -------------- This code work fine if compiled like Win32 application. When i make it a part of PHP extension (dll) and call from PHP script started program behaves like path std::wstring path = L"/DC:\\Users\\Public\\Documents\\old\\Steklo\\ /Nya /P185224"; is incorrect, but there is no any windows or messages of course. Stated program is in memory has size like there exists only windows to enter correct path (such window is shown if it's a win32 application, not a PHP extension). Help me somehow please -- Edit bug report at https://bugs.php.net/bug.php?id=63164&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63164&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63164&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63164&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63164&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63164&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63164&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63164&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63164&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63164&r=support Expected behavior: https://bugs.php.net/fix.php?id=63164&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63164&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63164&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63164&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63164&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63164&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63164&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63164&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63164&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63164&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63164&r=mysqlcfg