strpos() is deprecated in php 7.3 #865

Closed
opened 2026-10-05 00:21:44 +02:00 by adam · 13 comments
Owner

I ran into this message after upgrading to php 7.3 : Deprecated function: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior.

The fix is to change the file jshrink.class.php :

  • line 195
    if(strpos('(-+{[@', chr($this->b)) !== false)

  • line 254
    if(($this->b == '/' && strpos('(,=:[!&|?', chr($this->a)) !== false))

Regards
Bruno

I ran into this message after upgrading to php 7.3 : Deprecated function: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior. The fix is to change the file jshrink.class.php : - line 195 if(strpos('(-+{[@', chr($this->b)) !== false) - line 254 if(($this->b == '/' && strpos('(,=:[!&|?', chr($this->a)) !== false)) Regards Bruno <!-- github-sync-id:421643269 -->
adam closed this issue 2026-10-05 00:21:44 +02:00
Author
Owner

Hi @brunobydesign

Your issue is related to #951

I see 2 options here:

  1. we implement the minimum change on jshrink.class.php to work on PHP 7.3 and we can have it for Piwigo 2.9.5 (coming very very soon)
  2. we completely update jshrink.class.php to latest version, as suggested by @tkuther but we wait for Piwigo 2.10
  3. both
Hi @brunobydesign Your issue is related to #951 I see 2 options here: 1) we implement the minimum change on `jshrink.class.php` to work on PHP 7.3 and we can have it for Piwigo 2.9.5 (coming very very soon) 2) we completely update `jshrink.class.php` to latest version, as suggested by @tkuther but we wait for Piwigo 2.10 3) both <!-- github-comment-id:479822524 -->
Author
Owner

For now, I only fixed the compatibility with PHP 7.3 based on https://github.com/tedious/JShrink/commit/91105810dafedba0390608d7465abd602beb6410

cc @tkuther

For now, I only fixed the compatibility with PHP 7.3 based on https://github.com/tedious/JShrink/commit/91105810dafedba0390608d7465abd602beb6410 cc @tkuther <!-- github-comment-id:480871208 -->
Author
Owner

@plegall cool, thanks!

@plegall cool, thanks! <!-- github-comment-id:480871662 -->
Author
Owner

@plegall sorry I didn't answer to your previous post. This is the only issue Piwigo had with php 7.3 as far as i can tell, since my site is running ok since 3 weeks, so, imho, it is worthwhile using a quick fix and ship, to let people who want it move on to 7.3.
Regads
Bruno

@plegall sorry I didn't answer to your previous post. This is the only issue Piwigo had with php 7.3 as far as i can tell, since my site is running ok since 3 weeks, so, imho, it is worthwhile using a quick fix and ship, to let people who want it move on to 7.3. Regads Bruno <!-- github-comment-id:480889305 -->
Author
Owner

To give a little detail, please note that I didn't have this error message on PHP 7.3.1. It appeared only when I updated to PHP 7.3.3.

To give a little detail, please note that I didn't have this error message on PHP 7.3.1. It appeared only when I updated to PHP 7.3.3. <!-- github-comment-id:481144467 -->
Author
Owner

Still broken in 2.10

Still broken in 2.10 <!-- github-comment-id:539713581 -->
Author
Owner

I have tested on PHP 7.3.10 before releasing Piwigo 2.10.0 and no issue at all. This is why I didn't ring any bell in my head! We'll fix #951 for Piwigo 2.10.1

I have tested on PHP 7.3.10 before releasing Piwigo 2.10.0 and no issue at all. This is why I didn't ring any bell in my head! We'll fix #951 for Piwigo 2.10.1 <!-- github-comment-id:539881076 -->
Author
Owner

Hm, it looks like this was just an upgrade issue of my darkroom demo instance
No issues on my other instances.

Sorry for the noise :)

Hm, it looks like this was just an upgrade issue of my darkroom demo instance No issues on my other instances. Sorry for the noise :) <!-- github-comment-id:539886750 -->
Author
Owner

Hum... did you upgrade your PHP version? Was it just a PHP bug? is updating jshrink to version 1.3.1 required then (considering it has a higher PHP requirement than current version embedded in Piwigo)

Hum... did you upgrade your PHP version? Was it just a PHP bug? is updating jshrink to version 1.3.1 required then (considering it has a higher PHP requirement than current version embedded in Piwigo) <!-- github-comment-id:539891345 -->
Author
Owner

I still had the issue, although I updated jshrink.class.php (again) after 2.10 update. Previously it worked with updated jshrink class.

Edit: The (web) update seems to have run incompletely. Overwriting the installation with the contents of the source tarball, got things moving again.

I still had the issue, *although* I updated jshrink.class.php (again) after 2.10 update. Previously it worked with updated jshrink class. Edit: The (web) update seems to have run incompletely. Overwriting the installation with the contents of the source tarball, got things moving again. <!-- github-comment-id:539975359 -->
Author
Owner

I upgraded piwigo to version 2.10 today, and I confirm the same message.

<b>Deprecated</b>:  strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in <b>/var/www/vhosts/xxxxxx.cz/httpdocs/piwigo/include/jshrink.class.php</b> on line <b>195</b><br />;
I upgraded piwigo to version 2.10 today, and I confirm the same message. <b>Deprecated</b>: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in <b>/var/www/vhosts/xxxxxx.cz/httpdocs/piwigo/include/jshrink.class.php</b> on line <b>195</b><br />; <!-- github-comment-id:540087278 -->
Author
Owner

Try the check files integrity plugin, does it report anything?

Try the check files integrity plugin, does it report anything? <!-- github-comment-id:540089237 -->
Author
Owner

Hm, seems to be related to GThumb+ here. Plain 2.10 with GThumb+ enabled breaks on category view.

EDIT: no, picture page is broken, too.
curl -sSL -o - https://github.com/Piwigo/Piwigo/pull/952.patch | patch -p1
and things start working again

Hm, seems to be related to GThumb+ here. Plain 2.10 with GThumb+ enabled breaks on category view. EDIT: no, picture page is broken, too. `curl -sSL -o - https://github.com/Piwigo/Piwigo/pull/952.patch | patch -p1` and things start working again <!-- github-comment-id:540090501 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#865