View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20059Bug reportsPluginspublic2025-05-12 09:47
ReporterDenisChenu Assigned Togabrieljenik  
PrioritynoneSeverityminor 
Status assignedResolutionopen 
Product Version6.6.x 
Summary20059: createAbsoluteUrl don't use publicurl
Description

Using createAbsoluteUrl in plugin are broken even when set publicurl

Steps To Reproduce

Steps to reproduce

Import and activate included plugins
Set publicurl = 'https://example.org' in config.php
Launch php application/commands/console.php plugin index --target=checkCommandUrl
Launch php application/commands/console.php plugin index --target=checkCommandUrlSetHost

Expected result

have valid url in both plugins

Actual result

have invalid url in both plugins

  • with checkCommandUrl SURVEYURL is OK, but not OPTOUTURL
  • with checkCommandUrlSetHost OPTOUTURL is OK, but not SURVEYURL
TagsNo tags attached.
Attached Files
checkCommandUrl.zip (1,505 bytes)
Bug heat4
Complete LimeSurvey version number (& build)6.12.4
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP VersionPHP8.2

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2025-04-14 16:20

developer   ~82425

Real result

$ php8.2 application/commands/console.php plugin index --target=checkCommandUrl
http://application/commands/console.php?r=survey/index&surveyid=123
http://application/commands/console.php?r=optout/tokens&surveyid=&token=abcd
https://example.org/console.php?r=survey/index&sid=489424&lang=en
$ php8.2 application/commands/console.php plugin index --target=checkCommandUrlSetHost
http://limesurtvey.example.com/subdirectory?r=survey/index&surveyid=123
http://limesurtvey.example.com/subdirectory?r=optout/tokens&surveyid=123&token=abcd
https://example.orghttp://limesurtvey.example.com/subdirectory?r=survey/index&sid=489424&lang=en

I don't have opinion if checkCommandUrlSetHost must use publicurl or not.

For checkCommandUrl : broken without error_reporting(0);
PHP Error[2]: Undefined array key "SERVER_NAME"
Must be avoided too

gabrieljenik

gabrieljenik

2025-05-01 15:29

manager   ~82549

We have App()->createPublicUrl() for that. Have you tried it?

DenisChenu

DenisChenu

2025-05-01 20:32

developer   ~82553

Last edited: 2025-05-01 20:32

Maybe but createAbsoluteUrl still broken

gabrieljenik

gabrieljenik

2025-05-01 21:20

manager   ~82554

createAbsoluteUrl is std for Yii.
I believe it is not aware of publicurl (which is something LS related).

DenisChenu

DenisChenu

2025-05-02 08:08

developer   ~82555

I believe it is not aware of publicurl (which is something LS related).

It work in 3.X (and in 5.0)

gabrieljenik

gabrieljenik

2025-05-09 19:15

manager   ~82637

Was not able to get the expected behaviour neither on 3.x or 5.x
Tried:
5.6.58
5.6.24
3.28.77
3.10.0

I understand you talk about this was working before.
Still, I wasn't able to get those plugins to work as expected in any of those versions.

From what we have analyzed those plugins end up calling the Yii std version of createAbsoluteUrl.
The regular controllers have a method createAbsoluteUrl that end up calling createPublicUrl.

That's the one that I suggest to use.

So far, not sure how else I can help.
Sorry.

DenisChenu

DenisChenu

2025-05-12 09:40

developer   ~82644

Last edited: 2025-05-12 09:42

3.27

