# problem with zend_register_internal_class

- Thread: https://externals.io/message/21556
- Original archive: https://news-web.php.net/php.internals/21556
- Started by Jan Pieper on 2006-01-15T23:01:23+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #21556 — Jan Pieper — 2006-01-15T23:01:23+00:00

URL: https://externals.io/message/21556#21556

If I compile my class if written, I get this error-messages:

~/php-5.1.1/ext/smartflow/smartflow.c: In function 'zm_startup_smartflow':
~/php-5.1.1/ext/smartflow/smartflow.c:109: error: too few arguments to function 
'zend_register_internal_class'
make: *** [ext/smartflow/smartflow.lo] Fehler 1

These are the lines where I get this error-messages (smartflow.c/lines: 91-110):

PHP_MINIT_FUNCTION(smartflow)
{
         zend_class_entry smartflow_ce;

         INIT_CLASS_ENTRY(
                 smartflow,
                 "SmartFlow",
                 smartflow_methods
         );

         smartflow_ce_ptr = zend_register_internal_class(&smartflow_ce); // 101

         zend_declare_property_string(
                 smartflow_ce_ptr, // 104
                 "content", strlen("content"), "",
                 ZEND_ACC_PUBLIC
         );

         return SUCCESS;
}


I have another class with "exactly the same" lines but there I get no 
error-messages. I can´t find any differences in my sources. I hope you can help 
me to fix my problem. If I add TSRMLS_CC to line 101 and 104 I don´t get these 
error-messages but after compiling php I get a memory-access error.

- Jan Pieper

---

## #21557 — Antony Dovgal — 2006-01-16T14:19:41+00:00

URL: https://externals.io/message/21556#21557 · In reply to: #21556

You forgot to add TSRMLS_CC macro:
zend_register_internal_class(&ce TSRMLS_CC);

Btw, pecl-dev@lists.php.net is more appropriate list for such questions.


> If I compile my class if written, I get this error-messages:
> 
> ~/php-5.1.1/ext/smartflow/smartflow.c: In function 'zm_startup_smartflow':
> ~/php-5.1.1/ext/smartflow/smartflow.c:109: error: too few arguments to function 
> 'zend_register_internal_class'
> make: *** [ext/smartflow/smartflow.lo] Fehler 1
> 
> These are the lines where I get this error-messages (smartflow.c/lines: 91-110):
> 
> PHP_MINIT_FUNCTION(smartflow)
> {
>          zend_class_entry smartflow_ce;
> 
>          INIT_CLASS_ENTRY(
>                  smartflow,
>                  "SmartFlow",
>                  smartflow_methods
>          );
> 
>          smartflow_ce_ptr = zend_register_internal_class(&smartflow_ce); // 101
> 
>          zend_declare_property_string(
>                  smartflow_ce_ptr, // 104
>                  "content", strlen("content"), "",
>                  ZEND_ACC_PUBLIC
>          );
> 
>          return SUCCESS;
> }
> 
> 
> I have another class with "exactly the same" lines but there I get no 
> error-messages. I can´t find any differences in my sources. I hope you can help 
> me to fix my problem. If I add TSRMLS_CC to line 101 and 104 I don´t get these 
> error-messages but after compiling php I get a memory-access error.
> 
> - Jan Pieper
> 


-- 
Wbr, 
Antony Dovgal

---

## #21558 — Hartmut Holzgraefe — 2006-01-16T14:24:24+00:00

URL: https://externals.io/message/21556#21558 · In reply to: #21557

Antony Dovgal wrote:
> You forgot to add TSRMLS_CC macro:
> zend_register_internal_class(&ce TSRMLS_CC);

see also http://www.php.net/manual/en/zend-api.zend-register-internal-class.php



-- 
Hartmut Holzgraefe, Senior Support Engineer                            .
MySQL AB, www.mysql.com

---

## #21559 — Jan Pieper — 2006-01-16T16:38:32+00:00

URL: https://externals.io/message/21556#21559 · In reply to: #21558

> Antony Dovgal wrote:
> > […]
> 
> see also 
> http://www.php.net/manual/en/zend-api.zend-register-internal-class.php

Yeah thanks. It works, but I am wondering why it works without the TSRMLS_CC 
macro by another self-written class. Both classes were written in php-5.1.1.

Thanks for the notice, that pecl.dev is better than php.internals for such 
questions.

- Jan Pieper

---

## #21560 — Antony Dovgal — 2006-01-16T17:54:26+00:00

URL: https://externals.io/message/21556#21560 · In reply to: #21559

> > […]
> 
> Yeah thanks. It works, but I am wondering why it works without the TSRMLS_CC 
> macro by another self-written class. Both classes were written in php-5.1.1.

Because in that case your code was compiled without thread safety enabled (and TSRMLS_* macros 
were not used at all, i.e. they were defined as empty).

-- 
Wbr, 
Antony Dovgal
