diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-12-10 17:13:25 +0100 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-12-10 17:13:25 +0100 |
commit | 9e5284a60f39a9fc764422a03d6522eeabff23a8 (patch) | |
tree | 53b27d53f4217685165a9b91198925ced108f8aa /api | |
parent | 6d3ad57a5c9b103fac081bb8eabd959a2f7baf1c (diff) | |
download | chd_gestion-9e5284a60f39a9fc764422a03d6522eeabff23a8.zip chd_gestion-9e5284a60f39a9fc764422a03d6522eeabff23a8.tar.gz chd_gestion-9e5284a60f39a9fc764422a03d6522eeabff23a8.tar.bz2 |
Bugfix : strpos() avec un offset qui peut être hors chaine.
[Thu Dec 08 14:13:18.245825 2016] [:error] [pid 10306] [client
185.61.116.41:48834] PHP Warning: strpos(): Offset not contained in
string in /root/chd_gestion/api/img_adt_svc_relais.php on line 94
Diffstat (limited to 'api')
-rw-r--r-- | api/img_adt_svc_relais.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/api/img_adt_svc_relais.php b/api/img_adt_svc_relais.php index d62145c..18abebe 100644 --- a/api/img_adt_svc_relais.php +++ b/api/img_adt_svc_relais.php @@ -90,10 +90,13 @@ EOD; function node_adt($adherent_id, $shape, $adt, $adt_title) { $adt_title = htmlentities($adt_title); + $adt_title_len = strlen($adt_title); foreach ( [ 10, 30 ] as $limit ) { - $breakpos = strpos($adt_title, ' ', $limit); - if ( $breakpos !== FALSE ) { - $adt_title = substr($adt_title, 0, $breakpos) . '<br/>' . substr($adt_title, $breakpos); + if ( $adt_title_len > $limit ) { + $breakpos = strpos($adt_title, ' ', $limit); + if ( $breakpos !== FALSE ) { + $adt_title = substr($adt_title, 0, $breakpos) . '<br/>' . substr($adt_title, $breakpos); + } } } return <<<EOD |