Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果修改了"wp_"表前缀的话,带有评论的页面会无法正确显示 #863

Closed
0xba1100n opened this issue Mar 20, 2024 · 9 comments · Fixed by Yish1/Sakurairo#6
Labels
bug Something isn't working

Comments

@0xba1100n
Copy link

Fatal error: Uncaught Error: Call to undefined function curl_init() in /var/www/html/wp-content/themes/Sakurairo/functions.php:356 Stack trace: #0 /var/www/html/wp-content/themes/Sakurairo/functions.php(399): convertip() #1 /var/www/html/wp-includes/class-walker-comment.php(183): akina_comment_format() #2 /var/www/html/wp-includes/class-wp-walker.php(147): Walker_Comment->start_el() #3 /var/www/html/wp-includes/class-walker-comment.php(139): Walker->display_element() #4 /var/www/html/wp-includes/class-wp-walker.php(390): Walker_Comment->display_element() #5 /var/www/html/wp-includes/comment-template.php(2391): Walker->paged_walk() #6 /var/www/html/wp-content/themes/Sakurairo/comments.php(31): wp_list_comments() #7 /var/www/html/wp-includes/comment-template.php(1618): require('...') #8 /var/www/html/wp-content/themes/Sakurairo/footer.php(16): comments_template() #9 /var/www/html/wp-includes/template.php(790): require_once('...') #10 /var/www/html/wp-includes/template.php(725): load_template() #11 /var/www/html/wp-includes/general-template.php(92): locate_template() #12 /var/www/html/wp-content/themes/Sakurairo/single.php(23): get_footer() #13 /var/www/html/wp-includes/template-loader.php(106): include('...') #14 /var/www/html/wp-blog-header.php(19): require_once('...') #15 /var/www/html/index.php(17): require('...') #16 {main} thrown in /var/www/html/wp-content/themes/Sakurairo/functions.php on line 356

似乎由于functions.php中的"wp_comments"写死,导致如果修改了"wp_"表前缀的话,比如"wp114514_comments",带有评论的页面会无法正确显示
实际上更改functions.php中三个出现wp_comments为XXX_comments以后仍然不能解决问题,后面跟进报错发现原来是convertip函数有问题,于是关闭评论者的ip属地显示功能,就正常了,请作者大大看看是怎么回事_(:з」∠)_

@0xba1100n 0xba1100n added the bug Something isn't working label Mar 20, 2024
Copy link

@0xba1100n,感谢你给 sakurairo 提出了 issue。ヾ(≧▽≦*)o
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@KotoriK
Copy link
Collaborator

KotoriK commented Mar 28, 2024

那么为什么要修改表名呢

@CRK1918
Copy link

CRK1918 commented Mar 28, 2024

🤨 改前缀没有关系才对,我上一年改了都没有问题。

你是用什么方法改的? 我之前是使用插件帮我改的。

@luinniuxx
Copy link

luinniuxx commented Mar 28, 2024

那么为什么要修改表名呢

改变默认设置, 可能是因为安全问题... 对比一其他的安全措施,这个是非常小的一个吧。

@KotoriK
Copy link
Collaborator

KotoriK commented Mar 28, 2024

预想用$wpdb->comments获取表名,看看可不可以

@KotoriK
Copy link
Collaborator

KotoriK commented Mar 28, 2024

curl_init()

另外你贴的这个问题是没装curl导致的,和表名无关

KotoriK added a commit that referenced this issue Mar 28, 2024
@0xba1100n
Copy link
Author

那么为什么要修改表名呢

作者大大你好(*´▽`)ノ,这个是WordPress建站的时候的可选项,我当时修改这个的目的是为了增加sql注入时猜测表名的难度,比如wp_comments根本就不需要猜,但是我改成了形如1145141919abcd_这样的前缀,当时的想法是制造点小麻烦吧

@0xba1100n
Copy link
Author

🤨 改前缀没有关系才对,我上一年改了都没有问题。

你是用什么方法改的? 我之前是使用插件帮我改的。

我是直接在wp建站时改的,这个框架大部分功能点都是没有问题的,但唯独就是显示IP属地功能一旦打开,就会引用到这一块写死了表名的代码,然后造成网站页面显示错乱

@0xba1100n
Copy link
Author

curl_init()

另外你贴的这个问题是没装curl导致的,和表名无关

还真是,哈哈没注意到,当时直奔functions.php去了,然后恰好看到那个地方就以为仅仅是那里的问题_(:з」∠)_辛苦作者啦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants