Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: zephir generate not detecting required php extensions #2427

Open
noone-silent opened this issue May 10, 2024 · 0 comments
Open

[BUG]: zephir generate not detecting required php extensions #2427

noone-silent opened this issue May 10, 2024 · 0 comments

Comments

@noone-silent
Copy link

How to reproduce:

  • Checkout https://github.com/phalcon/cphalcon with branch v5.0.x
  • Move all interfaces, except ResultsetInterface from ext/phalcon/mvc/model/Resultset.zep to ext/phalcon/mvc/model/ResultsetInterface.zep (see code below)
  • Add missing use statements
  • try zephir fullclean && zephir build

The build fails with an error message:

cphalcon/ext/phalcon/mvc/model/resultsetinterface.zep.c:37:75: error: 'php_json_serializable_ce' undeclared (first use in this function)
37 |         zend_class_implements(phalcon_mvc_model_resultsetinterface_ce, 1, php_json_serializable_ce);

Findings:

After digging into the problem, following things I found out:

In ext/mvc/model/Resultset.zep.c two header files are removed:

#include "ext/spl/spl_iterators.h"
#include "ext/json/php_json.h"

but not added in ext/mvc/model/ResultsetInterface.zep.c

Running all steps manually and adding the missing header files to ext/mvc/model/ResultsetInterface.zep.c will compile the extension without error

zephir fullclean
zephir generate
// Adding the missing header files to resultsetinterface.zep.c
zephir compile
zephir install

Info:
Zephir Version: 1.6.0
PHP Version: 8.0, 8.1, 8.2, 8.3

Code:

// ext/mvc/model/Resultset.zep
abstract class Resultset implements ResultsetInterface
// ext/mvc/model/ResultsetInterface.zep
use ArrayAccess;
use Closure;
use Countable;
use Iterator;
use JsonSerializable;
use SeekableIterator;
use Serializable;
use Phalcon\Messages\MessageInterface;
use Phalcon\Mvc\ModelInterface;

interface ResultsetInterface extends Iterator, SeekableIterator, Countable, ArrayAccess, Serializable, JsonSerializable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant