oerdnj / deb.sury.org

Public bugreports for anything ppa:ondrej/*
825 stars 26 forks source link

php-smbclient extension broken for PHP 8.3.10 #2194

Closed ralfbecker closed 2 months ago

ralfbecker commented 3 months ago

Frequently asked questions

Describe the bug The smb extension used to connect to Samba shares is broken with PHP version 8.3.10, it was working with 8.3.8.

With broken I mean, e.g. scandir('smb://...') always returns an empty array, and NOT the files and directories of the share.

While with PHP 8.3.8 returns the files and directories in the share.

Both PHP versions and the extension are from you PPA for Ubuntu 20.04 (installed in a Docker container). To Reproduce Steps to reproduce the behavior:

php -a -r 'var_dump(scandir("smb://user:pass@server/share"));'

outputs

array(0) {
}

There is NO PHP error or warning ...

Your understanding of what is happening I have no idea, after update of PHP from 8.3.8 to 8.3.10 it no longer works ...

What steps did you take to resolve issue yourself before reporting it here

  1. Checked with smbclient itself using same user, password and share details that it is not a network or user issue.
  2. Checked with the older PHP 8.3.8 container, the same small php-cli call still works as expected, while it fails with 8.3.10

Expected behavior scandir('smb://...') should return files and directories of the share.

Distribution (please complete the following information):

Package(s) (please complete the following information): This is the NOT working PHP 8.3.10:

root@fpm-7ff8f649f6-fm6pz:/# apt-cache policy php8.3-fpm
php8.3-fpm:
  Installed: 8.3.10-1+ubuntu20.04.1+deb.sury.org+1
  Candidate: 8.3.10-1+ubuntu20.04.1+deb.sury.org+1
  Version table:
 *** 8.3.10-1+ubuntu20.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
root@fpm-7ff8f649f6-fm6pz:/# apt-cache policy php-smbclient
php-smbclient:
  Installed: (none)
  Candidate: 1.1.1-1+ubuntu20.04.1+deb.sury.org+2
  Version table:
     1.1.1-1+ubuntu20.04.1+deb.sury.org+2 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages

And this the working PHP 8.3.8:

root@fpm-test-544d6665d9-s5td8:/# apt-cache policy php8.3-fpm
php8.3-fpm:
  Installed: 8.3.8-2+ubuntu20.04.1+deb.sury.org+1
  Candidate: 8.3.8-2+ubuntu20.04.1+deb.sury.org+1
  Version table:
 *** 8.3.8-2+ubuntu20.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
root@fpm-test-544d6665d9-s5td8:/# apt-cache policy php-smbclient
php-smbclient:
  Installed: (none)
  Candidate: 1.1.1-1+ubuntu20.04.1+deb.sury.org+2
  Version table:
     1.1.1-1+ubuntu20.04.1+deb.sury.org+2 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages

I have not tested, nor used PHP 8.3.9. Additional context Nothing I'm aware off ...

Ralf

ralfbecker commented 2 months ago

Minimal steps to reproduce the problem with Docker and php8.3-smbclient:

docker run --rm -it ubuntu:20.04

apt-get update && apt-get install -y software-properties-common

LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update

apt-get install -y php8.3-{cli,smbclient}                        
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libavahi-client3 libavahi-common-data libavahi-common3 libbsd0 libcups2 libedit2 libjansson4 libldb2 libpcre2-8-0 libpopt0 libpython3.8 libsmbclient libsodium23 libtalloc2 libtdb1 libtevent0 libwbclient0 php-common php8.3-common
  php8.3-opcache php8.3-readline psmisc python3-ldb python3-talloc samba-libs
Suggested packages:
  cups-common php-pear
The following NEW packages will be installed:
  libavahi-client3 libavahi-common-data libavahi-common3 libbsd0 libcups2 libedit2 libjansson4 libldb2 libpopt0 libpython3.8 libsmbclient libsodium23 libtalloc2 libtdb1 libtevent0 libwbclient0 php-common php8.3-cli php8.3-common
  php8.3-opcache php8.3-readline php8.3-smbclient psmisc python3-ldb python3-talloc samba-libs
The following packages will be upgraded:
  libpcre2-8-0
1 upgraded, 26 newly installed, 0 to remove and 5 not upgraded.
...
php -a
Interactive shell

php > var_dump(scandir('smb://<user>:<path>@<host/ip>:<port>/<share>'));
array(0) {
}
php > exit

apt-cache policy php8.3-smbclient
php8.3-smbclient:
  Installed: 1.1.1-1+ubuntu20.04.1+deb.sury.org+2
  Candidate: 1.1.1-1+ubuntu20.04.1+deb.sury.org+2
  Version table:
 *** 1.1.1-1+ubuntu20.04.1+deb.sury.org+2 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
apt-cache policy php8.3-cli      
php8.3-cli:
  Installed: 8.3.10-1+ubuntu20.04.1+deb.sury.org+1
  Candidate: 8.3.10-1+ubuntu20.04.1+deb.sury.org+1
  Version table:
 *** 8.3.10-1+ubuntu20.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
onidlo commented 2 months ago

The same issue (scandir() always returns an empty array) applies also for sftp/ssh2. I hope that in 8.3.11 the issue is fixed, see here:

ttps://www.php.net/ChangeLog-8.php#8.3.11
Reverted fix for [GH-14930](https://github.com/php/php-src/issues/14930) (Custom stream wrapper dir_readdir output truncated to 255 characters).

This was introduced in 8.3.10

ralfbecker commented 2 months ago

I can confirm PHP smbclient extension is working (again) with PHP 8.3.11 :)

Ralf

onidlo commented 2 months ago

I'm still waiting for PHP 8.3.11 for Debian...

oerdnj commented 2 months ago

I'm still waiting for PHP 8.3.11 for Debian...

Something is broken on the builder when creating the .orig.tar.xz, I am investigating...