Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

Continually falling through InitializeSpecialCases else-if

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


dnessett at yahoo

Jul 21, 2009, 9:34 AM

Post #1 of 5 (586 views)
Permalink
Continually falling through InitializeSpecialCases else-if

Can someone please help. I have only been working on this code for 5 days and I do not yet understand it. It turns out that the redirect happens in InitializeSpecialCases. The reason I get into a redirect loop is the code continually falls into the else if statement that has the following conditions:

else if( $action == 'view' && !$request->wasPosted() &&
( !isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
!count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )

This is a sufficiently complex expression that I have no idea what each term represents. There must be someone out there who understands it. I just need someone to explain it so I can figure out what is going wrong.




_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Jul 21, 2009, 10:09 AM

Post #2 of 5 (546 views)
Permalink
Re: Continually falling through InitializeSpecialCases else-if [In reply to]

On Tue, Jul 21, 2009 at 12:34 PM, dan nessett<dnessett [at] yahoo> wrote:
> else if( $action == 'view' && !$request->wasPosted() &&
>                        ( !isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
>                        !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )

$action == 'view': This is a normal page view (not edit, history, etc.)

!$request->wasPosted(): This is a GET request, not POST.

!isset($this->GET['title']) || $title->getPrefixedDBKey() !=
$this->GET['title']: Either the title= parameter in the URL is unset,
or it's set but not to the same thing as $title.

!count( array_diff( array_keys( $this->GET ), array( 'action', 'title'
) ) ) ): There is no URL query parameter other than "title" and
"action" (e.g., no oldid=, diff=, . . .).

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


dnessett at yahoo

Jul 21, 2009, 10:54 AM

Post #3 of 5 (543 views)
Permalink
Re: Continually falling through InitializeSpecialCases else-if [In reply to]

Thanks! Here are the values that cause entry into the else-if statement:

$targetUrl === 'http://localhost/MediawikiTest/Latest Trunk Version/phase3/index.php/Main_Page'

$action === 'view'

$request->data === <null array>

$this->GET === <null array>

$title->mDbkeyform === 'Main_Page'

_SERVER[REQUEST_METHOD] === GET

I can see why the redirect else-if is entered (no title= parameter, $action === view), but the targetUrl looks OK to me. I'm not sure why the logic should analyze this case as a redirect.

P.S. When I previously dumped the get request using httpfox it showed (I haven't figured out how to configure netbeans to use FF, so this dump is from a separate run not using the debugger):

(Request-Line)    GET /MediawikiTest/Latest%20Trunk%20Version/phase3/index.php/Main_Page HTTP/1.1
Host    localhost
User-Agent    Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language    en-us,en;q=0.5
Accept-Encoding    gzip,deflate
Accept-Charset    ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive    300
Connection    keep-alive




--- On Tue, 7/21/09, Aryeh Gregor <Simetrical+wikilist [at] gmail> wrote:

> From: Aryeh Gregor <Simetrical+wikilist [at] gmail>
> Subject: Re: [Wikitech-l] Continually falling through InitializeSpecialCases else-if
> To: "Wikimedia developers" <wikitech-l [at] lists>
> Date: Tuesday, July 21, 2009, 10:09 AM
> On Tue, Jul 21, 2009 at 12:34 PM, dan
> nessett<dnessett [at] yahoo>
> wrote:
> > else if( $action == 'view' &&
> !$request->wasPosted() &&
> >                        (
> !isset($this->GET['title']) ||
> $title->getPrefixedDBKey() != $this->GET['title'] )
> &&
> >                        !count( array_diff(
> array_keys( $this->GET ), array( 'action', 'title' ) ) )
> )
>
> $action == 'view': This is a normal page view (not edit,
> history, etc.)
>
> !$request->wasPosted(): This is a GET request, not
> POST.
>
> !isset($this->GET['title']) ||
> $title->getPrefixedDBKey() !=
> $this->GET['title']: Either the title= parameter in the
> URL is unset,
> or it's set but not to the same thing as $title.
>
> !count( array_diff( array_keys( $this->GET ), array(
> 'action', 'title'
> ) ) ) ): There is no URL query parameter other than "title"
> and
> "action" (e.g., no oldid=, diff=, . . .).
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l







_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


happy-melon at live

Jul 21, 2009, 2:35 PM

Post #4 of 5 (540 views)
Permalink
Re: Continually falling through InitializeSpecialCaseselse-if [In reply to]

At a guess, you haven't set up short URLs properly. If you have no active
apache rewrite rules, then that is a URL that will trigger the internal
redirect. However, if your MW installation *thinks* that it's supposed to
serve short URLs in that format, then it will happily form the redirect URL
*in that format*; and there's your redirect loop.

--HM

"dan nessett" <dnessett [at] yahoo> wrote in message
news:790738.46469.qm [at] web32507
>
> Thanks! Here are the values that cause entry into the else-if statement:
>
> $targetUrl === 'http://localhost/MediawikiTest/Latest Trunk
> Version/phase3/index.php/Main_Page'
>
> $action === 'view'
>
> $request->data === <null array>
>
> $this->GET === <null array>
>
> $title->mDbkeyform === 'Main_Page'
>
> _SERVER[REQUEST_METHOD] === GET
>
> I can see why the redirect else-if is entered (no title= parameter,
> $action === view), but the targetUrl looks OK to me. I'm not sure why the
> logic should analyze this case as a redirect.
>
> P.S. When I previously dumped the get request using httpfox it showed (I
> haven't figured out how to configure netbeans to use FF, so this dump is
> from a separate run not using the debugger):
>
> (Request-Line) GET
> /MediawikiTest/Latest%20Trunk%20Version/phase3/index.php/Main_Page
> HTTP/1.1
> Host localhost
> User-Agent Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US;
> rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
> Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language en-us,en;q=0.5
> Accept-Encoding gzip,deflate
> Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive 300
> Connection keep-alive
>
>
>
>
> --- On Tue, 7/21/09, Aryeh Gregor <Simetrical+wikilist [at] gmail> wrote:
>
>> From: Aryeh Gregor <Simetrical+wikilist [at] gmail>
>> Subject: Re: [Wikitech-l] Continually falling through
>> InitializeSpecialCases else-if
>> To: "Wikimedia developers" <wikitech-l [at] lists>
>> Date: Tuesday, July 21, 2009, 10:09 AM
>> On Tue, Jul 21, 2009 at 12:34 PM, dan
>> nessett<dnessett [at] yahoo>
>> wrote:
>> > else if( $action == 'view' &&
>> !$request->wasPosted() &&
>> > (
>> !isset($this->GET['title']) ||
>> $title->getPrefixedDBKey() != $this->GET['title'] )
>> &&
>> > !count( array_diff(
>> array_keys( $this->GET ), array( 'action', 'title' ) ) )
>> )
>>
>> $action == 'view': This is a normal page view (not edit,
>> history, etc.)
>>
>> !$request->wasPosted(): This is a GET request, not
>> POST.
>>
>> !isset($this->GET['title']) ||
>> $title->getPrefixedDBKey() !=
>> $this->GET['title']: Either the title= parameter in the
>> URL is unset,
>> or it's set but not to the same thing as $title.
>>
>> !count( array_diff( array_keys( $this->GET ), array(
>> 'action', 'title'
>> ) ) ) ): There is no URL query parameter other than "title"
>> and
>> "action" (e.g., no oldid=, diff=, . . .).
>>
>> _______________________________________________
>> Wikitech-l mailing list
>> Wikitech-l [at] lists
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
>
>
>
>
> =



_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


dnessett at yahoo

Jul 21, 2009, 3:07 PM

Post #5 of 5 (539 views)
Permalink
Re: Continually falling through InitializeSpecialCaseselse-if [In reply to]

--HM--

Thanks. I have never really gotten around to setting up short URLs.

But, see my latest message. I think there is a bug in WebRequest::extractTitle(). If this turns out to be correct, I will either need to locally patch my installations or change the location of the test phase3 directories using a path that doesn't include blanks in path element srings. The former is probably best, since using the latter strategy, each time I updated the test code to the latest version I would have to reapply a non-standard patch.

Cheers,

Dan

--- On Tue, 7/21/09, Happy-melon <happy-melon [at] live> wrote:

> From: Happy-melon <happy-melon [at] live>
> Subject: Re: [Wikitech-l] Continually falling through InitializeSpecialCaseselse-if
> To: wikitech-l [at] lists
> Date: Tuesday, July 21, 2009, 2:35 PM
> At a guess, you haven't set up short
> URLs properly.  If you have no active
> apache rewrite rules, then that is a URL that will trigger
> the internal
> redirect.  However, if your MW installation *thinks*
> that it's supposed to
> serve short URLs in that format, then it will happily form
> the redirect URL
> *in that format*; and there's your redirect loop.
>
> --HM
>
> "dan nessett" <dnessett [at] yahoo>
> wrote in message
> news:790738.46469.qm [at] web32507
> >
> > Thanks! Here are the values that cause entry into the
> else-if statement:
> >
> > $targetUrl === 'http://localhost/MediawikiTest/Latest Trunk
> > Version/phase3/index.php/Main_Page'
> >
> > $action === 'view'
> >
> > $request->data === <null array>
> >
> > $this->GET === <null array>
> >
> > $title->mDbkeyform === 'Main_Page'
> >
> > _SERVER[REQUEST_METHOD] === GET
> >
> > I can see why the redirect else-if is entered (no
> title= parameter,
> > $action === view), but the targetUrl looks OK to me.
> I'm not sure why the
> > logic should analyze this case as a redirect.
> >
> > P.S. When I previously dumped the get request using
> httpfox it showed (I
> > haven't figured out how to configure netbeans to use
> FF, so this dump is
> > from a separate run not using the debugger):
> >
> > (Request-Line)    GET
> >
> /MediawikiTest/Latest%20Trunk%20Version/phase3/index.php/Main_Page
>
> > HTTP/1.1
> > Host    localhost
> > User-Agent    Mozilla/5.0 (Macintosh; U; PPC
> Mac OS X 10.4; en-US;
> > rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
> > Accept   
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > Accept-Language    en-us,en;q=0.5
> > Accept-Encoding    gzip,deflate
> > Accept-Charset   
> ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive    300
> > Connection    keep-alive
> >
> >
> >
> >
> > --- On Tue, 7/21/09, Aryeh Gregor <Simetrical+wikilist [at] gmail>
> wrote:
> >
> >> From: Aryeh Gregor <Simetrical+wikilist [at] gmail>
> >> Subject: Re: [Wikitech-l] Continually falling
> through
> >> InitializeSpecialCases else-if
> >> To: "Wikimedia developers" <wikitech-l [at] lists>
> >> Date: Tuesday, July 21, 2009, 10:09 AM
> >> On Tue, Jul 21, 2009 at 12:34 PM, dan
> >> nessett<dnessett [at] yahoo>
> >> wrote:
> >> > else if( $action == 'view' &&
> >> !$request->wasPosted() &&
> >> >           
>             (
> >> !isset($this->GET['title']) ||
> >> $title->getPrefixedDBKey() !=
> $this->GET['title'] )
> >> &&
> >> >           
>             !count(
> array_diff(
> >> array_keys( $this->GET ), array( 'action',
> 'title' ) ) )
> >> )
> >>
> >> $action == 'view': This is a normal page view (not
> edit,
> >> history, etc.)
> >>
> >> !$request->wasPosted(): This is a GET request,
> not
> >> POST.
> >>
> >> !isset($this->GET['title']) ||
> >> $title->getPrefixedDBKey() !=
> >> $this->GET['title']: Either the title=
> parameter in the
> >> URL is unset,
> >> or it's set but not to the same thing as $title.
> >>
> >> !count( array_diff( array_keys( $this->GET ),
> array(
> >> 'action', 'title'
> >> ) ) ) ): There is no URL query parameter other
> than "title"
> >> and
> >> "action" (e.g., no oldid=, diff=, . . .).
> >>
> >> _______________________________________________
> >> Wikitech-l mailing list
> >> Wikitech-l [at] lists
> >> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> >
> >
> >
> >
> >
> >      =
>
>
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>




_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.