note 120322 added to class.com

From: Date: Tue, 13 Dec 2016 14:17:15 +0000
Subject: note 120322 added to class.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-208578@lists.php.net to get a copy of this message
Under PHP7(.x) 64-bit, there is a documentation error (on the MSDN side, already reported) causing problems if you try to manipulate the registry (StdRegProv) through COM. Indeed, MSDN reports that the registry hive/root must be reported as a uint32, which means that, in PHP 64-bit, one would create a new Variant($root,VT_UI4). This would throw a type mismatch error. It seems internally and contrary to what MSDN says (as of now, 2016-12-13), the root parameter must actually be passed as an int32. So you have to : 1. convert your root number to a negative int to avoid out-of-bounds exceptions when creating the variant below (basically the integer being >= 2^31, you have to wrap it around the 32-bit signed integer maximum yourself) ; 2. create a new Variant($root,VT_I4) ; 3. pass that Variant to your COM API call. This did not happen before PHP 7.0 as it always used VT_I4 internally before (see https://bugs.php.net/bug.php?id=73605), but now it respects (and is right to do so) the real integer length, so without an explicit conversion, PHP7 would now output a VT_I8 on x64, versus VT_I4 for PHP5. ---- Server IP: 72.52.91.14 Probable Submitter: 78.120.155.219 ---- Manual Page -- http://php.net/manual/en/class.com.php Edit -- https://master.php.net/note/edit/120322 Del: integrated -- https://master.php.net/note/delete/120322/integrated Del: useless -- https://master.php.net/note/delete/120322/useless Del: bad code -- https://master.php.net/note/delete/120322/bad+code Del: spam -- https://master.php.net/note/delete/120322/spam Del: non-english -- https://master.php.net/note/delete/120322/non-english Del: in docs -- https://master.php.net/note/delete/120322/in+docs Del: other reasons-- https://master.php.net/note/delete/120322 Reject -- https://master.php.net/note/reject/120322 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#208578) next »