Skip to content

Cannot include php_hash.h in C++ code #22935

Description

@matyhtf

char *base = ecalloc(1, ops->context_size + align);

C++ prohibits implicit conversion of pointer types

Error

/usr/include/php/20240924/ext/hash/php_hash.h: In function ‘void* php_hash_alloc_context(const php_hash_ops*)’:
/usr/include/php/20240924/Zend/zend_alloc.h:158:65: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
  158 | #define ecalloc(nmemb, size)                            _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
      |                                                         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                 |
      |                                                                 void*
/usr/include/php/20240924/ext/hash/php_hash.h:161:30: note: in expansion of macro ‘ecalloc’
  161 |                 char *base = ecalloc(1, ops->context_size + align);
      |                              ^~~~~~~
make[2]: *** [CMakeFiles/phpx.dir/build.make:1801: CMakeFiles/phpx.dir/src/std/misc.cc.o] Error 1
make[2]: Leaving directory '/home/runner/work/phpx/phpx'
make[1]: *** [CMakeFiles/Makefile2:128: CMakeFiles/phpx.dir/all] Error 2
make[1]: Leaving directory '/home/runner/work/phpx/phpx'
make: *** [Makefile:136: all] Error 2
Error: Process completed with exit code 2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions