On Fri, January 18, 2008 1:08 am, Antony Dovgal wrote: > On 18.01.2008 04:39, Michael B Allen wrote: >>> You have to copy the string if you want to store it. >> >> Ok. Doesn't look like I have much choice. I just wanted to >> understand >> the problem better. I'll just copy the strings. >> >> But it does seem odd to me that PHP does not always reference string >> constants directly. I mean, why copy if you don't have to? > > Because you have to copy something that is going to be freed by PHP. > That's how it works & worked for ages - you don't have to free the > strings you get from zend_parse_parameters() because PHP does it for > you.
Or, to put it another way, as I understand it: You know that 0|1 flag you can use when you return a value? That flag isn't about whether or not PHP will nuke the value when it exits; PHP is *GOING* to nuke that value. The flag is about whether PHP should copy it for you, so it can nuke its own copy, or if you've already made it a PHP value/copy, which PHP can safely nuke. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php