Re: Conditional class definition in PHP 4.3.x
| From: | Alan Knowles | Date: | Tue, 06 Jan 2004 16:58:45 +0000 |
| Subject: | Re: Conditional class definition in PHP 4.3.x | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-6819@lists.php.net to get a copy of this message | ||
This only affects single line conditional class and function declarations.
php -r ' if (1) { function test () { echo "1"; }} else { function
test() { echo "0"; }} test();'
It affects php4.3.2 and up. (and probably alot earlier....)
if you lay this out in a file, it works perfectly: eg.
<?php
if (1) { function test () { echo "1"; }
} else { function test() { echo "0"; }
} test();
I think the fix in here should be ok for conditional classes / nested class issue...
http://bugs.php.net/26760
Not sure if the above is a critical case.. - but it was a bit supprising...
Regards
Alan
Andi Gutmans wrote:
This is strange. I remember it used to work. We'll look into it. Andi At 03:37 PM 1/5/2004 +0100, Marcus Boerger wrote:Hello internals, version 5 does neither support nested classes nor conditional classes. Not supporting the former is a bit of a loss but the latter leads to ugly software design so no worry here. Anyway i tried the test script with 4.3.5-dev and there conditional classes are present but not working. Hence i suggest we disable or fix them. Further more i think we cannot fix it becasue the script mixes compile time and run time. It tries something like selfmodifying code. Since i think it is ugly software design anyways i am pro disabling. marcus@zaphod /usr/src/PHP_4_3_0 $ php -r 'if (1) {class a{function f(){return 1;}}}else{class a{function f(){return 0;}}}echo a::f()."\n";' 0 marcus@zaphod /usr/src/PHP_4_3_0 $ php -r 'if (0) {class a{function f(){return 1;}}}else{class a{function f(){return 0;}}}echo a::f()."\n";' 0 -- Best regards,Marcus mailto:helly@php.net-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php