[wp-trac] Re: [WordPress Trac] #8317: New installs: admin has
user_level 0
WordPress Trac
wp-trac at lists.automattic.com
Tue Nov 25 23:40:49 GMT 2008
#8317: New installs: admin has user_level 0
---------------------+------------------------------------------------------
Reporter: Mr Pete | Owner: jacobsantos
Type: defect | Status: new
Priority: normal | Milestone: 2.8
Component: Upgrade | Version: 2.5
Severity: major | Resolution:
Keywords: |
---------------------+------------------------------------------------------
Comment (by Mr Pete):
Ummm... that can't possibly fix it ;)
Look at schema.php -- It grabs a role object, then uses it to insert a
bunch of capabilities.
In PHP5, it automatically grabs a reference to the original, and all is
well. Doesn't matter whether you "&" or not.
In PHP4, unless you "&" both the declaration AND use, it grabs a COPY of
the object. So, the inserted capabilities never make it into the original
object instantiation!
In PHP4, declaring the function with "&" means it is capable of returning
a reference. Using with "&" means it actually grabs a reference. Eliminate
either one, or both, and you get a copy.
Thus, to code compatibly for PHP4 and PHP5, you have to use "&" in both
declaration and use.
--
Ticket URL: <http://trac.wordpress.org/ticket/8317#comment:24>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list