Download & Extend

url() call outside any function context in swftools.module breaks some other modules init

Project:SWF Tools
Version:6.x-2.5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

In swftools.module, line 27 :

<?php
define
('SWFTOOLS_DEFAULT_BG', url(drupal_get_path('module', 'swftools') . '/shared/swftools-default.jpg', array('absolute' => TRUE)));   // A generic image for use in certain contexts.
?>

This break the Purl module init process. They use the custom_url_rewrite_outbound() hook to rewrite outbound URL, when this hook is being called, it will statically init and cache contextual information that has not been built yet, because your module run this hook by doing an url() function call.

They also use the hook_init() in order to set-up contextual information, such as most modules would do, by calling url() in a non-hook context, it may result in wrong URL() because of this, also it could break in fact it does break some other modules init process.

You should do this initialization withing the hook_init(), it would be enougth to avoid this kind of weird behaviors.

Comments

#1

Here is a quick and dirty patch that does the trick, and seems to work peacefully on my dev box.

AttachmentSize
swftools.module-6.x-2.5-url_call_hook_init.patch 1.22 KB

#2

Status:active» closed (duplicate)

let's combine efforts & move the discussion here: #564512: Breaks URL rewriting modules

#3

Thanks, I did not found this issue when I looked for.