php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78714 funcs returning pointer can't use call convention spec
Submitted: 2019-10-21 14:51 UTC Modified: 2019-11-07 10:39 UTC
From: cmb@php.net Assigned: dmitry (profile)
Status: Closed Package: *Extensibility Functions
PHP Version: 7.4Git-2019-10-21 (Git) OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

 [2019-10-21 14:51 UTC] cmb@php.net
Description:
------------
When declaring a function which returns a pointer, any calling
convention specifier is not recognized at the proper position (at
least the proper position for MSVC; not sure about other
compilers).

It appears to be possible to work around that issue by placing the
calling convention specifier between the base type and the `*` (or
even by placing it between `extern` and the base type), but we
should support the proper order as well.

This issue has been found by Alexander Lisachenko.


Test script:
---------------
<?php
$ffi = FFI::cdef(
    'char * __cdecl get_zend_version(void);',
    'php7_debug.dll'
);
echo FFI::string($ffi->get_zend_version());


Expected result:
----------------
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies

Actual result:
--------------
Fatal error: Uncaught FFI\ParserException: unexpected '__cdecl' at line 1 in %s:4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-07 10:39 UTC] nikic@php.net
-Assigned To: +Assigned To: dmitry
 [2019-11-11 09:08 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecd0c5b6ad68fb9255c07a96a25f0b7852e882ff
Log: Fixed bug #78714 (funcs returning pointer can't use call convention spec)
 [2019-11-11 09:08 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2019-11-11 09:09 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecd0c5b6ad68fb9255c07a96a25f0b7852e882ff
Log: Fixed bug #78714 (funcs returning pointer can't use call convention spec)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC