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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 14:01:30 2024 UTC