$ php application/commands/console.php plugin index --target=checkCommandUrlSetHost
http://limesurtvey.example.com/subdirectory/?r=survey/index&surveyid=123
http://limesurtvey.example.com/subdirectory/?r=optout/tokens&surveyid=123&token=abcd
Error: Call to undefined function dateShift() in /media/shnoulle/data/webdev/ls3/application/models/Survey.php:443
Stack trace:
#0 /media/shnoulle/data/webdev/ls3/framework/db/ar/CActiveRecord.php(222): Survey->scopes()
#1 /media/shnoulle/data/webdev/ls3/plugins/checkCommandUrlSetHost/checkCommandUrlSetHost.php(44): CActiveRecord->__call()
#2 [internal function]: checkCommandUrlSetHost->directCli()
#3 /media/shnoulle/data/webdev/ls3/application/libraries/PluginManager/PluginManager.php(185): call_user_func()
#4 /media/shnoulle/data/webdev/ls3/application/commands/PluginCommand.php(45): LimeSurvey\PluginManager\PluginManager->dispatchEvent()
#5 [internal function]: PluginCommand->actionIndex()
#6 /media/shnoulle/data/webdev/ls3/framework/console/CConsoleCommand.php(178): ReflectionMethod->invokeArgs()
#7 /media/shnoulle/data/webdev/ls3/framework/console/CConsoleCommandRunner.php(71): CConsoleCommand->run()
#8 /media/shnoulle/data/webdev/ls3/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()
#9 /media/shnoulle/data/webdev/ls3/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#10 /media/shnoulle/data/webdev/ls3/application/commands/console.php(70): CApplication->run()

With or without publicurl set

I use since years with https://gitlab.com/SondagesPro/mailing/sendMailCron

DenisChenu

DenisChenu

2025-05-12 09:45

developer   ~82645

Last edited: 2025-05-12 09:46

5.6

shnoulle@Belgarion:/media/shnoulle/data/webdev/ls5$ php application/commands/console.php plugin index --target=checkCommandUrlSetHost
http://limesurtvey.example.com/subdirectory?r=survey/index&surveyid=123
http://limesurtvey.example.com/subdirectory?r=optout/tokens&surveyid=123&token=abcd
http://limesurtvey.example.com/subdirectory?r=survey/index&sid=998872&lang=en

With 3 and 5 : checkCommandUrl never work but checkCommandUrlSetHost work.

Now checkCommandUrl and checkCommandUrlSetHost broke.

At minima : checkCommandUrlSetHost must work like it was in 3 and 5. And it's better if checkCommandUrl work.

DenisChenu

DenisChenu

2025-05-12 09:47

developer   ~82646

The biggest issue are

$ php8.2 application/commands/console.php plugin index --target=checkCommandUrlSetHost
https://example.orghttp://limesurtvey.example.com/subdirectory?r=survey/index&sid=489424&lang=en

Issue History

Date Modified Username Field Change
2025-04-14 16:17 DenisChenu New Issue
2025-04-14 16:17 DenisChenu File Added: checkCommandUrl.zip
2025-04-14 16:17 DenisChenu File Added: checkCommandUrlSetHost.zip
2025-04-14 16:20 DenisChenu Note Added: 82425
2025-04-14 16:20 DenisChenu Bug heat 0 => 2
2025-04-24 22:00 tibor.pacalat Assigned To => gabrieljenik
2025-04-24 22:00 tibor.pacalat Status new => assigned
2025-05-01 15:29 gabrieljenik Note Added: 82549
2025-05-01 15:29 gabrieljenik Bug heat 2 => 4
2025-05-01 20:32 DenisChenu Note Added: 82553
2025-05-01 20:32 DenisChenu Note Edited: 82553
2025-05-01 21:20 gabrieljenik Note Added: 82554
2025-05-02 08:08 DenisChenu Note Added: 82555
2025-05-09 19:15 gabrieljenik Note Added: 82637
2025-05-09 19:15 gabrieljenik Status assigned => feedback
2025-05-12 09:40 DenisChenu Note Added: 82644
2025-05-12 09:40 DenisChenu Status feedback => assigned
2025-05-12 09:42 DenisChenu Note Edited: 82644
2025-05-12 09:45 DenisChenu Note Added: 82645
2025-05-12 09:46 DenisChenu Note Edited: 82645
2025-05-12 09:47 DenisChenu Note Added: 82646