Date: 06/29/00
- Next message: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Previous message: deekayen <email protected>: "[PHP-DEV] PHP 4.0 Bug #5294: Premature end of script headers"
- Next in thread: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Reply: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Reply: Matthew Kendall: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
That may be the new definition, but it wasn't the case under php3.
I didn't spot anything in your differences notes for this.
Is there a better way to do it?
My code fragment just highlights the problem, it's actually gleaned from
debugging a much larger and complex script. What I want to do is replace
an array with fresh contents when a loading function is invoked. This is
most simply done by using unset. This array is then used in many other
associated functions and each expects only the latest version of the
array, as loaded by the last invokation of the loading function.
To change all references to $GLOBALS wouldn't fulfil my need here.
Wouldn't unset($GLOBALS["name"]) just do the same thing?
To my mind the fact that a given variable is defined global should be
retained after using unset, it should merely initialise the array to
empty but keep it global for further references in the function.
My workaround to add a further global statement after using unset() to
redeclare it as global works in php4, but this doesn't work under php3 -
making this workaround unportable.
Regards
Alan
Bug Database wrote:
>
> ID: 5289
> Updated by: stas
> Reported By: alan.frostick <email protected>
> Status: Closed
> Bug Type: Scripting Engine problem
> Assigned To:
> Comments:
>
> That's true. That's what unset does on globals. If you like it other way,
> use $GLOBALS["name"].
>
> Full Bug description available at: http://bugs.php.net/version4/?id=5289
--Alan Frostick Icon Medialab AG Hamburg Gasstr.4 D- 22761 Hamburg Germany
home: http://www.iconmedialab.de mailto:alan.frostick <email protected> phone: +49- (0)40- 8979- 8219 fax: +49- (0)40- 8979- 8989
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Previous message: deekayen <email protected>: "[PHP-DEV] PHP 4.0 Bug #5294: Premature end of script headers"
- Next in thread: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Reply: Stanislav Malyshev: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Reply: Matthew Kendall: "Re: [PHP-DEV] Re: PHP 4.0 Bug #5289 Updated: Use of reset on a global array creates local array in function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

