RE: [PHP-QA] Re: RC6 doesn't mind function redefinition
| From: | Cynic | Date: | Tue, 03 Apr 2001 19:53:21 +0000 |
| Subject: | RE: [PHP-QA] Re: RC6 doesn't mind function redefinition | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-2749@lists.php.net to get a copy of this message | ||
I just tried a simple script similar to yours, and it really
bails out. But in a larger one it happily goes on:
function get_defined_functions()
{
(...)
}
lines 125 - 129:
$funcs = get_defined_functions() ;
#print_r( $funcs ) ; exit ;
# variable name may be the same as a function name, make sure they don't mix
$pat = preg_replace( '~^\.*$~' , '~(?<=\W)(?<!\$)$0\b~i' , $funcs ) ;
$code = preg_replace_callback( $pat , 'func' , $code ) ;
output:
Warning: Array to string conversion in ... on line 128
Warning: Array to string conversion in ... on line 128
Warning: Delimiter must not be alphanumeric or backslash in ... on line 129
Warning: Delimiter must not be alphanumeric or backslash in ... on line 129
Warning: Array to string conversion in ... on line 128
Warning: Array to string conversion in ... on line 128
Warning: Delimiter must not be alphanumeric or backslash in ... on line 129
Warning: Delimiter must not be alphanumeric or backslash in ... on line 129
As you can see, no fatal error. The warnings are due to the
fact that the $func array now differs from what func() expects.
FWIW, this is on NT 5. I'll try to cut the script down to a
smallest possible one, and post it (the actual code uses MySQL).
I am ABSOLUTELY sure I haven't misspelled the function name.
At 21:36 3.4. 2001, James Moore wrote the following:
--------------------------------------------------------------
>> FWIW the builtin get_defined_functions() is executed.
>>
>> >I think this is a showstopper.
>> >
>> >I just realized I redefined get_defined_functions(), and
>> >RC6 doesn't complain. With error_reporting( E_ALL ) !!!
>> >
>> >4.0.4pl1 exits the script with fatal error.
>
>for:
>===== test.php =====
><?php
>
>function get_defined_functions() {
>echo "blaf";
>}
>
>echo print_r(get_defined_functions());
>?>
>=====================
>I get:
>Fatal error: Cannot redeclare get_defined_functions() in
>D:\webroot2\test.php on line 3
>
>sure you didnt misspell your function.. it works fine for me.
>
>-James
>
>
>--
>PHP Quality Assurance Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-qa-unsubscribe@lists.php.net
>For additional commands, e-mail: php-qa-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
cynic@mail.cz
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7