# segmentation fault

- Thread: https://externals.io/message/28365
- Original archive: https://news-web.php.net/php.internals/28365
- Started by Oliver Block on 2007-03-16T02:08:36+00:00
- Messages: 3
- 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

---

## #28365 — Oliver Block — 2007-03-16T02:08:36+00:00

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

Hello,

I receive a segmentation fault on a 

   RETVAL_STRING(some_module_global, 1);

The problem disappears if I change it to 

   RETVAL_STRING(some_module_global, 0);

Is anybody interested in the data?

Regards,

Oliver

---

## #28366 — Tijnema ! — 2007-03-16T07:52:08+00:00

URL: https://externals.io/message/28365#28366 · In reply to: #28365

> Hello,
>
> I receive a segmentation fault on a
>
>   RETVAL_STRING(some_module_global, 1);
>
> The problem disappears if I change it to
>
>   RETVAL_STRING(some_module_global, 0);
>
> Is anybody interested in the data?
>
> Regards,
>
> Oliver

I never had any segfaults with PHP, but i think more info is needed.
What is some_module_global? is it a var? did you define it? is it just
a string?

And maybe PHP version would be helpful.

Tijnema

---

## #28464 — Richard Lynch — 2007-03-19T22:13:26+00:00

URL: https://externals.io/message/28365#28464 · In reply to: #28366

> 
> > […]

As I understand it (or don't, more likely) the whole point of the 0
versus 1 there is "who is going to deallocate the string" you are
returning.

If you use the wrong thing, and both PHP and *you* deallocate the
string, then one of you is doing a "free" on `NULL` and PHP will
segfault.

Don't do that. :-)

So, I suspect that nobody really wants the data, as you did something
you shouldn't have, and now you've fixed it.

Please understand that my experience in this matter is limited to
writing one (1) extension of dubious value, at best:
http://l-i-e.com/perror

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
