php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78253 Const modifier for undeclared structures hides an original error
Submitted: 2019-07-05 09:18 UTC Modified: 2021-09-15 12:03 UTC
From: lisachenko dot it at gmail dot com Assigned:
Status: Duplicate Package: ffi (PECL)
PHP Version: 7.4.0alpha2 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lisachenko dot it at gmail dot com
New email:
PHP Version: OS:

 

 [2019-07-05 09:18 UTC] lisachenko dot it at gmail dot com
Description:
------------
Following construction with "const" and double pointer modifier could not be parsed by FFI:

    typedef struct _simple_struct {
        const some_not_declared_type **property;
    } simple_struct;

Test script:
---------------
<?php
$ffi = FFI::cdef("
    typedef struct _simple_struct {
        const some_not_declared_type **property;
    } simple_struct;
");

Expected result:
----------------
Fatal error: Uncaught FFI\ParserException: undefined C type 'some_not_declared_type'

Actual result:
--------------
Fatal error: Uncaught FFI\ParserException: unexpected '*' at line

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-21 13:34 UTC] cmb@php.net
I can confirm this behavior.  It is due to a limitation of parsing C
declarations with an LL(*) parser, namely that for conflict resolution
some symbols have to be known in advance[1].

I suggest to changing to documentation problem.

[1] <https://gist.github.com/rygorous/d905d42489158a5d8b17607887f82de5>
 [2021-09-15 10:31 UTC] dmitry@php.net
-Status: Open +Status: Duplicate
 [2021-09-15 10:31 UTC] dmitry@php.net
the same as Bug #79576
 [2021-09-15 12:03 UTC] dmitry@php.net
Fixed together with #79576
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 18:03:49 2021 UTC