<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
It sounds like you're suggesting that $perm, a static variable within user_access() is being modified without user_access being called, but within a single page load. That doesn't seem possible in PHP, unless there is a PHP bug. Static variables are supposed to be local in scope to the functions that create them. To prove beyond a shadow of doubt, put a $debug statement in at the very beginning of the function user_access and another at the very end of the function. (just before the return). If what you're saying is true, there will be evidence in the "begin" value being different than the "end" value prior to it. <div><br><div>What I suspect is that another module is calling user_access, (perhaps with a different user, or modified roles in between) in between. If you serialize the $user and $perm variables within user_access, you ought to be able to tell. Myself I'd be greping for calls in the modules you suspect. </div><div><br></div><div>Dave<br><div><div>On Oct 30, 2008, at 10:32 AM, Ron Parker wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="font-family: Arial; font-size: 10pt; color: rgb(0, 0, 0); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The static<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>variable in<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user_access()</span><span class="Apple-converted-space"> </span>contains the permissions that users have. When<span class="Apple-converted-space"> </span><code><span style="font-family: arial, helvetica, sans-serif; "><span style="font-weight: bold; ">user_access('ClearCache', NULL, TRUE)</span><span class="Apple-converted-space"> </span>is executed, the static<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>value is emptied and re-filled with permissions from the current roles in the<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$user</span><span class="Apple-converted-space"> </span>object. Theorectically, when<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user_access()</span><span class="Apple-converted-space"> </span>is next called, assuming the $<span style="font-weight: bold; ">user</span><span class="Apple-converted-space"> </span>object contains the same roles, the<span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>variable should contain the same permissions which were cached in the first call. This is what happened in Drupal 5.x and the earlier versions of 6.x. This is NOT happening (at least consistently) in the most recent versions of the<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user.module</span>.</span><br></code></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><code><br></code></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I've written a bunch of debug code in the<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user, node<span class="Apple-converted-space"> </span></span>and<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">ogur<span class="Apple-converted-space"> </span></span>modules and now have more details. I am printing the output of<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user_access</span>() every time it is called.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">When I issue:<br></div><div class="codeblock"><code>user_access('ClearCache', NULL, TRUE)</code></div><br>Static<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>variable is cleared and re-filled with permissions from current<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$user</span><span class="Apple-converted-space"> </span>object. This is correct.<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">When<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">module_invoke</span>() is immediately executed next:<br></div><div class="codeblock"><code>module_invoke('node_content', 'access', 'create', 'story', $user)</code></div><br>It will now make another call to<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user_access()</span>:<br><div class="codeblock"><code>user_access('create story content', $user)</code></div><br>The<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$user</span><span class="Apple-converted-space"> </span>object still contains the same roles. The<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>variable now contains values. This is correct. But the values in<span style="font-weight: bold; "><span class="Apple-converted-space"> </span>$perm</span><span class="Apple-converted-space"> </span>are NOT the same as those inserted during the<span style="font-weight: bold; ">ClearCache</span><span class="Apple-converted-space"> </span>call above! They have changed, and NOT from the<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">user_access()</span><span class="Apple-converted-space"> </span>function (which I am monitoring)! So the question is: Why has this<span class="Apple-converted-space"> </span><span style="font-weight: bold; ">$perm</span><span class="Apple-converted-space"> </span>value changed?<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">So far, I've found this behaviour occurs with OGUR when one of the following modules is installed:</div><ul><li>taxonomy_access</li><li>tac_lite</li><li>menu_breadcrumb</li><li>admin_menu</li></ul><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I so far am unable to discover what it is about these modules which is causing this problem. This did not occur in 5.x and earlier 6.x versions of Drupal.<span class="Apple-converted-space"> </span><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Please, please, please help!</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-ron<br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></div></div></body></html>