Re: [PHP-DEV] PHP as a template language
On Apr 5, 2012, at 8:22 PM, Rasmus Lerdorf wrote: On 04/05/2012 07:55 PM, Sébatien Durand wrote: IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? It is well past April 1. Here's Rasmus proposing ?php back in 1997, for PHP 3: http://marc.info/?l=php-internalsm=90279104403805w=2 Discussion ensues, and we end up with multiple tags. Too bad. ;) Oh, and here's a list of possible possible options from back then, taken from that thread: 1. ? code ? 2. ?{whitespace} code ? 3. ?php code ? 4. % code % 5. (1) and (3) combined using some fancy hard-to-code scanner with dedicated XML support. 6. ?_ code _? 7. _ code _ 8. : code : 9. code 10. ?: code :? 11. ?? code ?? 12. [ code ] 13. { code } Anyway, just a brief out-of-context look at the past. Woot! Regards, Philip -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
Am 06.04.2012 04:55, schrieb Sébatien Durand: IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? that you calendar is broken (april 1st is over) or it was not an april joke that i never will understand people proposing changes only for the sake of the change signature.asc Description: OpenPGP digital signature
[PHP-DEV] [Bug #61649] zend gc should not mark persistent hashtable
Hi Dmitry: zend gc was introducted in 5.3 thinking of a zval which is a Hashtable allocated by a extension in persistent, and it also has hashtable children in it, then , if the extension return this to php script: array_init(return_value); zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(persitent_zval_hashtable), ***).. since zval_copy_ctor does shallow copy, so the persistent array return to the php script. then if it happen to be parsed by zval_ptr_dtor, then the persistent array will be parsed by gc_zval_possible_root, ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC) { .. if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) { GC_ZVAL_SET_PURPLE(zv); .. then the malloc info of the block(not sure before or after) will be polluted. then when the extension try to free the block, a warning will be show like: munmap_chunk(): invalid pointer 0x*** I have make a patch for this(https://bugs.php.net/bug.php?id=61649), if you think it's okey, I will commit it to all branches, thanks -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [Bug #61649] zend gc should not mark persistent hashtable
Hi: and, yes, extension can change their code to alloc a zend_gc_info size(what I do now). however, I think, it's no need for zend_gc care about persistent memorys, right? thanks On Fri, Apr 6, 2012 at 8:21 PM, Laruence larue...@php.net wrote: Hi Dmitry: zend gc was introducted in 5.3 thinking of a zval which is a Hashtable allocated by a extension in persistent, and it also has hashtable children in it, then , if the extension return this to php script: array_init(return_value); zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(persitent_zval_hashtable), ***).. since zval_copy_ctor does shallow copy, so the persistent array return to the php script. then if it happen to be parsed by zval_ptr_dtor, then the persistent array will be parsed by gc_zval_possible_root, ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC) { .. if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) { GC_ZVAL_SET_PURPLE(zv); .. then the malloc info of the block(not sure before or after) will be polluted. then when the extension try to free the block, a warning will be show like: munmap_chunk(): invalid pointer 0x*** I have make a patch for this(https://bugs.php.net/bug.php?id=61649), if you think it's okey, I will commit it to all branches, thanks -- Laruence Xinchen Hui http://www.laruence.com/ -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: 回复: [PHP-DEV] resume after exception
2012/4/5 Anthony Ferrara ircmax...@gmail.com: Why not just do: function foo(callable $callback) { $a = 0; $callback(); $a = 1; $callback(); } function bar() { foo(function() { echo 1; }); } It's functionally the same, but doesn't have the stack magic. Now, it won't be able to do everything that your concept does (bubble up to an arbitrary point), but I see that as a good thing, since this is explicit. And considering that you're intending to use it as a control flow structure (which is not what exceptions are supposed to be), I would say exceptions and their dynamic nature would be literally a bad thing in this case... I don't see how exceptions are anything but a control flow structure? If all you wanted was an error-message, you'd be using trigger_error() - the only way exceptions differ, is that they allow execution to continue from a certain point, under certain circumstances; it allows you to control the flow. It's functionally the same, but doesn't have the stack magic. your argument and example above is certainly valid, but from the same point of view, why not get rid of throw/try/catch statements too while we're at it? function foo(callabable $errorhandler) { if (some_condition()) { $errorhandler(); } } function bar() { foo(function() { echo 'an error occurred!'; exit; }); } This works just as well, and as you pointed out, it's probably easier to understand. Now, it won't be able to do everything that an exception does (bubble up to an arbitrary point), but you could view that as a good thing, since this is explicit. You could argue that exceptions and their dynamic nature is literally a bad thing in every case. To your technical point: This could get really ugly as you'd be forced to have multiple stacks hanging around if you used more than one of these in your code. I don't see how? If you throw an interrupt, and nothing catches it, the program terminates, same as after an exception. if you throw an interrupt and something catches it, that interrupt (and it's retained stack) only lives for the duration of the catch-statement: try { ... } catch (Interrupt $i) { if (some_condition()) resume; // (A) else if (other_condition()) throw $i; // (B) // (C) } There are three ways you can exit this catch{} block: (A) we resume execution from the throw-statement, and the previous stack remains valid. (B) the previous stack is preserved for another catch-statement (or exit with an error-message) (C) if we exit the catch{}-block and don't resume, it is safe to unwind the stack at this point. (assuming we're talking about just interrupts, and not continuations that can be serialized and resumed at a later time.) I don't know why you think interrupts are so unnatural or difficult to understand - to me, it would be a natural extension of exceptions. And I've never understood why they are so frequently compared to GOTO. I think it's entirely a matter of how you perceive (and apply) the idea of exceptions - personally I see them not as a better replacement for triggering errors, I really can't see them as anything other than flow-control statements; there are few cases from which it is really, truly impossible to recover, but when I identify such a case, I still use trigger_error() - and granted, this is rare, but there are cases. And mind you, registering an error-handler was possible before exceptions were around, and we got by then - just because something works or is well-established, doesn't mean there is no room for improvement. I'm not going to pretend I know enough about programming languages to say for sure that this is a good idea - if this idea has been tried or researched and proven bad already, I'd love to learn about it. But if so, I doubt it was for any of the reasons I've heard so far... -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: 回复: [PHP-DEV] resume after exception
Rasmus, I think you're missing the difference here. Let's look at an exception. try { doFoo(); throwsException(); doBar(); } catch (Exception $e) { doBaz(); } This is NOT the same as: doFoo(); throwsException('doBaz'); doBar(); To emulate the exception using continuation passing, you'd need to pass two functions, a success and a failure. doFoo(); throwsException('doBaz', 'doBar'); And that's for a single stack level. Imagine how complicated it would become if you were dealing with a large stack or multiple throwers. You'd have something like this: doFoo(); throwsException1(function() { throwsException2(function() { doBar(); }, function() { throwsException3(function() { doBaz(); }, function() { doBiz(); } }); } It'll get really messy really quick. As far as your point about keeping multiple stacks, imagine this code: try { throwsInterrupt(); doSomething(); } catch (Interrupt $i) { callFuncThatInternallyCallsAnotherThatThrowsInterrup(); resume; } Now, you have 3 independent stacks that are raised. The one for the original call to throwsInterrupt, one for the function that internally calls another that throws, and one for the internal interrupt itself. All three would need to be detached at some point from the execution stack and saved for resume. So you're not only unwinding the stacks, but saving them as well incase the interrupt is resumed (to re-wind the stack). Right now, Exceptions don't have this problem, since the stack is never rewound. So it only grows or is unwound based on the exception tree... Not to mention that code execution is always linear in an exception case. It's not possible that code flow will magically jump around. Sure, you could emulate it with goto ( http://codepad.viper-7.com/i3Dhv4 ). But that's explicitly jumping around. Anthony On Fri, Apr 6, 2012 at 9:31 AM, Rasmus Schultz ras...@mindplay.dk wrote: 2012/4/5 Anthony Ferrara ircmax...@gmail.com: Why not just do: function foo(callable $callback) { $a = 0; $callback(); $a = 1; $callback(); } function bar() { foo(function() { echo 1; }); } It's functionally the same, but doesn't have the stack magic. Now, it won't be able to do everything that your concept does (bubble up to an arbitrary point), but I see that as a good thing, since this is explicit. And considering that you're intending to use it as a control flow structure (which is not what exceptions are supposed to be), I would say exceptions and their dynamic nature would be literally a bad thing in this case... I don't see how exceptions are anything but a control flow structure? If all you wanted was an error-message, you'd be using trigger_error() - the only way exceptions differ, is that they allow execution to continue from a certain point, under certain circumstances; it allows you to control the flow. It's functionally the same, but doesn't have the stack magic. your argument and example above is certainly valid, but from the same point of view, why not get rid of throw/try/catch statements too while we're at it? function foo(callabable $errorhandler) { if (some_condition()) { $errorhandler(); } } function bar() { foo(function() { echo 'an error occurred!'; exit; }); } This works just as well, and as you pointed out, it's probably easier to understand. Now, it won't be able to do everything that an exception does (bubble up to an arbitrary point), but you could view that as a good thing, since this is explicit. You could argue that exceptions and their dynamic nature is literally a bad thing in every case. To your technical point: This could get really ugly as you'd be forced to have multiple stacks hanging around if you used more than one of these in your code. I don't see how? If you throw an interrupt, and nothing catches it, the program terminates, same as after an exception. if you throw an interrupt and something catches it, that interrupt (and it's retained stack) only lives for the duration of the catch-statement: try { ... } catch (Interrupt $i) { if (some_condition()) resume; // (A) else if (other_condition()) throw $i; // (B) // (C) } There are three ways you can exit this catch{} block: (A) we resume execution from the throw-statement, and the previous stack remains valid. (B) the previous stack is preserved for another catch-statement (or exit with an error-message) (C) if we exit the catch{}-block and don't resume, it is safe to unwind the stack at this point. (assuming we're talking about just interrupts, and not continuations that can be serialized and resumed at a later time.) I don't know why you think interrupts are so unnatural or difficult to understand - to me, it would be a natural extension of exceptions. And I've never understood why they are so frequently compared to GOTO. I think
Re: [PHP-DEV] Tokyo/Kyoto Cabinet in 5.4
On Thu, Dec 8, 2011 at 14:58, Hannes Magnusson hannes.magnus...@gmail.com wrote: On Fri, Sep 30, 2011 at 18:29, Michael Maclean m...@php.net wrote: On 30/09/11 12:37, Hannes Magnusson wrote: Preferably replace it with Kyoto Cabinet support I suppose. I added the TC support initially, so I can look at replacing it over the weekend. Whats the status on this? So... Apparently we release 5.4 with support for it. What is the current plan then? Keep a useless feature in 5.4 for the remainder of the series or..? -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] PHP as a template language
-Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
To tell the truth I'd be more excited by a proposal to kill ?php entirely, or more realistically, to support an alternate file extension that doesn't need it. That would be an interesting option for those who want to put dribs and drabs of PHP sprinkled in HTML completely behind them. On Fri, Apr 6, 2012 at 5:19 PM, Tom Boutell t...@punkave.com wrote: I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
what exactly is your problem? having solution searching problem? what are people like you try to achieve? what would make you happy in breaking BC? what would you make happy generate lot of work for others? what would be better for anybody? change for the sake of the change is blindly stupid Am 06.04.2012 23:20, schrieb Tom Boutell: To tell the truth I'd be more excited by a proposal to kill ?php entirely, or more realistically, to support an alternate file extension that doesn't need it. That would be an interesting option for those who want to put dribs and drabs of PHP sprinkled in HTML completely behind them. On Fri, Apr 6, 2012 at 5:19 PM, Tom Boutell t...@punkave.com wrote: I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm signature.asc Description: OpenPGP digital signature
Re: [PHP-DEV] PHP as a template language
Knock it off with the ad-hominem attacks please. It's not change for the sake of change to propose that PHP move on from needing ?php at the stop of every class file (and breaking mysteriously in weird subtle ways if it's missing, due to unneeded whitespace being output) and recognize that it's a modern language in which you don't mix unparsed HTML with source code. Especially since I suggested offering this feature when an alternate file extension is used, to make bc possible. Your attitude discourages participation. On Fri, Apr 6, 2012 at 5:25 PM, Reindl Harald h.rei...@thelounge.net wrote: what exactly is your problem? having solution searching problem? what are people like you try to achieve? what would make you happy in breaking BC? what would you make happy generate lot of work for others? what would be better for anybody? change for the sake of the change is blindly stupid Am 06.04.2012 23:20, schrieb Tom Boutell: To tell the truth I'd be more excited by a proposal to kill ?php entirely, or more realistically, to support an alternate file extension that doesn't need it. That would be an interesting option for those who want to put dribs and drabs of PHP sprinkled in HTML completely behind them. On Fri, Apr 6, 2012 at 5:19 PM, Tom Boutell t...@punkave.com wrote: I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
I should have said breaking mysteriously in weird subtle ways if there are blank lines before ?php. On Fri, Apr 6, 2012 at 5:30 PM, Tom Boutell t...@punkave.com wrote: Knock it off with the ad-hominem attacks please. It's not change for the sake of change to propose that PHP move on from needing ?php at the stop of every class file (and breaking mysteriously in weird subtle ways if it's missing, due to unneeded whitespace being output) and recognize that it's a modern language in which you don't mix unparsed HTML with source code. Especially since I suggested offering this feature when an alternate file extension is used, to make bc possible. Your attitude discourages participation. On Fri, Apr 6, 2012 at 5:25 PM, Reindl Harald h.rei...@thelounge.net wrote: what exactly is your problem? having solution searching problem? what are people like you try to achieve? what would make you happy in breaking BC? what would you make happy generate lot of work for others? what would be better for anybody? change for the sake of the change is blindly stupid Am 06.04.2012 23:20, schrieb Tom Boutell: To tell the truth I'd be more excited by a proposal to kill ?php entirely, or more realistically, to support an alternate file extension that doesn't need it. That would be an interesting option for those who want to put dribs and drabs of PHP sprinkled in HTML completely behind them. On Fri, Apr 6, 2012 at 5:19 PM, Tom Boutell t...@punkave.com wrote: I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
Am 06.04.2012 23:30, schrieb Tom Boutell: Knock it off with the ad-hominem attacks please. what do you expect by propose work for many people It's not change for the sake of change to propose that PHP move on from needing ?php at the stop of every class file is it so hard to write (and breaking mysteriously in weird subtle ways if it's missing, due to unneeded whitespace being output) why are you making this whitespaces? fix your editor or get an IDE removing them at save and recognize that it's a modern language in which you don't mix unparsed HTML with source code. you are not in the position to dictate how people are working there are differences between projects, classes and rapid-development and thousands of good reasons using input type=text value=?=$myvar? forever while you will not do this in many other projects and lcass files Especially since I suggested offering this feature when an alternate file extension is used, to make bc possible. Your attitude discourages participation. but you are not realizing that extensuions are meaningless in the real world - you can configure httpd to parse .wtf with PHP BTW: you do not need to use reply-all, one msg to the list is enough On Fri, Apr 6, 2012 at 5:25 PM, Reindl Harald h.rei...@thelounge.net wrote: what exactly is your problem? having solution searching problem? what are people like you try to achieve? what would make you happy in breaking BC? what would you make happy generate lot of work for others? what would be better for anybody? change for the sake of the change is blindly stupid Am 06.04.2012 23:20, schrieb Tom Boutell: To tell the truth I'd be more excited by a proposal to kill ?php entirely, or more realistically, to support an alternate file extension that doesn't need it. That would be an interesting option for those who want to put dribs and drabs of PHP sprinkled in HTML completely behind them. On Fri, Apr 6, 2012 at 5:19 PM, Tom Boutell t...@punkave.com wrote: I have to agree with that. Also: does PHP need to be a templating language anymore, given excellent templating language implementations in PHP, like Twig? On Fri, Apr 6, 2012 at 3:05 PM, John Crenshaw johncrens...@priacta.com wrote: -Original Message- From: Sébatien Durand [mailto:sun...@live.com] Sent: Thursday, April 05, 2012 10:55 PM To: internals@lists.php.net Subject: [PHP-DEV] PHP as a template language IMHO, PHP is a great template language. This is what makes it so simple and powerful, compared to other web languages. So far, we have ?php, ?= and various legacy syntaxes like ?. A suggestion : deprecate these old tags and replace them with a more elegant and a shorter implementation. For example : % and %= or {% and {{ ? What do you think, guys ? Honestly this is the wrong question. PHP as a template language has much larger problems than this. The difference between ?php echo and ?= is 7 characters and entirely cosmetic. The difference relative to ?php echo htmlentities(..., ENT_QUOTES | ENT_HTML5, 'UTF-8'); ? however is 56 characters, security, and encoding bugs. Proper handling of output escaping is standard in modern template languages. The question shouldn't be should we add a cooler short tag?. The question should be What needs to be done to make PHP an industry leader in template languages again?. My two cents, John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm -- Mit besten Grüßen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofmühlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ http://www.thelounge.net/signature.asc.what.htm signature.asc Description: OpenPGP digital signature
Re: [PHP-DEV] PHP as a template language
Tom Boutell wrote: Knock it off with the ad-hominem attacks please. You are entitled to your views, but I suspect that this would be a nail far too far. I for one would be only too happy to cut loose and keep a REAL copy of PHP running as all this ballast is simply destroying what used to be an agile scripting language. Anybody for RealPHP and roll back to say 5.2 and strip out anything not needed at run time :) All this 'hinting' and 'moaning' at what always used to be perfectly good code is the pain in the posterior. STRICT is going to take me months to assimilate, so simply switching back to a version that does not have it and keeping perfectly good sites running makes more sense than discussing changes that need every file the thousands currently running on my system reviewing ... I'm currently having to review every site to check it will even run cleanly on 5.3 when the ISP loads that up next month! -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
On Fri, Apr 6, 2012 at 5:39 PM, Reindl Harald h.rei...@thelounge.net wrote: what do you expect by propose work for many people Oh I'm sorry, do we need to start every feature suggestion with a description of exactly who will do the work? is it so hard to write It is so embarrassing. Every time I type it a Ruby developer laughs like a hyena. why are you making this whitespaces? fix your editor or get an IDE removing them at save Right, workarounds forever, nothing should be fixed at the source. you are not in the position to dictate how people are working You'll note I acknowledged bc is necessary. But you don't seem to be able to stop yelling anyway. there are differences between projects, classes and rapid-development and thousands of good reasons using input type=text value=?=$myvar? forever while you will not do this in many other projects and lcass files Thousands of good reasons to get pwn3d by XSS attacks! Yay! but you are not realizing that extensuions are meaningless in the real world - you can configure httpd to parse .wtf with PHP That's a valid point. So the cli gets a default behavior based on extension (and options to remap it), and FPM and mod_php get options so you can configure them to do the right thing. This wouldn't be an easy one and perhaps it's not practical, but that's no reason to be venomous. -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
Am 06.04.2012 23:54, schrieb Tom Boutell: On Fri, Apr 6, 2012 at 5:39 PM, Reindl Harald h.rei...@thelounge.net wrote: what do you expect by propose work for many people Oh I'm sorry, do we need to start every feature suggestion with a description of exactly who will do the work? the who in such cases are ALL developers out there damned can i send you the invoice for my time if your ideas would be realizedß if no shut up! propsoing BC incompatible changes FOr NOTHING is forcing thousands of users changing many thousands of files for nothing while they end in make them incompatible for older versions in which world do you live that you have no useful work bseides changing perfect working code? why are you making this whitespaces? fix your editor or get an IDE removing them at save Right, workarounds forever, nothing should be fixed at the source. what is a workaround in not make useless whitespaces? where is your feature request to remove shebang of bash-scripts and where is your whining that the are not woring with windows-linebreaks you are not in the position to dictate how people are working You'll note I acknowledged bc is necessary. But you don't seem to be able to stop yelling anyway. yes, i am not able to stop calling people to lazy writing ?php and not write whitespaces in front morons there are differences between projects, classes and rapid-development and thousands of good reasons using input type=text value=?=$myvar? forever while you will not do this in many other projects and lcass files Thousands of good reasons to get pwn3d by XSS attacks! Yay! it is not the problem of the scripting-language that idiots do not sanitize their variables do you believe echo $var; is protected by god himself or what let you imagine there is any difference? but you are not realizing that extensuions are meaningless in the real world - you can configure httpd to parse .wtf with PHP That's a valid point. So the cli gets a default behavior based on extension (and options to remap it), and FPM and mod_php get options so you can configure them to do the right thing. what is the right thing? gining another config-choic e to make every script on different hosting-providers more and more a gambling machine because you never know if you should write yur code with ?pghp or without? This wouldn't be an easy one and perhaps it's not practical, but that's no reason to be venomous. yes it is not practical so please leave the world in peace with your theory and take whatever language you want if your are not staisfied with the oprinciples of PHP signature.asc Description: OpenPGP digital signature
RE: [PHP-DEV] PHP as a template language
yes, i am not able to stop calling people to lazy writing ?php and not write whitespaces in front morons The constant personal attacks are a violation of the mailing list rules. Nobody likes getting this in their inbox. Please let's keep this civil. John Crenshaw Priacta, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
Hello, On Fri, Apr 6, 2012 at 3:08 PM, Reindl Harald h.rei...@thelounge.net wrote: Am 06.04.2012 23:54, schrieb Tom Boutell: On Fri, Apr 6, 2012 at 5:39 PM, Reindl Harald h.rei...@thelounge.net wrote: the who in such cases are ALL developers out there damned can i send you the invoice for my time if your ideas would be realizedß if no shut up! Why is it every single time I see your name in the discussions here it is shortly followed by hostile personal attacks. Do you have no idea how to maintain a level of professionalism when interacting with the opinions and ideas of other developers? Does your company, http://www.thelounge.net/ represent itself in this way? If I was a prospecting customer who had a idea for a relevant technology venture and was willing to pay for it would I receive personal attacks for mentioning something you disagree with? Why don't you act not just like a industry professional, but a decent human being when you talk to people. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP as a template language
Am 07.04.2012 01:30, schrieb Chris Stockton: Hello, On Fri, Apr 6, 2012 at 3:08 PM, Reindl Harald h.rei...@thelounge.net wrote: Am 06.04.2012 23:54, schrieb Tom Boutell: On Fri, Apr 6, 2012 at 5:39 PM, Reindl Harald h.rei...@thelounge.net wrote: the who in such cases are ALL developers out there damned can i send you the invoice for my time if your ideas would be realizedß if no shut up! Why is it every single time I see your name in the discussions here it is shortly followed by hostile personal attacks. maybe because i do not comment every and each post out in this world - only the one which would make hughe damage in most existing applications? Do you have no idea how to maintain a level of professionalism when interacting with the opinions and ideas of other developers? i have ideas how to do so but i learned over many years that people do not understand that they ahve really bad ideas if you say freindly not a godd idea Does your company, http://www.thelounge.net/ represent itself in this way? If I was a prospecting customer who had a idea for a relevant technology venture and was willing to pay for it would I receive personal attacks for mentioning something you disagree with? does the OP with they idea dropping ?php pay me for change applications with some hundret thousands LOC and restart testing from scratch forced by chnages the world does not need? no he does not! if he would offer me around 500.000 € i would consider change, rewrite and test all the work of the last ten years for some hundret domains relaxed and with many satisfaction Why don't you act not just like a industry professional, but a decent human being when you talk to people because i saw way too much useless changes in too much software stacks, mostly with poor quality and less benefit the last years proposed and done by bored people only for the sake of the change? BTW: is your reply to list broken or why using reply all? signature.asc Description: OpenPGP digital signature
[PHP-DEV] Persistent zvals
I've spent the last few days pouring over the Zend engine source code. I think I have a basic understanding on the memory management. Likely what I say may be incorrect, so I apologize in advance. What I'm trying to do is write an extension to persist PHP variables past the end of the request in the SAPI to be used on the next request (different user, same process). I'd like to do this without serialization. The reason is certain objects in PHP (in a framework, for example) are not request specific and it would be useful to have these objects already loaded and usable without having to construct them on every request. (Sample use case: Dependency injection like Guice without having to write physical containers - using reflection, written in PHP) From what I've gathered thus far, it is impossible to do without copying the non-persistent memory into persistent memory, and then back again. I'm assuming this is because all the memory associated with PHP variables use emalloc, which places it onto a stack that is disposed of at the end of the request. So there seems to only be two ways to do this: 1 - Copy non-persistent memory into persistent memory (and back) using a deep copy. Probably not very efficient. May not be much better than serialization. 2 - Modify the Zend engine to flag objects/zvals as persistent so they aren¹t thrown away until the process ends. #2 seems to be the better way to go. #1 seems to be the only way to do it as an extension (maintaining its own stack). There seems to have been some discussion (7 years ago) of this mentioned here under 6.9: http://www.php.net/~derick/meeting-notes.html I've been able to do it somewhat with string zvals, but objects are a different story (given that a zval contains a handle index referring an entry in a bucket). The goal, at least with objects, is the objects doesn't destruct until the end of the process. With copying memory it looks like I'd probably have to copy the object into my own bucket, modify the original in zend's bucket so the destructor isn't called (destructor_callled = 1), and then at the start of the request copy what's in my bucket into zend's bucket. At this point I feel light a mad scientist. I'm hoping to gain some insight on how this might be done properly with PHP 5.3/5.4 (or just 5.4) - even if it involves modifying the Zend engine. Have you guys had any recent discussions about doing this? Luke
Re: [PHP-DEV] Persistent zvals
Hi! From what I've gathered thus far, it is impossible to do without copying the non-persistent memory into persistent memory, and then back again. I'm assuming this is because all the memory associated with PHP variables use emalloc, which places it onto a stack that is disposed of at the end of the request. The stack part is wrong, emalloc does not use stack, but the general sense of it is correct - all memory allocated by emalloc is freed at the end of the request, so anything you would want to preserve would have to be copied to some other memory area. 2 - Modify the Zend engine to flag objects/zvals as persistent so they aren¹t thrown away until the process ends. The problem with that is that these variables can contain references to other variables and other things (like class in object, etc.) that will be freed, so the data will point to freed memory. Unless the variable is a simple scalar or you do not allow associating it with any other variables in any way you would have this problem. If it's a simple scalar, you can do better by using existing caches. Not allowing associations with other variables means there's not much reason for this thing to actually be a PHP variable. I've been able to do it somewhat with string zvals, but objects are a different story (given that a zval contains a handle index referring an entry in a bucket). The goal, at least with objects, is the objects doesn't destruct until the end of the process. With copying memory it looks With objects you have a problem - do you also mean to keep the class? What about the methods code? If you intend to keep all this in memory - and remember you'd also have to guard all of it so no local variable gets anywhere into any of object's properties, or sub-values of these properties - I'm not sure you'd do better than serializing. At this point I feel light a mad scientist. I'm hoping to gain some insight on how this might be done properly with PHP 5.3/5.4 (or just 5.4) - even if it involves modifying the Zend engine. Have you guys had any recent discussions about doing this? Doing it is much harder than you think, since all structures in Zend Engine are assumed to be temporary and you'd need to copy a lot of stuff to make your object work. I wouldn't really advise it. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] PHP as a template language
-Original Message- From: Reindl Harald [mailto:h.rei...@thelounge.net] Am 07.04.2012 01:30, schrieb Chris Stockton: Hello, On Fri, Apr 6, 2012 at 3:08 PM, Reindl Harald h.rei...@thelounge.net wrote: Am 06.04.2012 23:54, schrieb Tom Boutell: On Fri, Apr 6, 2012 at 5:39 PM, Reindl Harald h.rei...@thelounge.net wrote: the who in such cases are ALL developers out there damned can i send you the invoice for my time if your ideas would be realizedß if no shut up! Why is it every single time I see your name in the discussions here it is shortly followed by hostile personal attacks. maybe because i do not comment every and each post out in this world - only the one which would make hughe damage in most existing applications? Seriously, if you're so angry that you can't even type straight you should take a break before responding. Any argument delivered like this won't be well received anyway. Take a break, find your place of zen, respond when you can be civil. Do you have no idea how to maintain a level of professionalism when interacting with the opinions and ideas of other developers? i have ideas how to do so but i learned over many years that people do not understand that they have really bad ideas if you say freindly not a godd idea Wow. I'm honestly shocked. That's the crux of it isn't it? Trouble is that this sort of response violates the rules of the mailing list; rules that we all agreed to. It also isn't going to go over well with the type of people you have here. This is not a productive communication tactic, this is bullying. If you are unwilling to be civil and rational I have to ask, why are you even here? John Crenshaw Priacta, Inc.
Re: [PHP-DEV] Persistent zvals
On Apr 6, 2012, at 5:16 PM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! From what I've gathered thus far, it is impossible to do without copying the non-persistent memory into persistent memory, and then back again. I'm assuming this is because all the memory associated with PHP variables use emalloc, which places it onto a stack that is disposed of at the end of the request. The stack part is wrong, emalloc does not use stack, but the general sense of it is correct - all memory allocated by emalloc is freed at the end of the request, so anything you would want to preserve would have to be copied to some other memory area. How is memory tracked with emalloc? From my observations anything created with emalloc, with or without a zval wrapper, is freed at the end of the request. Things created with pemalloc, which seems to be a wrapper of malloc, isn't thrown away. I saw some references (off the top if my head - on my phone) to something like G(mm_stack)-_malloc(...), which is called by emalloc. Could you briefly explain how it does work or point be to a link that does? Up until now I've been pouring over the source code - and there is a lot, tracing down macro after macro. 2 - Modify the Zend engine to flag objects/zvals as persistent so they aren¹t thrown away until the process ends. The problem with that is that these variables can contain references to other variables and other things (like class in object, etc.) that will be freed, so the data will point to freed memory. Unless the variable is a simple scalar or you do not allow associating it with any other variables in any way you would have this problem. If it's a simple scalar, you can do better by using existing caches. Not allowing associations with other variables means there's not much reason for this thing to actually be a PHP variable. From what I've seen this is because the zvals, the values inside, the object bucket, etc... is all created by emalloc. Correct me if I'm wrong, but even if i could persist the zval (wrapper) the value inside would be freed unless both the zval and the value were created with pemalloc (alias of malloc). It goes a step further with the objects because a zend_object is just a handle ID (pointing to a spot in the bucket) and a pointer to object handlers. I've been able to do it somewhat with string zvals, but objects are a different story (given that a zval contains a handle index referring an entry in a bucket). The goal, at least with objects, is the objects doesn't destruct until the end of the process. With copying memory it looks With objects you have a problem - do you also mean to keep the class? What about the methods code? If you intend to keep all this in memory - and remember you'd also have to guard all of it so no local variable gets anywhere into any of object's properties, or sub-values of these properties - I'm not sure you'd do better than serializing. At this point I feel light a mad scientist. I'm hoping to gain some insight on how this might be done properly with PHP 5.3/5.4 (or just 5.4) - even if it involves modifying the Zend engine. Have you guys had any recent discussions about doing this? Doing it is much harder than you think, since all structures in Zend Engine are assumed to be temporary and you'd need to copy a lot of stuff to make your object work. I wouldn't really advise it. Don't get me wrong - I totally get it. Trying to copy the zvals, the value inside, and the object out of the bucket, and then the descendants is not a good solution. It would probably be buggy at best and not much better than serialization. I'd like to avoid copying memory if possible. A flag on the zval would be ideal. With the continued assumption that memory structures are temporary something like this will never be feasible. In order for something like this to work (at least from my understanding. - I'm probably totally wrong) values inside a zval would have to be created with malloc and the life cycle of that object would have to be determined by the wrapping zval. A zval would have a persistent flag and a recount the value inside would be released when the recount reaches zero or at the end of the request if the persistent flag is zero But this is something totally different than it is now. Luke -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227